appendTest() method from fcf::NTest::Storage class
Class:
Package: fcfTest
File: test.hpp
Available from version: 1.2.2
Registers a new test case into the global storage.
The
This method is typically called automatically by the
Arguments
- The fcf::NTest::Test object containing metadata and the function pointer to execute.
Example: Manual Test Registration
Demonstrating how to register a test case manually without using the standard macros.
#define FCF_TEST_IMPLEMENTATION
#include <fcfTest/test.hpp>
#include <iostream>
void myManualTest() {
FCF_TEST (1 + 1 == 2);
}
int main(int a_argc, char* a_argv[]) {
bool error = false;
fcf::NTest::Storage & storage = fcf::NTest::storage ();
// 1. Create a Test object manually
fcf::NTest::Test manualTest = {"ManualPart", 0, "ManualGroup", 0, "ManualTest", 0, myManualTest};
// 2. Append it to storage
storage.appendTest (manualTest);
// 3. Run the tests
fcf::NTest::cmdRun (a_argc, a_argv, fcf::NTest::CRM_RUN , &error);
return error ? 1 : 0;
}
Output:
Performing the test: "ManualPart" -> "ManualGroup" -> "ManualTest" ...
[SUCCESS] Test completed successfully (0.000`001`083 sec)
[SUCCESS] All tests were completed.
Tests: 1 passed, 0 failed, 0 skipped, 1 total
Duration: 0.000`001`083 sec
VPSDime is an industry leading VPS hosting company that provides virtualized server services with high performance, availability and friendly support.