diff options
author | WBoerenkamps <wrj.boerenkamps@student.avans.nl> | 2024-11-24 22:08:49 +0100 |
---|---|---|
committer | WBoerenkamps <wrj.boerenkamps@student.avans.nl> | 2024-11-24 22:08:49 +0100 |
commit | 6287d4e9068d8bd27a9e62643f54adb69e84befd (patch) | |
tree | 2e94d4cda12cd6b0b3b9c33312156000120eb633 /src/test/loopTimerTest.cpp | |
parent | 6c2fc3716c9c6c68e982b243af5f7ed04fb35e86 (diff) |
input facade
Diffstat (limited to 'src/test/loopTimerTest.cpp')
-rw-r--r-- | src/test/loopTimerTest.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/test/loopTimerTest.cpp b/src/test/loopTimerTest.cpp new file mode 100644 index 0000000..a3b1646 --- /dev/null +++ b/src/test/loopTimerTest.cpp @@ -0,0 +1,32 @@ +#define private public +#define protected public +#include "api/LoopManager.h" +#include "api/LoopTimer.h" +#include <gmock/gmock.h> +#include <gtest/gtest.h> + +using namespace std; +using namespace std::chrono_literals; +using namespace crepe; + +class LoopTimerTest : public ::testing::Test { +public: +LoopTimer loop_timer = LoopTimer::get_instance(); +protected: + void SetUp() override { + loop_timer.start(); + } + + void TearDown() override { + + } +}; +TEST_F(LoopTimerTest, TestDeltaTime) { + auto start_time = std::chrono::steady_clock::now(); + + loop_timer.update(); + double delta_time = loop_timer.get_delta_time(); + + auto elapsed_time = std::chrono::steady_clock::now() - start_time; + EXPECT_LE(delta_time, std::chrono::duration<double>(elapsed_time).count()); +} |