FCF 2.0 development in progress...
> > > >
[News] [C++ Libraries API] [C++ Downloads] [Donate to the project] [Contacts]

FCF_TEST_GROUP_ORDER macro

FCF_TEST_GROUP_ORDER (const char* am_group, int am_order)

Package: fcfTest

File: test.hpp

Available from version: 1.0.1

Registers a deterministic execution priority for a specific test group. Lower integer values indicate higher priority (run earlier).

The FCF_TEST_GROUP_ORDER macro is used to define the execution sequence of test groups. By default, groups are executed in alphabetical order by their name. This macro allows you to override that behavior by assigning a numeric priority to each group.

The test runner sorts all registered groups based on the provided am_order value before executing the tests contained within them.

Arguments

const char* am_group
- The exact string name of the test group to prioritize.

int am_order
- An integer representing the execution priority. Lower values are executed first.

Example:

#define FCF_TEST_IMPLEMENTATION #include <fcfTest/test.hpp> FCF_TEST_DECLARE("Library", "Core", "Test"){ } FCF_TEST_DECLARE("Library", "UI", "Test"){ } FCF_TEST_DECLARE("Library", "Integration", "Test"){ } // "Core" tests will run before "UI" tests FCF_TEST_GROUP_ORDER("Core", 1); FCF_TEST_GROUP_ORDER("UI", 2); // "Integration" tests will run after "Core" and "UI" FCF_TEST_GROUP_ORDER("Integration", 10); int main(int a_argc, char* a_argv[]){ bool error; fcf::NTest::cmdRun(a_argc, a_argv, fcf::NTest::CRM_RUN, &error); return error ? 1 : 0; }

Output:

Performing the test: "Library" -> "Core" -> "Test" ... Performing the test: "Library" -> "UI" -> "Test" ... Performing the test: "Library" -> "Integration" -> "Test" ... All tests were completed. Number of tests: 3