Exemple #1
0
#include <iostream>
#include <chrono>
#include <thread>

using namespace std;
using namespace std::chrono;
using namespace testlib;

#define SUITE(name) "TimeoutStopWatchTests - " name

TEST_CASE(SUITE("TimeoutCorrectlyNotExpired"))
{
	//create a timeout of 1 millisecond
	Timeout to(milliseconds(1000));

	//check that the timeout starts out unexpired
	REQUIRE(to.IsExpired() ==  false);
	REQUIRE(to.Remaining() > milliseconds(1));
}

TEST_CASE(SUITE("StopWatchBasicTest"))
{
	StopWatch sw;

	REQUIRE(sw.Elapsed(false) <= milliseconds(100));
}