project-asgard / asgard

MIT License
27 stars 20 forks source link

Remove duplication of code from _tests.cpp #144

Closed dlg0 closed 4 years ago

dlg0 commented 5 years ago

In time_advance_tests.cpp we use a lot of duplicate setup code just to test each of the PDEs. This needs to be cleaned up such that we use the setup code from the main program itself, rather than this duplicate - but possibly different from the real code - version.

It is also a pain to maintain if anything in the setup code changes, since every PDE test code has to be updated.

grahamlopez commented 5 years ago

Now that you have pointed it out, I am starting to see this in other places besides time_advance.

grahamlopez commented 5 years ago

just some more discussion: something to consider here is that the macro system used by Catch2 is designed to maximally isolate each test case but allow reuse. see https://github.com/catchorg/Catch2/blob/master/docs/tutorial.md#test-cases-and-sections specifically

For each SECTION the TEST_CASE is executed from the start

and

Sections can be nested to an arbitrary depth (limited only by your stack size). Each leaf section (i.e. a section that contains no nested sections) will be executed exactly once, on a separate path of execution from any other leaf section (so no leaf section can interfere with another).

bmcdanie commented 5 years ago

@dlg0 this has been fixed for time_advance_tests as well as some of the chunk/batch tests in #138 - I plan to apply this pattern to the other tests during the issue-thon.

dlg0 commented 5 years ago

I look forward to

issue-thon 2019

bmcdanie commented 4 years ago

closed by #193