Macros | |
#define | PW_UNIT_TEST_LINK_FILE_CONTAINING_TEST(suite, name) _PW_UNIT_TEST_LINK_TESTS(_pw_unit_test_Info_##suite##_##name) |
Functions | |
template<typename T > | |
StatusWithSize | pw::string::UnknownTypeToString (const T &value, span< char > buffer) |
#define PW_UNIT_TEST_LINK_FILE_CONTAINING_TEST | ( | suite, | |
name | |||
) | _PW_UNIT_TEST_LINK_TESTS(_pw_unit_test_Info_##suite##_##name) |
Ensures tests in a static library are linked and executed. Provide the test suite name and test name for one test in the file linked into a static library. Any test in the file may be used, but it's recommended to use the first for consistency. The test must be in a static library that's a dependency of this target. Referring to a test that does not exist causes a linker error.
The linker usually ignores tests linked through a static library because test registration relies on the test instance's static constructor adding itself to a global list of tests. When linking against a static library, static constructors in an object file will be ignored unless at least one entity in that object file is linked.
This macro works by passing the internal TestInfo
instance to a constructor defined in a source file. This guarantees that the TestInfo
instance is referenced, so the linker will link it and the other tests in that file.