count() method from fcf::NTest::TimeDuration class
Class:
Package: fcfTest
File: test.hpp
Available from version: 1.2.5
Returns the raw duration value in nanoseconds.
The unsigned long long value representing the duration in nanoseconds.
Result
- The duration in nanoseconds.
Example: Accessing raw nanoseconds
Demonstrating how to retrieve the raw nanosecond count.
#define FCF_TEST_IMPLEMENTATION
#include <fcfTest/test.hpp>
#include <iostream>
FCF_TEST_DEFINE ("TimeDemo", "Basics", "CountAccess") {
fcf::NTest::TimeDuration duration(123456789ULL);
// 1. Retrieve the raw count
unsigned long long rawCount = duration.count ();
// 2. Verify the value
FCF_TEST (rawCount == 123456789ULL, rawCount);
std::cout << "Raw count: " << rawCount << std::endl;
}
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" -> "CountAccess" ...
Raw count: 123456789
[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
VPSDime is an industry leading VPS hosting company that provides virtualized server services with high performance, availability and friendly support.