From 4f381d04a108198b300609eb8c2175d3fdd1db04 Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Wed, 10 Apr 2019 14:42:17 -0400 Subject: [PATCH] Added some test cases and the build script. --- test/initmain.c | 36 ++++++++++++++++++++++++++++++++++++ test/main.c | 7 +++++++ test/meson.build | 29 +++++++++++++++++++++++++++++ 3 files changed, 72 insertions(+) create mode 100644 test/initmain.c create mode 100644 test/main.c create mode 100644 test/meson.build diff --git a/test/initmain.c b/test/initmain.c new file mode 100644 index 00000000..51b7efc9 --- /dev/null +++ b/test/initmain.c @@ -0,0 +1,36 @@ +// 10 april 2019 +#include "../ui.h" +#include "testing.h" + +Test(Init) +{ +} + +Test(Uninit) +{ +} + +static void queued(void *data) +{ + int *flag = (int *) data; + + *flag = 1; +} + +static void timer(void *n) +{ + int *n = (int *) data; + + // TODO return stop if n == 5, continue otherwise + *n++; +} + +Test(QueueMain) +{ +} + +// TODO Test(QueueMain_DifferentThread) + +Test(Timer) +{ +} diff --git a/test/main.c b/test/main.c new file mode 100644 index 00000000..ed091a21 --- /dev/null +++ b/test/main.c @@ -0,0 +1,7 @@ +// 10 april 2019 +#include "testing.h" + +int main(void) +{ + return testingMain(); +} diff --git a/test/meson.build b/test/meson.build new file mode 100644 index 00000000..5c15220a --- /dev/null +++ b/test/meson.build @@ -0,0 +1,29 @@ +# 23 march 2019 + +libui_test_sources = [ + 'initmain.c', + 'testing.c', +] + +if libui_OS == 'windows' + libui_test_manifest = 'test.manifest' + if libui_mode == 'static' + libui_test_manifest = 'test.static.manifest' + endif + libui_test_sources += [ + windows.compile_resources('resources.rc', + args: libui_manifest_args, + depend_files: [libui_test_manifest]), + ] +endif + +# TODO once we upgrade to 0.49.0, add pie: true +# TODO once we upgrade to 0.50.0, add protocol: 'exitcode' +libui_tester = executable('tester', libui_test_sources, + dependencies: libui_binary_deps, + link_with: libui_libui, + gui_app: false, + install: false) +test('test', libui_tester, + is_parallel: false, + should_fail: false)