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*(fcf::NTest::TimeDuration a_rhs)
void operator*(Ty a_value)

Class: fcf::NTest::TimeDuration

Package: fcfTest

File: test.hpp

Available from version: 1.2.5

Multiplies the current duration by a duration or an arithmetic value.

The operator* allows for scaling a fcf::NTest::TimeDuration object by another duration or a numeric value (treated as nanoseconds).

Arguments

fcf::NTest::TimeDuration a_rhs
- The duration to multiply by.
Result
fcf::NTest::TimeDuration
- A new TimeDuration object representing the product.

Example: Multiplication usage

Demonstrating multiplication with both TimeDuration and raw numeric types.

#define FCF_TEST_IMPLEMENTATION #include <fcfTest/test.hpp> #include <iostream> FCF_TEST_DEFINE("TimeDemo", "Basics", "Multiplication") { fcf::NTest::TimeDuration d1(1000000000ULL); // 1. Multiply by TimeDuration fcf::NTest::TimeDuration res1 = d1 * fcf::NTest::TimeDuration(2ULL); // 2. Multiply by arithmetic type fcf::NTest::TimeDuration res2 = d1 * 3ULL; FCF_TEST(res1.count() == 2000000000ULL, res1.count()); FCF_TEST(res2.count() == 3000000000ULL, res2.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" -> "Multiplication" ... [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