Add extra time checks.
This commit is contained in:
@@ -111,6 +111,17 @@ static void test_timeUpdate(void **state) {
|
|||||||
assert_float_equal(TIME.dynamicTime, TIME_STEP + 0.104f, 0.0001f);
|
assert_float_equal(TIME.dynamicTime, TIME_STEP + 0.104f, 0.0001f);
|
||||||
assert_float_equal(TIME.delta, TIME_STEP, 0.0001f);
|
assert_float_equal(TIME.delta, TIME_STEP, 0.0001f);
|
||||||
assert_float_equal(TIME.time, TIME_STEP * 5, 0.0001f);
|
assert_float_equal(TIME.time, TIME_STEP * 5, 0.0001f);
|
||||||
|
|
||||||
|
// Time can stand still if needed
|
||||||
|
SDL_GETTICKS_CALLED = false;
|
||||||
|
SDL_GETTICKS_TICKS = 104; // No time elapsed
|
||||||
|
timeUpdate();
|
||||||
|
assert_true(SDL_GETTICKS_CALLED);
|
||||||
|
|
||||||
|
// Time cannot go backwards
|
||||||
|
SDL_GETTICKS_TICKS = 90;
|
||||||
|
SDL_GETTICKS_CALLED = false;
|
||||||
|
expect_assert_failure(timeUpdate());
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
|
|||||||
Reference in New Issue
Block a user