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

operator-=() method from fcf::NTest::TimeDuration class

fcf::NTest::TimeDuration& operator-=(unsigned long long a_value)
fcf::NTest::TimeDuration& operator-=(const fcf::NTest::TimeDuration& a_rhs)

Class: fcf::NTest::TimeDuration

Package: fcfTest

File: test.hpp

Available from version: 1.2.5

Subtracts a duration or an arithmetic value from the current duration.

The operator-= method performs a subtraction assignment, reducing the current duration by the specified amount.

Arguments

unsigned long long a_value
- The amount to subtract.
Result
fcf::NTest::TimeDuration&
- Reference to the current object.

Example: Subtraction assignment

Demonstrating -= with both raw numeric types and TimeDuration objects.

#define FCF_TEST_IMPLEMENTATION #include <fcfTest/test.hpp> FCF_TEST_DEFINE("TimeDemo", "Basics", "SubAssignment") { fcf::NTest::TimeDuration d(1000ULL); // 1. Subtract raw numeric type d -= 400ULL; FCF_TEST(d.count() == 600ULL, d.count()); // 2. Subtract another TimeDuration fcf::NTest::TimeDuration d2(200ULL); d -= d2; FCF_TEST(d.count() == 400ULL, d.count()); } 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" -> "SubAssignment" ... [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