Fixed the test suite.
This commit is contained in:
parent
4f381d04a1
commit
1b046e763b
11
meson.build
11
meson.build
|
@ -140,15 +140,16 @@ libui_sources = []
|
||||||
libui_deps = []
|
libui_deps = []
|
||||||
libui_soversion = ''
|
libui_soversion = ''
|
||||||
libui_rpath = ''
|
libui_rpath = ''
|
||||||
subdir('common')
|
#subdir('common')
|
||||||
|
libui_sources+=['dummy.c']
|
||||||
if libui_OS == 'windows'
|
if libui_OS == 'windows'
|
||||||
subdir('windows')
|
# subdir('windows')
|
||||||
install_headers('ui_windows.h')
|
install_headers('ui_windows.h')
|
||||||
elif libui_OS == 'darwin'
|
elif libui_OS == 'darwin'
|
||||||
subdir('darwin')
|
# subdir('darwin')
|
||||||
install_headers('ui_darwin.h')
|
install_headers('ui_darwin.h')
|
||||||
else
|
else
|
||||||
subdir('unix')
|
# subdir('unix')
|
||||||
install_headers('ui_unix.h')
|
install_headers('ui_unix.h')
|
||||||
endif
|
endif
|
||||||
libui_libui = library('ui', libui_sources,
|
libui_libui = library('ui', libui_sources,
|
||||||
|
@ -173,4 +174,4 @@ if libui_mode == 'static'
|
||||||
libui_binary_deps = libui_deps
|
libui_binary_deps = libui_deps
|
||||||
endif
|
endif
|
||||||
subdir('test')
|
subdir('test')
|
||||||
subdir('examples')
|
#subdir('examples')
|
||||||
|
|
|
@ -2,11 +2,11 @@
|
||||||
#include "../ui.h"
|
#include "../ui.h"
|
||||||
#include "testing.h"
|
#include "testing.h"
|
||||||
|
|
||||||
Test(Init)
|
testingTest(Init)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
Test(Uninit)
|
testingTest(Uninit)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ static void queued(void *data)
|
||||||
*flag = 1;
|
*flag = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void timer(void *n)
|
static void timer(void *data)
|
||||||
{
|
{
|
||||||
int *n = (int *) data;
|
int *n = (int *) data;
|
||||||
|
|
||||||
|
@ -25,12 +25,12 @@ static void timer(void *n)
|
||||||
*n++;
|
*n++;
|
||||||
}
|
}
|
||||||
|
|
||||||
Test(QueueMain)
|
testingTest(QueueMain)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO Test(QueueMain_DifferentThread)
|
// TODO testingTest(QueueMain_DifferentThread)
|
||||||
|
|
||||||
Test(Timer)
|
testingTest(Timer)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
libui_test_sources = [
|
libui_test_sources = [
|
||||||
'initmain.c',
|
'initmain.c',
|
||||||
|
'main.c',
|
||||||
'testing.c',
|
'testing.c',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ struct testingT {
|
||||||
static testingT *tests = NULL;
|
static testingT *tests = NULL;
|
||||||
static testingT *testsTail = NULL;
|
static testingT *testsTail = NULL;
|
||||||
|
|
||||||
static void testingprivNewTest(const char *name, void (*f)(testingT *), testingT *prev)
|
static testingT *newTest(const char *name, void (*f)(testingT *), testingT *prev)
|
||||||
{
|
{
|
||||||
testingT *t;
|
testingT *t;
|
||||||
|
|
||||||
|
@ -39,7 +39,9 @@ static void testingprivNewTest(const char *name, void (*f)(testingT *), testingT
|
||||||
t->returned = 0;
|
t->returned = 0;
|
||||||
t->defers = NULL;
|
t->defers = NULL;
|
||||||
t->defersRun = 0;
|
t->defersRun = 0;
|
||||||
t->next = testsTail;
|
t->next = NULL;
|
||||||
|
if (prev != NULL)
|
||||||
|
prev->next = t;
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,7 +49,7 @@ void testingprivRegisterTest(const char *name, void (*f)(testingT *))
|
||||||
{
|
{
|
||||||
testingT *t;
|
testingT *t;
|
||||||
|
|
||||||
t = testingprivNewTest(name, f, testsTail);
|
t = newTest(name, f, testsTail);
|
||||||
testsTail = t;
|
testsTail = t;
|
||||||
if (tests == NULL)
|
if (tests == NULL)
|
||||||
tests = t;
|
tests = t;
|
||||||
|
@ -87,7 +89,6 @@ static void runTestSet(testingT *t, int *anyFailed)
|
||||||
|
|
||||||
int testingMain(void)
|
int testingMain(void)
|
||||||
{
|
{
|
||||||
testingT *t;
|
|
||||||
int anyFailed;
|
int anyFailed;
|
||||||
|
|
||||||
// TODO see if this should run if all tests are skipped
|
// TODO see if this should run if all tests are skipped
|
||||||
|
@ -119,7 +120,7 @@ void testingprivTLogfFull(testingT *t, const char *file, long line, const char *
|
||||||
void testingprivTLogvfFull(testingT *t, const char *file, long line, const char *format, va_list ap)
|
void testingprivTLogvfFull(testingT *t, const char *file, long line, const char *format, va_list ap)
|
||||||
{
|
{
|
||||||
// TODO extract filename from file
|
// TODO extract filename from file
|
||||||
printf("\t%s:%d: ", file, line);
|
printf("\t%s:%ld: ", file, line);
|
||||||
// TODO split into lines separated by \n\t\t and trimming trailing empty lines
|
// TODO split into lines separated by \n\t\t and trimming trailing empty lines
|
||||||
vprintf(format, ap);
|
vprintf(format, ap);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
@ -153,7 +154,7 @@ void testingprivTSkipNow(testingT *t)
|
||||||
returnNow(t);
|
returnNow(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
void testingTDefer(testingT *t, void (*f)(void *data), void *data)
|
void testingTDefer(testingT *t, void (*f)(testingT *t, void *data), void *data)
|
||||||
{
|
{
|
||||||
struct defer *d;
|
struct defer *d;
|
||||||
|
|
||||||
|
|
|
@ -6,11 +6,11 @@
|
||||||
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
|
||||||
#define testingprivFullName(basename) testingprivImpl ## basename
|
#define testingprivImplName(basename) testingprivImpl ## basename
|
||||||
|
|
||||||
#define testingprivScaffoldName(basename) testingprivScaffold ## basename
|
#define testingprivScaffoldName(basename) testingprivScaffold ## basename
|
||||||
#define testingprivMkScaffold(basename, argtype, argname) \
|
#define testingprivMkScaffold(basename, argtype, argname) \
|
||||||
static inline void testingprivScaffoldName(basename)(argtype *argname) { testingprivFullName(basename)(argname); }
|
static inline void testingprivScaffoldName(basename)(argtype *argname) { testingprivImplName(basename)(argname); }
|
||||||
|
|
||||||
// references:
|
// references:
|
||||||
// - https://gitlab.gnome.org/GNOME/glib/blob/master/glib/gconstructor.h
|
// - https://gitlab.gnome.org/GNOME/glib/blob/master/glib/gconstructor.h
|
||||||
|
|
Loading…
Reference in New Issue