#include <sysio/vm/watchdog.hpp>
#include <atomic>
#include <chrono>
#include <catch2/catch.hpp>
Go to the source code of this file.
|
| TEST_CASE ("watchdog interrupt", "[watchdog_interrupt]") |
|
| TEST_CASE ("watchdog no interrupt", "[watchdog_no_interrupt]") |
|
◆ TEST_CASE() [1/2]
TEST_CASE |
( |
"watchdog interrupt" | , |
|
|
"" | [watchdog_interrupt] ) |
Definition at line 9 of file watchdog_tests.cpp.
9 {
10 std::atomic<bool> okay = false;
11 watchdog w{std::chrono::milliseconds(50)};
12 {
13 auto g = w.scoped_run([&]() { okay = true; });
14 std::this_thread::sleep_for(std::chrono::milliseconds(100));
15 }
17}
Triggers a callback after a given time elapses.
◆ TEST_CASE() [2/2]
TEST_CASE |
( |
"watchdog no interrupt" | , |
|
|
"" | [watchdog_no_interrupt] ) |
Definition at line 19 of file watchdog_tests.cpp.
19 {
20 std::atomic<bool> okay = true;
21 watchdog w{std::chrono::milliseconds(50)};
22 {
23 auto g = w.scoped_run([&]() { okay = false; });
24 }
25 std::this_thread::sleep_for(std::chrono::milliseconds(100));
27}