part from class fcf::NTest::Test
Property: part
Type:
Class:
Package: fcfTest
File: test.hpp
Available from version: 1.2.1
The name of the logical grouping level (Part) to which the test belongs.
The
This grouping is essential for:
- Filtering tests during execution using the
cmdRun interface. - Defining execution order for entire modules via
partOrder . - Organizing test reports into a clear, hierarchical structure.
Example: Defining a Test within a Part
Demonstrating how to assign a part name to a test case using the
#define FCF_TEST_IMPLEMENTATION
#include <fcfTest/test.hpp>
// Define a test case within the "Math" part
FCF_TEST_DEFINE ("Math", "Arithmetic", "AdditionTest") {
const fcf::NTest::Test & test = fcf::NTest::state ().test ();
fcf::NTest::log () << "Testing addition in the part '" << test.part << "'..." << std::endl;
FCF_TEST (2 + 2 == 4);
}
int main(int a_argc, char* a_argv[]) {
bool error = false;
// The test will be registered under the part "Math"
fcf::NTest::cmdRun (a_argc, a_argv, fcf::NTest::CRM_RUN , &error);
return error ? 1 : 0;
}
Output:
Performing the test: "Math" -> "Arithmetic" -> "AdditionTest" ...
> Testing addition in the part 'Math'...
[SUCCESS] Test completed successfully (0.000`007`568 sec)
[SUCCESS] All tests were completed.
Tests: 1 passed, 0 failed, 0 skipped, 1 total
Duration: 0.000`007`568 sec
VPSDime is an industry leading VPS hosting company that provides virtualized server services with high performance, availability and friendly support.