wide-integer icon indicating copy to clipboard operation
wide-integer copied to clipboard

Split tests into many individual tests each with `main()`

Open ckormanyos opened this issue 3 years ago • 2 comments

From #130 we find out that, the tests aren't very easy to use.

There is one single huge result in a single program.

The purpose of this issue is to attempt to find a sensible way to split wide-integer's tests into many individual tests with each having independent main() functions thereby allowing for their running in parallel

ckormanyos avatar Nov 07 '21 18:11 ckormanyos

Suggestion:

  • Start by breaking up the target, test_uintwide_t, in test/unit/_impl/wide-integer.cpp each one target per source file.
  • Invoke the tests with ctest --output-on-failure --parallel 8 to run 8 at a time.
  • Use assert to test each assumption: it prints a decent diagnostic message with very terse code.
  • Or consider using a testing framework like Catch2 or GTest to generate the test cases so that you don't need to write a main function for each .cpp.
  • When there are multiple assertions in a test, consider breaking into multiple tests within the same source file.

johnmcfarlane avatar Nov 09 '21 07:11 johnmcfarlane

Start by breaking up the target, test_uintwide_t, ...

Indeed. That is sound advice @johnmcfarlane. My priority at the moment is that you can move forward and all present client code remains un-broken. But I'll definitely look into your suggestions as the project rolls forward.

Thankis John!

ckormanyos avatar Nov 09 '21 14:11 ckormanyos

At the moment, with the runners on GHA, I'm happy with the testing. I'll close this issue but if anything changes, reconsider then.

Cc: @johnmcfarlane

ckormanyos avatar Aug 26 '23 17:08 ckormanyos