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

part from class fcf::NTest::TestPath

Property: part

Type: std::string

Class: fcf::NTest::TestPath

Package: fcfTest

File: test.hpp

Available from version: 1.2.4

The name of the top-level logical grouping (Part) in the test hierarchy.

Example: Manual TestPath Construction

Demonstrating how to manually set the part property to define a test's location in the hierarchy.

#define FCF_TEST_IMPLEMENTATION #include <fcfTest/test.hpp> FCF_TEST_BEFORE_DEFINE("*", "*", "*", fcf::NTest::FL_GLOBAL) { // Initialize the path object to the desired test fcf::NTest::TestPath path; path.part = "Core"; path.group = "Math"; path.test = "AdditionTest"; // Add multiple test parameters fcf::NTest::storage().appendParamValue(path, (std::string)"one"); fcf::NTest::storage().appendParamValue(path, (std::string)"two"); fcf::NTest::storage().appendParamValue(path, (std::string)"three"); } FCF_TEST_DEFINE("Core", "Math", "AdditionTest") { // Get the value of the test parameter std::string paramValue = *fcf::NTest::state().param().cast<std::string>(); fcf::NTest::log() << "Param value: " << paramValue << std::endl; FCF_TEST(true); } 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: "Core" -> "Math" -> "AdditionTest" ... == Parameter set: 1 > Param value: one == Parameter set: 2 > Param value: two == Parameter set: 3 > Param value: three [SUCCESS] Test completed successfully (0.000`014`731 sec) [SUCCESS] All tests were completed. Tests: 1 passed, 0 failed, 0 skipped, 1 total Duration: 0.000`014`731 sec