mirror of
https://github.com/dalathegreat/Battery-Emulator.git
synced 2025-10-03 01:39:30 +02:00
Some cleanup before more surgery
This commit is contained in:
parent
6bc253ff6e
commit
32378df03e
5 changed files with 17 additions and 13 deletions
|
@ -1,5 +1,5 @@
|
|||
// The test library must be included first!
|
||||
#include "test_lib.h"
|
||||
#include "../test_lib.h"
|
||||
|
||||
#include "events.cpp"
|
||||
|
||||
|
@ -16,35 +16,35 @@ TEST(init_events_test) {
|
|||
}
|
||||
}
|
||||
|
||||
TEST(update_event_timestamps_test) {
|
||||
TEST(update_event_time_test) {
|
||||
// Reset
|
||||
init_events();
|
||||
time_seconds = 0;
|
||||
|
||||
// No delta, so time shouldn't increase
|
||||
testlib_millis = 0;
|
||||
update_event_timestamps();
|
||||
update_event_time();
|
||||
ASSERT_EQ(time_seconds, 0);
|
||||
|
||||
// Almost time to bump the seconds
|
||||
testlib_millis = 999;
|
||||
update_event_timestamps();
|
||||
update_event_time();
|
||||
ASSERT_EQ(time_seconds, 0);
|
||||
ASSERT_EQ(previous_millis, 0);
|
||||
|
||||
// millis == 1000, so we should add a second
|
||||
testlib_millis = 1000;
|
||||
update_event_timestamps();
|
||||
update_event_time();
|
||||
ASSERT_EQ(time_seconds, 1);
|
||||
ASSERT_EQ(previous_millis, 1000);
|
||||
|
||||
// We shouldn't add more seconds until 2000 now
|
||||
testlib_millis = 1999;
|
||||
update_event_timestamps();
|
||||
update_event_time();
|
||||
ASSERT_EQ(time_seconds, 1);
|
||||
ASSERT_EQ(previous_millis, 1000);
|
||||
testlib_millis = 2000;
|
||||
update_event_timestamps();
|
||||
update_event_time();
|
||||
ASSERT_EQ(time_seconds, 2);
|
||||
ASSERT_EQ(previous_millis, 2000);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue