Commit 151a578a authored by Matthias Vallentin's avatar Matthias Vallentin

Update outdated unit test framework README

parent 36ef46e5
......@@ -11,26 +11,40 @@ Concepts
- A **check** represents a single verification of boolean operation.
- A **test** contains one or more checks.
- A **suite** groups tests together.
- A **fixture** equips a test with a fixed data environment.
Example
-------
```cpp
#define CAF_SUITE core
#include <caf/test/unit_test.hpp>
CAF_SUITE("core")
CAF_TEST("multiply")
CAF_TEST(multiply)
{
CAF_REQUIRE(0 * 1 == 0);
CAF_CHECK(42 + 42 == 84);
}
CAF_TEST("divide")
struct fixture {
fixture() {
CAF_MESSAGE("entering test");
}
~fixture() {
CAF_MESSAGE("leaving test");
}
};
CAF_TEST_FIXTURE_SCOPE(tracing_scope, fixture)
CAF_TEST(divide)
{
CAF_FAIL(0 / 1 == 0);
CAF_CHECK(1 / 1 == 0); // fails
}
CAF_TEST_FIXTURE_SCOPE_END()
```
You can provide your own `main` function by defining `CAF_TEST_NO_MAIN`
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment