- Added comprehensive unit tests for audio functionalities, including playback control, volume adjustments, and source management. - Implemented new tests for data handling, focusing on ByteData and DataView functionalities, ensuring proper memory management and error handling. - Updated CMakeLists to include new test files for improved coverage and organization. - Enhanced event handling tests to verify message processing and variant functionalities.
33 lines
765 B
C++
33 lines
765 B
C++
#include "zeroerr/assert.h"
|
|
#include "zeroerr/unittest.h"
|
|
|
|
#include "timer/Timer.h"
|
|
|
|
#include <chrono>
|
|
#include <thread>
|
|
|
|
TEST_CASE("timer.getTime.monotonic") {
|
|
auto* t = eve::timer::Timer::create();
|
|
float t0 = t->getTime();
|
|
float t1 = t->getTime();
|
|
CHECK(t1 >= t0);
|
|
}
|
|
|
|
TEST_CASE("timer.step.deltaNonNegative") {
|
|
auto* t = eve::timer::Timer::create();
|
|
t->step();
|
|
CHECK(t->getDelta() >= 0.f);
|
|
float d = t->step();
|
|
CHECK(d >= 0.f);
|
|
CHECK(t->getDelta() == d);
|
|
}
|
|
|
|
TEST_CASE("timer.step.deltaPositiveAfterSleep") {
|
|
auto* t = eve::timer::Timer::create();
|
|
t->step();
|
|
std::this_thread::sleep_for(std::chrono::milliseconds(15));
|
|
float delta = t->step();
|
|
CHECK(delta > 0.f);
|
|
CHECK(t->getDelta() == delta);
|
|
}
|