diff --git a/test-suite/machinarium_test.c b/test-suite/machinarium_test.c new file mode 100644 index 00000000..ab981da0 --- /dev/null +++ b/test-suite/machinarium_test.c @@ -0,0 +1,18 @@ + +/* + * machinarium. + * + * Cooperative multitasking engine. +*/ + +#include +#include + +extern void test_init(void); + +int +main(int argc, char *argv[]) +{ + machinarium_test(test_init); + return 0; +} diff --git a/test-suite/machinarium_test.h b/test-suite/machinarium_test.h new file mode 100644 index 00000000..5642d453 --- /dev/null +++ b/test-suite/machinarium_test.h @@ -0,0 +1,26 @@ +#ifndef MACHINARIUM_TEST_H +#define MACHINARIUM_TEST_H + +/* + * machinarium. + * + * cooperative multitasking engine. +*/ + +#define machinarium_test(FUNCTION) \ + do { \ + (FUNCTION)(); \ + fprintf(stdout, "%s: ok\n", #FUNCTION); \ + } while (0); + +#define test(expression) \ + do { \ + if (! (expression)) { \ + fprintf(stdout, "%s: fail (%s:%d) %s\n", \ + __func__, __FILE__, __LINE__, #expression); \ + fflush(stdout); \ + abort(); \ + } \ + } while (0); + +#endif diff --git a/test-suite/makefile b/test-suite/makefile new file mode 100644 index 00000000..4fedfca2 --- /dev/null +++ b/test-suite/makefile @@ -0,0 +1,15 @@ + +CC = gcc +RM = rm +CFLAGS = -I. -Wall -g -O0 -I../src +LFLAGS_LIB = ../src/libmachinarium.a -pthread -lssl -lcrypto +LFLAGS = $(LFLAGS_LIB) +OBJECTS = machinarium_test.o \ + test_init.o +all: clean $(OBJECTS) machinarium_test +machinarium_test: + $(CC) $(OBJECTS) $(LFLAGS) -o machinarium_test +.c.o: + $(CC) $(CFLAGS) -c $< +clean: + $(RM) -f $(OBJECTS) machinarium_test diff --git a/test-suite/test_init.c b/test-suite/test_init.c new file mode 100644 index 00000000..4e7002d7 --- /dev/null +++ b/test-suite/test_init.c @@ -0,0 +1,16 @@ + +/* + * machinarium. + * + * Cooperative multitasking engine. +*/ + +#include +#include + +void +test_init(void) +{ + machinarium_init(); + machinarium_free(); +}