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

FCF_TEST_TEST_ORDER macro

FCF_TEST_TEST_ORDER (const char* am_part, int am_order)

Package: fcfTest

File: test.hpp

Available from version: 1.0.1

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

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

The test runner sorts all registered test based on the provided am_order value.

Arguments

const char* am_test
- The exact string name of the test part 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", "Base", "Mathematical functions"){ } FCF_TEST_DECLARE("Library", "Base", "Algorithm (sort)"){ } FCF_TEST_DECLARE("Library", "Base", "Algorithm (analysis)"){ } FCF_TEST_TEST_ORDER("Mathematical functions", 1); FCF_TEST_TEST_ORDER("Algorithm (sort)", 2); FCF_TEST_TEST_ORDER("Algorithm (analysis)", 3); 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" -> "Base" -> "Mathematical functions" ... Performing the test: "Library" -> "Base" -> "Algorithm (sort)" ... Performing the test: "Library" -> "Base" -> "Algorithm (analysis)" ... All tests were completed. Number of tests: 3