rapidcheck icon indicating copy to clipboard operation
rapidcheck copied to clipboard

Recommended approach for nested test contexts?

Open ornamentist opened this issue 7 years ago • 2 comments

I might be missing something (while relearning modern C++ and Rapidcheck) but is there a recommended way to group tests into named "contexts", something like:

rc::context("equality", []( ) {
  rc::check("is symmetric", [](foo x, foo y) {
    return (x == y) == (y == x);
  });

  rc::check("is symmetric", ...});

  // ...
});

That may not be valid C++ even if implemented as above but I hope the idea is clear.

ornamentist avatar Feb 22 '18 04:02 ornamentist

RapidCheck in an of itself only provides a very barebones "test framework". If you want something like this, I'd recommend you use something like Catch, Google Test or Boost Test with the respective RapidCheck integration.

emil-e avatar Feb 22 '18 08:02 emil-e

Thanks for the hint -- Catch2 might not be a good fit as it's not clear each framework knows what stdout/stderr messages the other is producing. Ditto for --help command line arguments.

Will investigate Google Test and Boost Test.

ornamentist avatar Feb 22 '18 22:02 ornamentist