Added some test cases and the build script.

This commit is contained in:
Pietro Gagliardi 2019-04-10 14:42:17 -04:00
parent 759d6d1e46
commit 4f381d04a1
3 changed files with 72 additions and 0 deletions

36
test/initmain.c Normal file
View File

@ -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)
{
}

7
test/main.c Normal file
View File

@ -0,0 +1,7 @@
// 10 april 2019
#include "testing.h"
int main(void)
{
return testingMain();
}

29
test/meson.build Normal file
View File

@ -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)