From 3c7f1285d600903ce68996fb62979dc4e33822ba Mon Sep 17 00:00:00 2001 From: Vreixo Formoso Date: Thu, 29 Nov 2007 22:06:56 +0100 Subject: [PATCH] Add default skel for unit tests. Move test programs to demo. --- .bzrignore | 3 +++ .cdtproject | 3 ++- Makefile.am | 34 ++++++++++++++++++---------------- {test => demo}/cat.c | 0 {test => demo}/lsl.c | 0 test/test.c | 23 +++++++++++++++++++++++ test/test.h | 9 +++++++++ test/test_node.c | 13 +++++++++++++ 8 files changed, 68 insertions(+), 17 deletions(-) rename {test => demo}/cat.c (100%) rename {test => demo}/lsl.c (100%) create mode 100644 test/test.c create mode 100644 test/test.h create mode 100644 test/test_node.c diff --git a/.bzrignore b/.bzrignore index 8f84308..97f2a9d 100644 --- a/.bzrignore +++ b/.bzrignore @@ -23,3 +23,6 @@ test/iso *.la ./test/lsl ./test/cat +test/test +demo/lsl +demo/cat diff --git a/.cdtproject b/.cdtproject index 534a026..785b166 100644 --- a/.cdtproject +++ b/.cdtproject @@ -49,9 +49,10 @@ + + - diff --git a/Makefile.am b/Makefile.am index 641c01e..ebd23d1 100644 --- a/Makefile.am +++ b/Makefile.am @@ -22,31 +22,33 @@ libinclude_HEADERS = \ ## ========================================================================= ## -## Build test applications +## Build demo applications noinst_PROGRAMS = \ - test/lsl \ - test/cat + demo/lsl \ + demo/cat -test_lsl_CPPFLAGS = -Isrc -test_lsl_LDADD = $(src_libisofs_la_OBJECTS) $(THREAD_LIBS) -test_lsl_SOURCES = test/lsl.c +demo_lsl_CPPFLAGS = -Isrc +demo_lsl_LDADD = $(src_libisofs_la_OBJECTS) $(THREAD_LIBS) +demo_lsl_SOURCES = demo/lsl.c -test_cat_CPPFLAGS = -Isrc -test_cat_LDADD = $(src_libisofs_la_OBJECTS) $(THREAD_LIBS) -test_cat_SOURCES = test/cat.c +demo_cat_CPPFLAGS = -Isrc +demo_cat_LDADD = $(src_libisofs_la_OBJECTS) $(THREAD_LIBS) +demo_cat_SOURCES = demo/cat.c ## Build unit test -#check_PROGRAMS = \ -# test/test +check_PROGRAMS = \ + test/test -#test_test_CPPFLAGS = -Ilibisofs -#test_test_LDADD = $(libisofs_libisofs_la_OBJECTS) $(THREAD_LIBS) -lcunit -#test_test_LDFLAGS = -L.. -lm +test_test_CPPFLAGS = -Isrc +test_test_LDADD = $(src_libisofs_la_OBJECTS) $(THREAD_LIBS) -lcunit +test_test_LDFLAGS = -L.. -lm -#test_test_SOURCES = \ -# test/test_exclude.c +test_test_SOURCES = \ + test/test.h \ + test/test.c \ + test/test_node.c ## ========================================================================= ## diff --git a/test/cat.c b/demo/cat.c similarity index 100% rename from test/cat.c rename to demo/cat.c diff --git a/test/lsl.c b/demo/lsl.c similarity index 100% rename from test/lsl.c rename to demo/lsl.c diff --git a/test/test.c b/test/test.c new file mode 100644 index 0000000..f343778 --- /dev/null +++ b/test/test.c @@ -0,0 +1,23 @@ +#include "test.h" + +static void create_test_suite() +{ + add_node_suite(); +} + +int main(int argc, char **argv) +{ + CU_pSuite pSuite = NULL; + + /* initialize the CUnit test registry */ + if (CUE_SUCCESS != CU_initialize_registry()) + return CU_get_error(); + + create_test_suite(); + + /* Run all tests using the console interface */ + CU_basic_set_mode(CU_BRM_VERBOSE); + CU_basic_run_tests(); + CU_cleanup_registry(); + return CU_get_error(); +} diff --git a/test/test.h b/test/test.h new file mode 100644 index 0000000..b38c9a2 --- /dev/null +++ b/test/test.h @@ -0,0 +1,9 @@ +#ifndef TEST_H_ +#define TEST_H_ + +#include +#include "libisofs.h" + +void add_node_suite(); + +#endif /*TEST_H_*/ diff --git a/test/test_node.c b/test/test_node.c new file mode 100644 index 0000000..6fa664f --- /dev/null +++ b/test/test_node.c @@ -0,0 +1,13 @@ +/* + * Unit test for node.h + */ + +#include "libisofs.h" +#include "node.h" +#include "test.h" + +void add_node_suite() +{ + CU_pSuite pSuite = CU_add_suite("Node Test Suite", NULL, NULL); + +}