diff options
| author | J08nY | 2018-01-18 22:07:34 +0100 |
|---|---|---|
| committer | J08nY | 2018-01-18 23:38:40 +0100 |
| commit | 77a4a7c2af7aad72e699018fcda8e4cb52d377e6 (patch) | |
| tree | 8755e6b3d1c0e856252dfc8fe37b1c727606a812 /test/src/util/test_timeout.c | |
| parent | b03007db7612a6d9ab70cd0e698de565a9687ddf (diff) | |
| download | ecgen-77a4a7c2af7aad72e699018fcda8e4cb52d377e6.tar.gz ecgen-77a4a7c2af7aad72e699018fcda8e4cb52d377e6.tar.zst ecgen-77a4a7c2af7aad72e699018fcda8e4cb52d377e6.zip | |
Add some more basic tests for coverage.
Diffstat (limited to 'test/src/util/test_timeout.c')
| -rw-r--r-- | test/src/util/test_timeout.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/test/src/util/test_timeout.c b/test/src/util/test_timeout.c new file mode 100644 index 0000000..307c3a8 --- /dev/null +++ b/test/src/util/test_timeout.c @@ -0,0 +1,36 @@ +/* + * ecgen, tool for generating Elliptic curve domain parameters + * Copyright (C) 2017 J08nY + */ + +#include <criterion/criterion.h> +#include "util/timeout.h" +#include "test/default.h" + +void timeout_setup(void) { + default_setup(); + timeout_init(); +} + +TestSuite(timeout, .init = timeout_setup, .fini = default_teardown); + +Test(timeout, test_timeout_stop) { + bool done = false; + timeout_start(5) { + cr_assert_fail(); + } else { + done = true; + } + timeout_stop(); + cr_assert(done, ); +} + +Test(timeout, test_timeout_handle) { + bool done = false; + timeout_start(1) { + done = true; + } else { + sleep(2); + } + cr_assert(done, ); +}
\ No newline at end of file |
