test from class fcf::NTest::Test
Property: test
Type:
Class:
Package: fcfTest
File: test.hpp
Available from version: 1.2.2
The unique identifier/name of the test case.
The
The name is used in:
- Filtering specific tests via the
cmdRun command line interface. - Identifying tests in the console output and JUnit reports.
- Defining specific execution orders for individual tests.
Example: Defining a Named Test Case
Demonstrating how to provide a unique name for a test using the
#define FCF_TEST_IMPLEMENTATION
#include <fcfTest/test.hpp>
// The third argument is the unique test name
FCF_TEST_DEFINE ("Math", "Basic", "AdditionTest") {
const fcf::NTest::Test & test = fcf::NTest::state ().test ();
fcf::NTest::log () << "Testing addition (Test name: '" << test.test << "')..." << std::endl;
FCF_TEST (1 + 1 == 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: "Math" -> "Basic" -> "AdditionTest" ...
> Testing addition (Test name: 'AdditionTest')...
[SUCCESS] Test completed successfully (0.000`005`156 sec)
[SUCCESS] All tests were completed.
Tests: 1 passed, 0 failed, 0 skipped, 1 total
Duration: 0.000`005`156 sec
VPSDime is an industry leading VPS hosting company that provides virtualized server services with high performance, availability and friendly support.