summaryrefslogtreecommitdiff
path: root/source/test/unittests
diff options
context:
space:
mode:
authorMitya Selivanov <0x7fffff@guattari.ru>2022-08-08 02:50:03 +0400
committerMitya Selivanov <0x7fffff@guattari.ru>2022-08-08 02:50:03 +0400
commitcd1e69e13d8dc1df57b5f371edc3f23ceb9bafc1 (patch)
tree89f5a8af881ad026b2fa3a5c5e5774dc4c7bf17f /source/test/unittests
parentccf5e49b969c7643cd67ac678a7f13f4639db745 (diff)
downloadkit-cd1e69e13d8dc1df57b5f371edc3f23ceb9bafc1.zip
Add tests
Diffstat (limited to 'source/test/unittests')
-rw-r--r--source/test/unittests/CMakeLists.txt4
-rw-r--r--source/test/unittests/test_duration.test.c18
2 files changed, 20 insertions, 2 deletions
diff --git a/source/test/unittests/CMakeLists.txt b/source/test/unittests/CMakeLists.txt
index 37f7dbb..674f442 100644
--- a/source/test/unittests/CMakeLists.txt
+++ b/source/test/unittests/CMakeLists.txt
@@ -1,6 +1,6 @@
target_sources(
${KIT_TEST_SUITE}
PRIVATE
- async_function.test.c main.test.c string_ref.test.c
- array_ref.test.c input_stream.test.c lower_bound.test.c
+ async_function.test.c test_duration.test.c main.test.c
+ string_ref.test.c array_ref.test.c input_stream.test.c lower_bound.test.c
input_buffer.test.c dynamic_array.test.c)
diff --git a/source/test/unittests/test_duration.test.c b/source/test/unittests/test_duration.test.c
new file mode 100644
index 0000000..6de6c2e
--- /dev/null
+++ b/source/test/unittests/test_duration.test.c
@@ -0,0 +1,18 @@
+#define KIT_TEST_FILE test_duration
+#include "../../kit_test/test.h"
+
+#ifdef _WIN32
+# include <synchapi.h>
+static void kit_sleep(int ms) {
+ Sleep(ms);
+}
+#else
+# include <unistd.h>
+static void kit_sleep(int ms) {
+ usleep(ms * 1000);
+}
+#endif
+
+TEST("test duration") {
+ kit_sleep(100);
+}