Files
AVA2/tests/server_clock_test.cpp

15 lines
671 B
C++

#include "server_clock.h"
#include <stdexcept>
int main() {
ava2::ServerClock clock(100);
if(clock.milliseconds(150)!=50) throw std::runtime_error("initial elapsed time");
clock.set(1700000000,1000,2000);
if(clock.milliseconds(2500)!=1700001500 || clock.timestamp(2001)!=1700000001)
throw std::runtime_error("AVA2 millisecond/second distinction");
clock.set(1700000000,0xfffffff0U,2000);
if(clock.milliseconds(20)!=1700000036) throw std::runtime_error("DWORD timer wrap");
clock.set(0x7fffffff,100,2000);
if(clock.milliseconds(101)!=static_cast<std::int32_t>(0x80000000U))
throw std::runtime_error("Win32 time_t width");
}