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

LMC_TEST_GROUP from enum fcf::NTest::ELogMessageCategory

Value: fcf::NTest::LMC_TEST_GROUP = 0x00040000

Enum: fcf::NTest::ELogMessageCategory

Package: fcfTest

File: test.hpp

Available from version: 1.1.14

The category for messages directly related to test results, including success notifications, failure reports, and detailed error descriptions.

The fcf::NTest::LMC_TEST_GROUP category is used to classify messages that report the outcome of a test execution. Unlike the launch category which tracks the lifecycle, this group focuses on the result of the test logic itself.

This group includes critical diagnostic information such as:

  • LMC_TEST_COMPLETE: Signals that a test case has passed successfully.
  • LMC_TEST_ERROR: Signals that a test case has failed.
  • LMC_TEST_ERROR_MESSAGE: Provides the detailed error description, including the failing expression and variable values.

Example: Filtering Test Results

Demonstrates how to apply a specific prefix that only appears when a test fails or succeeds, helping to highlight the test outcomes in a busy log.

#define FCF_TEST_IMPLEMENTATION #include <fcfTest/test.hpp> #include <iostream> FCF_TEST_DECLARE("ResultDemo", "Outcome", "StatusCheck") { // 1. Access the global logger fcf::NTest::Logger& logger = fcf::NTest::logger(); // 2. Clear existing prefixes for a clean demonstration logger.clearPrefixes(true); // 3. Add a custom prefix that ONLY applies to the TEST_GROUP category // This will highlight the [SUCCESS] or [FAILED] lines. fcf::NTest::Logger::Prefix prefix; prefix.name = "outcome-marker"; prefix.multiLine = false; prefix.category = fcf::NTest::LMC_TEST_GROUP; prefix.prefix = "<< RESULT >> "; logger.appendPrefix(prefix); // 4. Perform a failing assertion // The framework will log LMC_TEST_ERROR and LMC_TEST_ERROR_MESSAGE, also triggering our prefix FCF_TEST(1 + 1 == 3, 1 + 1); } 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: "ResultDemo" -> "Outcome" -> "StatusCheck" ... << RESULT >> Test error: 1 + 1 == 3 [FILE: PATH/main.cpp:26] Values: 1 + 1: 2 << RESULT >> [FAILED] Test failed (0.000`048`081 sec) [FAILED] Testing completed with failures. Tests: 0 passed, 1 failed, 0 skipped, 1 total Duration: 0.000`048`081 sec