Skip to content

Conversation

@bonfus
Copy link

@bonfus bonfus commented Mar 28, 2018

This pull request is just to discuss the possibility of labelling tests and printing partial information as the test proceeds.
I see many ways of doing this, including creating and initializing a new tester_t variable for each test.

The main point here is having a way to identify which test failed with a label. What's your opinion?

@pdebuyl
Copy link
Owner

pdebuyl commented Mar 28, 2018

Hi, I agree that some more information would be nice.

I thought already of the problem, with several strategies:

  • Have a %set_name command that sets the name of the coming test. Upon first failure, this name is copied into a member variable %first_failed_on so the output would be as it is now, plus the name of the first failed test.
  • Store the test count in a dictionary (see my recent project https://github.com/pdebuyl/fortran_hash_table and then output the number of failures "per named test".

In the latter option, the current name would be used as the key to the dictionary and the entry would include number of tests and number of failures.

Would these options work for your workflow?

@bonfus
Copy link
Author

bonfus commented Mar 29, 2018

I'm slightly in favour of the second option since it gives you the whole picture when the test is completed and it's simpler to share when opening issues.
Both are fine for me anyway.

@pdebuyl
Copy link
Owner

pdebuyl commented Mar 29, 2018

Thank you for the feedback. I have a number of work-related priorities so I might not be able to implement the dict-based counters in the coming 3 weeks.

For early feedback, this is the type of code I'd like to write:

call tester%set_name('floating point')
do i = 1, n_fp_tests
    call tester%assert_close(x, y)
end do
call tester%set_name('final result')
call tester%assert_true(some_result)

so that you could perform many test under one name, while for other names a single test would executed, etc.

The code could be used without any test name as well, for simplicity and backwards compatibility.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants