Skip to content

Code overview

Elwardi edited this page Nov 6, 2022 · 3 revisions

Nothing is added to Catch2's code for now; things will get added as/if needed. Potential fields are reporters and matchers.

I would like to bring some issues to your attention though.

"Unsafe" code

Keep in mind that, to support all OpenFOAM forks, two global pointers are needed:

  • One points to the argList object created by including setRootCase.H in the test driver
  • The other one points to a time object, created by including createTime.H in the test driver

In every .C file of the tests, you need to extern these variables and grab references to them so they can be used. This rarely gets in your way - but just know that you have two global pointers that need to be dereferenced on the start of each test case.

Dereferencing a global pointer is unsafe coding at best, but the objects pointed to by the pointers will always be there, unless you go out of your way to make this fail of course.

Also, as the time object is shared by all tests, remember to set it to 0 again if you increment it. This was detailed at Basic usage.

Clone this wiki locally