reset() method from fcf::NTest::DurationBasic class
Class:
Package: fcfTest
File: test.hpp
Available from version: 1.2.5
Resets measurements for a specific range of levels.
The
If the
Arguments
- The starting level index to reset.
- The ending level index. If -1, all levels are reset.
Example: Resetting Measurements
Clearing data to start a new measurement phase.
#define FCF_TEST_IMPLEMENTATION
#include <fcfTest/test.hpp>
#include <thread>
#include <chrono>
FCF_TEST_DEFINE ("Bench", "Reset", "ResetTest") {
fcf::NTest::Duration bench(10);
bench.begin ();
std::this_thread::sleep_for(std::chrono::seconds(1));
bench.end ();
bench.begin ();
std::this_thread::sleep_for(std::chrono::seconds(1));
bench.end ();
fcf::NTest::log () << "Current duration: " << bench.duration() << std::endl;
bench.reset (0, -1);
bench.begin ();
std::this_thread::sleep_for(std::chrono::seconds(1));
bench.end ();
fcf::NTest::log () << "Current duration after reset: " << bench.duration() << 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: "Bench" -> "Reset" -> "ResetTest" ...
> Current duration: 2.000261047
> Current duration after reset: 1.000076972
[SUCCESS] Test completed successfully (3.000`451`152 sec)
[SUCCESS] All tests were completed.
Tests: 1 passed, 0 failed, 0 skipped, 1 total
Duration: 3.000`451`152 sec
VPSDime is an industry leading VPS hosting company that provides virtualized server services with high performance, availability and friendly support.