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

operator!() method from fcf::NTest::TimeDuration class

bool operator!() const

Class: fcf::NTest::TimeDuration

Package: fcfTest

File: test.hpp

Available from version: 1.2.5

Checks if the duration is zero.

The operator! method provides a logical NOT operation. It returns true if the duration is exactly zero, and false otherwise.

Result
bool
- True if the duration is zero, false otherwise.

Example: Logical NOT check

Demonstrating the logical NOT operator.

#define FCF_TEST_IMPLEMENTATION #include <fcfTest/test.hpp> FCF_TEST_DEFINE("TimeDemo", "Basics", "LogicalNot") { fcf::NTest::TimeDuration zero(0ULL); fcf::NTest::TimeDuration nonZero(100ULL); // 1. Check zero duration FCF_TEST(!zero, true); // 2. Check non-zero duration FCF_TEST(!nonZero, false); } 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: "TimeDemo" -> "Basics" -> "LogicalNot" ... [SUCCESS] Test completed successfully (0.000`000`000 sec) [SUCCESS] All tests were completed. Tests: 1 passed, 0 failed, 0 skipped, 1 total Duration: 0.000`000`000 sec