diff options
author | Carbenium <carbenium@outlook.com> | 2020-07-25 16:51:58 +0200 |
---|---|---|
committer | Peter Keresztes Schmidt <carbenium@outlook.com> | 2020-07-26 23:20:11 +0200 |
commit | e877f988d1c4e1361612f3d5c4ebe915f746aee5 (patch) | |
tree | 48f2cd4152dff36666fdae063d9dad6d091665fd | |
parent | 8cb35b0d5f1462387033e6bd2f99d0ea829fdcd8 (diff) |
tests/EventMap: Test for event past it's execution time
With the switch to std::chrono return type of GetTimeUntilEvent
we don't run into an overflow condition which happend with the previous
uint32 return value if the events scheduled execution time is in the past.
Test for this case.
-rw-r--r-- | tests/common/test-EventMap.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/common/test-EventMap.cpp b/tests/common/test-EventMap.cpp index 563fd9b4873..89d3c4d2bb2 100644 --- a/tests/common/test-EventMap.cpp +++ b/tests/common/test-EventMap.cpp @@ -66,6 +66,13 @@ TEST_CASE("Schedule an event", "[EventMap]") REQUIRE(eventMap.Empty()); REQUIRE(eventMap.GetTimeUntilEvent(EVENT_1) == Milliseconds::max()); } + + SECTION("Event is past it's execution time") + { + eventMap.Update(2000); + + REQUIRE(eventMap.GetTimeUntilEvent(EVENT_1) == -1s); + } } // TODO: The semantics of this case are not well defined. |