mirror of https://github.com/yandex/odyssey.git
machinarium: add new test-suite implementation
This commit is contained in:
parent
cb588f4973
commit
40420f7714
|
@ -0,0 +1,18 @@
|
|||
|
||||
/*
|
||||
* machinarium.
|
||||
*
|
||||
* Cooperative multitasking engine.
|
||||
*/
|
||||
|
||||
#include <machinarium.h>
|
||||
#include <machinarium_test.h>
|
||||
|
||||
extern void test_init(void);
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
machinarium_test(test_init);
|
||||
return 0;
|
||||
}
|
|
@ -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
|
|
@ -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
|
|
@ -0,0 +1,16 @@
|
|||
|
||||
/*
|
||||
* machinarium.
|
||||
*
|
||||
* Cooperative multitasking engine.
|
||||
*/
|
||||
|
||||
#include <machinarium.h>
|
||||
#include <machinarium_test.h>
|
||||
|
||||
void
|
||||
test_init(void)
|
||||
{
|
||||
machinarium_init();
|
||||
machinarium_free();
|
||||
}
|
Loading…
Reference in New Issue