Add default skel for unit tests. Move test programs to demo.

This commit is contained in:
Vreixo Formoso 2007-11-29 22:06:56 +01:00
parent efff783602
commit 3c7f1285d6
8 changed files with 68 additions and 17 deletions

View File

@ -23,3 +23,6 @@ test/iso
*.la
./test/lsl
./test/cat
test/test
demo/lsl
demo/cat

View File

@ -49,9 +49,10 @@
</item>
<item id="org.eclipse.cdt.core.pathentry">
<pathentry kind="src" path="src"/>
<pathentry kind="src" path="test"/>
<pathentry kind="src" path="demo"/>
<pathentry kind="out" path=""/>
<pathentry kind="con" path="org.eclipse.cdt.make.core.DISCOVERED_SCANNER_INFO"/>
<pathentry kind="src" path="test"/>
</item>
</data>
</cdtproject>

View File

@ -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
## ========================================================================= ##

23
test/test.c Normal file
View File

@ -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();
}

9
test/test.h Normal file
View File

@ -0,0 +1,9 @@
#ifndef TEST_H_
#define TEST_H_
#include <CUnit/Basic.h>
#include "libisofs.h"
void add_node_suite();
#endif /*TEST_H_*/

13
test/test_node.c Normal file
View File

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