partOrder from class fcf::NTest::Test
Type:
Class:
Package: fcfTest
File: test.hpp
Available from version: 1.2.1
Sets the execution priority for a specific part.
The
By assigning an integer value to a part, you can control its position in the execution queue. Lower values are executed earlier.
Example: Controlling Part Execution Order
Demonstrating how to use
#define FCF_TEST_IMPLEMENTATION
#include <fcfTest/test.hpp>
// A test in the 'Critical' part
FCF_TEST_DEFINE ("Critical", "Core", "StartupTest") {
const fcf::NTest::Test & test = fcf::NTest::state ().test ();
fcf::NTest::log () << "Part order: '" << test.partOrder << std::endl;
FCF_TEST (true);
}
// A test in the 'General' part
FCF_TEST_DEFINE ("General", "Core", "UtilityTest") {
const fcf::NTest::Test & test = fcf::NTest::state ().test ();
fcf::NTest::log () << "Part order: '" << test.partOrder << std::endl;
FCF_TEST (true);
}
// Register execution order: 'Critical' (1) runs before 'General' (2)
FCF_TEST_PART_ORDER ("Critical", 1);
FCF_TEST_PART_ORDER ("General", 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: "Critical" -> "Core" -> "StartupTest" ...
> Part order: '1
[SUCCESS] Test completed successfully (0.000`006`302 sec)
Performing the test: "General" -> "Core" -> "UtilityTest" ...
> Part order: '2
[SUCCESS] Test completed successfully (0.000`001`889 sec)
[SUCCESS] All tests were completed.
Tests: 2 passed, 0 failed, 0 skipped, 2 total
Duration: 0.000`008`191 sec
VPSDime is an industry leading VPS hosting company that provides virtualized server services with high performance, availability and friendly support.