summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/command_line_args.c31
-rw-r--r--tests/meson.build15
-rw-r--r--tests/timer_loop.c1
-rw-r--r--tests/timer_thread.c2
4 files changed, 43 insertions, 6 deletions
diff --git a/tests/command_line_args.c b/tests/command_line_args.c
new file mode 100644
index 0000000..cda9328
--- /dev/null
+++ b/tests/command_line_args.c
@@ -0,0 +1,31 @@
+#ifndef _UNICODE
+#define _UNICODE
+#endif
+#ifndef UNICODE
+#define UNICODE
+#endif
+#include <al/types.h>
+#include <al/str.h>
+#include <al/wstr.h>
+#include <nnwt/common.h>
+
+#ifdef NAUNET_ON_WINDOWS
+s32 wmain(s32 argc, wchar_t **argv)
+#else
+s32 main(s32 argc, char *argv[])
+#endif
+{
+ if (!nn_common_init(NULL)) {
+ return EXIT_FAILURE;
+ }
+
+ for (s32 i = 0; i < argc; i++) {
+#ifdef NAUNET_ON_WINDOWS
+ al_printf("%d: %ls %zu\n", i, argv[i], al_wcsnlen(argv[i], MAX_ALLOC_32 / sizeof(wchar_t)));
+#else
+ al_printf("%d: %.*s %zu\n", i, al_str_x(&al_str_cr(argv[i])), al_strlen(argv[i]));
+#endif
+ }
+
+ return EXIT_SUCCESS;
+}
diff --git a/tests/meson.build b/tests/meson.build
index 0482bec..0ff6ffb 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -1,9 +1,12 @@
-executable('timer_thread', ['timer_thread.c'], dependencies: naunet)
-executable('timer_loop', ['timer_loop.c'], dependencies: naunet)
-executable('loop_sleep', ['loop_sleep.c'], dependencies: naunet)
executable('misc_file', ['misc_file.c'], dependencies: naunet)
executable('condition_variable', ['condition_variable.c'], dependencies: naunet)
-if not is_windows
- executable('stdin_lines', ['stdin_lines.c'], dependencies: naunet)
- executable('fs_event', ['fs_event_local.c'], dependencies: naunet)
+executable('timer_thread', ['timer_thread.c'], dependencies: naunet)
+if get_option('event-loop').enabled()
+ executable('timer_loop', ['timer_loop.c'], dependencies: naunet)
+ executable('loop_sleep', ['loop_sleep.c'], dependencies: naunet)
+ if not is_windows
+ executable('stdin_lines', ['stdin_lines.c'], dependencies: naunet)
+ executable('fs_event', ['fs_event_local.c'], dependencies: naunet)
+ endif
endif
+executable('cmd_args', ['command_line_args.c'], dependencies: naunet, link_args: is_windows ? ['-mwindows', '-municode'] : [])
diff --git a/tests/timer_loop.c b/tests/timer_loop.c
index 1df6863..77ea956 100644
--- a/tests/timer_loop.c
+++ b/tests/timer_loop.c
@@ -1,6 +1,7 @@
#include <nnwt/common.h>
#include <nnwt/thread.h>
#include <nnwt/timer.h>
+#include <nnwt/time.h>
#define DELAY 100000
#define REPEAT 21
diff --git a/tests/timer_thread.c b/tests/timer_thread.c
index 8ffbbc2..26a638b 100644
--- a/tests/timer_thread.c
+++ b/tests/timer_thread.c
@@ -1,5 +1,7 @@
+#include <al/lib.h>
#include <nnwt/common.h>
#include <nnwt/thread.h>
+#include <nnwt/time.h>
#define DELAY 100000
#define REPEAT 21