summaryrefslogtreecommitdiff
path: root/src/test.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/test.cpp')
-rw-r--r--src/test.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/test.cpp b/src/test.cpp
index ac14377..77e4ada 100644
--- a/src/test.cpp
+++ b/src/test.cpp
@@ -83,6 +83,17 @@ int main()
assert(te_manager.execute_expired_events() == 1);
assert(te_manager.get_timeout() == utils::no_timeout);
+ // Test canceling events
+ te_manager.add_event(TimedEvent(std::chrono::steady_clock::now() + 100ms, [](){ }, "un"));
+ te_manager.add_event(TimedEvent(std::chrono::steady_clock::now() + 200ms, [](){ }, "deux"));
+ te_manager.add_event(TimedEvent(std::chrono::steady_clock::now() + 300ms, [](){ }, "deux"));
+ assert(te_manager.get_timeout() > 0ms);
+ assert(te_manager.size() == 3);
+ assert(te_manager.cancel("un") == 1);
+ assert(te_manager.size() == 2);
+ assert(te_manager.cancel("deux") == 2);
+ assert(te_manager.get_timeout() == utils::no_timeout);
+
/**
* Encoding
*/