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

FCF_TEST_ORDER_DEFAULT macro

FCF_TEST_ORDER_DEFAULT

Package: fcfTest

File: test.hpp

Available from version: 1.2.2

value = 1000000. Defines the default execution priority for a test part. Lower integer values indicate higher priority (run earlier).

The FCF_TEST_ORDER_DEFAULT macro is a constant used to define the default priority level for tests, groups, or parts when no specific order is provided via FCF_TEST_PART_ORDER, FCF_TEST_GROUP_ORDER, or FCF_TEST_TEST_ORDER.

By default, all elements are assigned this value, and the test runner falls back to alphabetical sorting within the same priority level.

Example:

#define FCF_TEST_IMPLEMENTATION #include <fcfTest/test.hpp> // This test belongs to the "System" part FCF_TEST_DEFINE("System", "Init", "StartupTest") { // Test logic } // This test belongs to the "User" part FCF_TEST_DEFINE("User", "Auth", "LoginTest") { // Test logic } // By default, both tests use FCF_TEST_ORDER_DEFAULT (1000000). // Since they have different part names, they will be sorted alphabetically: // "System" will run before "User". // However, we can explicitly set the priority using the order macros. // Here we ensure "User" part runs before "System" part by assigning a lower value. FCF_TEST_PART_ORDER("User", 1); FCF_TEST_PART_ORDER("System", 2); int main(int a_argc, char* a_argv[]) { bool error = false; fcf::NTest::cmdRun(a_argc, a_argv, fcf::NTest::CRM_RUN, &error); return error ? 1 : 0; }

Output:

Performing the test: "User" -> "Auth" -> "LoginTest" ... [SUCCESS] Test completed successfully (0.000`000`123 sec) Performing the test: "System" -> "Init" -> "StartupTest" ... [SUCCESS] Test completed successfully (0.000`000`098 sec) [SUCCESS] All tests were completed. Tests: 2 passed, 0 failed, 0 skipped, 2 total Duration: 0.000`000`221 sec