feat: enhance audio and data handling with new test cases

- 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.
This commit is contained in:
西风逍遥游 committed 2026-08-05 17:51:48 +08:00
1 parent dd3541750f
commit e21dbcf1ea
13 files changed
+1563 -84

No files matched your search

+32
View File
@@ -0,0 +1,32 @@
#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);
}