From 4ea3a28af9a7979c95a0bf582b650f021df65138 Mon Sep 17 00:00:00 2001 From: Georg Hopp Date: Thu, 17 Nov 2011 13:32:46 +0100 Subject: [PATCH] start work on packetTest --- ChangeLog | 12 ++++- src/packet.c | 3 +- tests/Makefile.am | 14 ++++-- tests/Makefile.in | 122 ++++++++++++++++++++++++++++++++++++++++++--- tests/packetTest.c | 50 +++++++++++++++++++ 5 files changed, 185 insertions(+), 16 deletions(-) create mode 100644 tests/packetTest.c diff --git a/ChangeLog b/ChangeLog index c66a0c2..278e204 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,14 @@ +2011-11-17 13:32:46 +0100 Georg Hopp + + * start work on packetTest (HEAD, master) + +2011-11-17 13:14:05 +0100 Georg Hopp + + * oops, added forgotten file (origin/master, origin/HEAD) + 2011-11-17 13:00:11 +0100 Georg Hopp - * optimized the class definition stuff, add instanceOf and isObject methods and add assertion macros to use these checks (HEAD, master) + * optimized the class definition stuff, add instanceOf and isObject methods and add assertion macros to use these checks 2011-11-17 08:33:56 +0100 Georg Hopp @@ -20,7 +28,7 @@ 2011-11-16 19:32:44 +0100 Georg Hopp - * i had to remove the cool plugin stuff for my tests, as i found no working way to use this with autotools. Now all works. (origin/master, origin/HEAD) + * i had to remove the cool plugin stuff for my tests, as i found no working way to use this with autotools. Now all works. 2011-11-16 18:14:51 +0100 Georg Hopp diff --git a/src/packet.c b/src/packet.c index 23bd2c4..4717ec6 100644 --- a/src/packet.c +++ b/src/packet.c @@ -100,8 +100,7 @@ packet_setData( } void -packet_set_default_content( - struct PACKET * _this) +packet_set_default_content(struct PACKET * _this) { _this->content[PACKET_HEADER] = NULL; _this->content[PACKET_DATA] = NULL; diff --git a/tests/Makefile.am b/tests/Makefile.am index 5107097..b7c6103 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1,13 +1,17 @@ ACLOCAL_AMFLAGS = -I m4 TESTS_ENVIRONMENT = valgrind --error-exitcode=123 --leak-check=full --quiet -TESTS = cclassTest cryptTest -check_PROGRAMS = cclassTest cryptTest +TESTS = cclassTest cryptTest packetTest +check_PROGRAMS = cclassTest cryptTest packetTest + +cclassTest_SOURCES = runtest.c cclassTest.c mock/class.c ../src/cclass.c +cclassTest_LDADD = $(LIBOBJS) +cclassTest_CFLAGS = -I ../include -I .. -I . cryptTest_SOURCES = runtest.c cryptTest.c ../src/cclass.c ../src/crypt.c cryptTest_LDADD = $(LIBOBJS) cryptTest_CFLAGS = -I ../include -I .. -I . -cclassTest_SOURCES = runtest.c cclassTest.c mock/class.c ../src/cclass.c -cclassTest_LDADD = $(LIBOBJS) -cclassTest_CFLAGS = -I ../include -I .. -I . +packetTest_SOURCES = runtest.c packetTest.c ../src/cclass.c ../src/packet.c ../src/dyntype.c ../src/dyntype/hash.c +packetTest_LDADD = $(LIBOBJS) +packetTest_CFLAGS = -I ../include -I .. -I . diff --git a/tests/Makefile.in b/tests/Makefile.in index 6feb3e0..ad40b96 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -33,8 +33,9 @@ PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ -TESTS = cclassTest$(EXEEXT) cryptTest$(EXEEXT) -check_PROGRAMS = cclassTest$(EXEEXT) cryptTest$(EXEEXT) +TESTS = cclassTest$(EXEEXT) cryptTest$(EXEEXT) packetTest$(EXEEXT) +check_PROGRAMS = cclassTest$(EXEEXT) cryptTest$(EXEEXT) \ + packetTest$(EXEEXT) subdir = tests DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 @@ -61,6 +62,15 @@ cryptTest_DEPENDENCIES = $(LIBOBJS) cryptTest_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(cryptTest_CFLAGS) \ $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +am_packetTest_OBJECTS = packetTest-runtest.$(OBJEXT) \ + packetTest-packetTest.$(OBJEXT) packetTest-cclass.$(OBJEXT) \ + packetTest-packet.$(OBJEXT) packetTest-dyntype.$(OBJEXT) \ + packetTest-hash.$(OBJEXT) +packetTest_OBJECTS = $(am_packetTest_OBJECTS) +packetTest_DEPENDENCIES = $(LIBOBJS) +packetTest_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(packetTest_CFLAGS) \ + $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles @@ -74,8 +84,10 @@ CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ -SOURCES = $(cclassTest_SOURCES) $(cryptTest_SOURCES) -DIST_SOURCES = $(cclassTest_SOURCES) $(cryptTest_SOURCES) +SOURCES = $(cclassTest_SOURCES) $(cryptTest_SOURCES) \ + $(packetTest_SOURCES) +DIST_SOURCES = $(cclassTest_SOURCES) $(cryptTest_SOURCES) \ + $(packetTest_SOURCES) ETAGS = etags CTAGS = ctags am__tty_colors = \ @@ -196,12 +208,15 @@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ ACLOCAL_AMFLAGS = -I m4 TESTS_ENVIRONMENT = valgrind --error-exitcode=123 --leak-check=full --quiet -cryptTest_SOURCES = runtest.c cryptTest.c ../src/cclass.c ../src/crypt.c -cryptTest_LDADD = $(LIBOBJS) -cryptTest_CFLAGS = -I ../include -I .. -I . cclassTest_SOURCES = runtest.c cclassTest.c mock/class.c ../src/cclass.c cclassTest_LDADD = $(LIBOBJS) cclassTest_CFLAGS = -I ../include -I .. -I . +cryptTest_SOURCES = runtest.c cryptTest.c ../src/cclass.c ../src/crypt.c +cryptTest_LDADD = $(LIBOBJS) +cryptTest_CFLAGS = -I ../include -I .. -I . +packetTest_SOURCES = runtest.c packetTest.c ../src/cclass.c ../src/packet.c ../src/dyntype.c ../src/dyntype/hash.c +packetTest_LDADD = $(LIBOBJS) +packetTest_CFLAGS = -I ../include -I .. -I . all: all-am .SUFFIXES: @@ -251,6 +266,9 @@ cclassTest$(EXEEXT): $(cclassTest_OBJECTS) $(cclassTest_DEPENDENCIES) cryptTest$(EXEEXT): $(cryptTest_OBJECTS) $(cryptTest_DEPENDENCIES) @rm -f cryptTest$(EXEEXT) $(cryptTest_LINK) $(cryptTest_OBJECTS) $(cryptTest_LDADD) $(LIBS) +packetTest$(EXEEXT): $(packetTest_OBJECTS) $(packetTest_DEPENDENCIES) + @rm -f packetTest$(EXEEXT) + $(packetTest_LINK) $(packetTest_OBJECTS) $(packetTest_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) @@ -266,6 +284,12 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cryptTest-crypt.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cryptTest-cryptTest.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cryptTest-runtest.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/packetTest-cclass.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/packetTest-dyntype.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/packetTest-hash.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/packetTest-packet.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/packetTest-packetTest.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/packetTest-runtest.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @@ -400,6 +424,90 @@ cryptTest-crypt.obj: ../src/crypt.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cryptTest_CFLAGS) $(CFLAGS) -c -o cryptTest-crypt.obj `if test -f '../src/crypt.c'; then $(CYGPATH_W) '../src/crypt.c'; else $(CYGPATH_W) '$(srcdir)/../src/crypt.c'; fi` +packetTest-runtest.o: runtest.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(packetTest_CFLAGS) $(CFLAGS) -MT packetTest-runtest.o -MD -MP -MF $(DEPDIR)/packetTest-runtest.Tpo -c -o packetTest-runtest.o `test -f 'runtest.c' || echo '$(srcdir)/'`runtest.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/packetTest-runtest.Tpo $(DEPDIR)/packetTest-runtest.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtest.c' object='packetTest-runtest.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(packetTest_CFLAGS) $(CFLAGS) -c -o packetTest-runtest.o `test -f 'runtest.c' || echo '$(srcdir)/'`runtest.c + +packetTest-runtest.obj: runtest.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(packetTest_CFLAGS) $(CFLAGS) -MT packetTest-runtest.obj -MD -MP -MF $(DEPDIR)/packetTest-runtest.Tpo -c -o packetTest-runtest.obj `if test -f 'runtest.c'; then $(CYGPATH_W) 'runtest.c'; else $(CYGPATH_W) '$(srcdir)/runtest.c'; fi` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/packetTest-runtest.Tpo $(DEPDIR)/packetTest-runtest.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtest.c' object='packetTest-runtest.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(packetTest_CFLAGS) $(CFLAGS) -c -o packetTest-runtest.obj `if test -f 'runtest.c'; then $(CYGPATH_W) 'runtest.c'; else $(CYGPATH_W) '$(srcdir)/runtest.c'; fi` + +packetTest-packetTest.o: packetTest.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(packetTest_CFLAGS) $(CFLAGS) -MT packetTest-packetTest.o -MD -MP -MF $(DEPDIR)/packetTest-packetTest.Tpo -c -o packetTest-packetTest.o `test -f 'packetTest.c' || echo '$(srcdir)/'`packetTest.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/packetTest-packetTest.Tpo $(DEPDIR)/packetTest-packetTest.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='packetTest.c' object='packetTest-packetTest.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(packetTest_CFLAGS) $(CFLAGS) -c -o packetTest-packetTest.o `test -f 'packetTest.c' || echo '$(srcdir)/'`packetTest.c + +packetTest-packetTest.obj: packetTest.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(packetTest_CFLAGS) $(CFLAGS) -MT packetTest-packetTest.obj -MD -MP -MF $(DEPDIR)/packetTest-packetTest.Tpo -c -o packetTest-packetTest.obj `if test -f 'packetTest.c'; then $(CYGPATH_W) 'packetTest.c'; else $(CYGPATH_W) '$(srcdir)/packetTest.c'; fi` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/packetTest-packetTest.Tpo $(DEPDIR)/packetTest-packetTest.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='packetTest.c' object='packetTest-packetTest.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(packetTest_CFLAGS) $(CFLAGS) -c -o packetTest-packetTest.obj `if test -f 'packetTest.c'; then $(CYGPATH_W) 'packetTest.c'; else $(CYGPATH_W) '$(srcdir)/packetTest.c'; fi` + +packetTest-cclass.o: ../src/cclass.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(packetTest_CFLAGS) $(CFLAGS) -MT packetTest-cclass.o -MD -MP -MF $(DEPDIR)/packetTest-cclass.Tpo -c -o packetTest-cclass.o `test -f '../src/cclass.c' || echo '$(srcdir)/'`../src/cclass.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/packetTest-cclass.Tpo $(DEPDIR)/packetTest-cclass.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../src/cclass.c' object='packetTest-cclass.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(packetTest_CFLAGS) $(CFLAGS) -c -o packetTest-cclass.o `test -f '../src/cclass.c' || echo '$(srcdir)/'`../src/cclass.c + +packetTest-cclass.obj: ../src/cclass.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(packetTest_CFLAGS) $(CFLAGS) -MT packetTest-cclass.obj -MD -MP -MF $(DEPDIR)/packetTest-cclass.Tpo -c -o packetTest-cclass.obj `if test -f '../src/cclass.c'; then $(CYGPATH_W) '../src/cclass.c'; else $(CYGPATH_W) '$(srcdir)/../src/cclass.c'; fi` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/packetTest-cclass.Tpo $(DEPDIR)/packetTest-cclass.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../src/cclass.c' object='packetTest-cclass.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(packetTest_CFLAGS) $(CFLAGS) -c -o packetTest-cclass.obj `if test -f '../src/cclass.c'; then $(CYGPATH_W) '../src/cclass.c'; else $(CYGPATH_W) '$(srcdir)/../src/cclass.c'; fi` + +packetTest-packet.o: ../src/packet.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(packetTest_CFLAGS) $(CFLAGS) -MT packetTest-packet.o -MD -MP -MF $(DEPDIR)/packetTest-packet.Tpo -c -o packetTest-packet.o `test -f '../src/packet.c' || echo '$(srcdir)/'`../src/packet.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/packetTest-packet.Tpo $(DEPDIR)/packetTest-packet.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../src/packet.c' object='packetTest-packet.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(packetTest_CFLAGS) $(CFLAGS) -c -o packetTest-packet.o `test -f '../src/packet.c' || echo '$(srcdir)/'`../src/packet.c + +packetTest-packet.obj: ../src/packet.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(packetTest_CFLAGS) $(CFLAGS) -MT packetTest-packet.obj -MD -MP -MF $(DEPDIR)/packetTest-packet.Tpo -c -o packetTest-packet.obj `if test -f '../src/packet.c'; then $(CYGPATH_W) '../src/packet.c'; else $(CYGPATH_W) '$(srcdir)/../src/packet.c'; fi` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/packetTest-packet.Tpo $(DEPDIR)/packetTest-packet.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../src/packet.c' object='packetTest-packet.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(packetTest_CFLAGS) $(CFLAGS) -c -o packetTest-packet.obj `if test -f '../src/packet.c'; then $(CYGPATH_W) '../src/packet.c'; else $(CYGPATH_W) '$(srcdir)/../src/packet.c'; fi` + +packetTest-dyntype.o: ../src/dyntype.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(packetTest_CFLAGS) $(CFLAGS) -MT packetTest-dyntype.o -MD -MP -MF $(DEPDIR)/packetTest-dyntype.Tpo -c -o packetTest-dyntype.o `test -f '../src/dyntype.c' || echo '$(srcdir)/'`../src/dyntype.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/packetTest-dyntype.Tpo $(DEPDIR)/packetTest-dyntype.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../src/dyntype.c' object='packetTest-dyntype.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(packetTest_CFLAGS) $(CFLAGS) -c -o packetTest-dyntype.o `test -f '../src/dyntype.c' || echo '$(srcdir)/'`../src/dyntype.c + +packetTest-dyntype.obj: ../src/dyntype.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(packetTest_CFLAGS) $(CFLAGS) -MT packetTest-dyntype.obj -MD -MP -MF $(DEPDIR)/packetTest-dyntype.Tpo -c -o packetTest-dyntype.obj `if test -f '../src/dyntype.c'; then $(CYGPATH_W) '../src/dyntype.c'; else $(CYGPATH_W) '$(srcdir)/../src/dyntype.c'; fi` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/packetTest-dyntype.Tpo $(DEPDIR)/packetTest-dyntype.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../src/dyntype.c' object='packetTest-dyntype.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(packetTest_CFLAGS) $(CFLAGS) -c -o packetTest-dyntype.obj `if test -f '../src/dyntype.c'; then $(CYGPATH_W) '../src/dyntype.c'; else $(CYGPATH_W) '$(srcdir)/../src/dyntype.c'; fi` + +packetTest-hash.o: ../src/dyntype/hash.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(packetTest_CFLAGS) $(CFLAGS) -MT packetTest-hash.o -MD -MP -MF $(DEPDIR)/packetTest-hash.Tpo -c -o packetTest-hash.o `test -f '../src/dyntype/hash.c' || echo '$(srcdir)/'`../src/dyntype/hash.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/packetTest-hash.Tpo $(DEPDIR)/packetTest-hash.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../src/dyntype/hash.c' object='packetTest-hash.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(packetTest_CFLAGS) $(CFLAGS) -c -o packetTest-hash.o `test -f '../src/dyntype/hash.c' || echo '$(srcdir)/'`../src/dyntype/hash.c + +packetTest-hash.obj: ../src/dyntype/hash.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(packetTest_CFLAGS) $(CFLAGS) -MT packetTest-hash.obj -MD -MP -MF $(DEPDIR)/packetTest-hash.Tpo -c -o packetTest-hash.obj `if test -f '../src/dyntype/hash.c'; then $(CYGPATH_W) '../src/dyntype/hash.c'; else $(CYGPATH_W) '$(srcdir)/../src/dyntype/hash.c'; fi` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/packetTest-hash.Tpo $(DEPDIR)/packetTest-hash.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../src/dyntype/hash.c' object='packetTest-hash.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(packetTest_CFLAGS) $(CFLAGS) -c -o packetTest-hash.obj `if test -f '../src/dyntype/hash.c'; then $(CYGPATH_W) '../src/dyntype/hash.c'; else $(CYGPATH_W) '$(srcdir)/../src/dyntype/hash.c'; fi` + mostlyclean-libtool: -rm -f *.lo diff --git a/tests/packetTest.c b/tests/packetTest.c new file mode 100644 index 0000000..009c981 --- /dev/null +++ b/tests/packetTest.c @@ -0,0 +1,50 @@ +#include "runtest.h" +#include "token/cclass.h" +#include "token/packet.h" +#include "token/dyntype.h" + + +const char testname[] = "packetTest"; +struct PACKET * packet = NULL; + + +static +int +__setUp() +{ + packet = new(PACKET); + + ASSERT_INSTANCE_OF(PACKET, packet); + return TEST_OK; +} +int (* const setUp)() = __setUp; + +static +int +__tearDown() +{ + if (NULL != packet) { + ASSERT_OBJECT(packet); + delete(&packet); + } + + return TEST_OK; +} +int (* const tearDown)() = __tearDown; + +static +int +testDefaultInit() +{ + ASSERT_NULL(packet_getHeader(packet)); + ASSERT_NULL(packet_getData(packet)); + + return TEST_OK; +} + +const testfunc tests[] = { + testDefaultInit +}; +const size_t count = FUNCS_COUNT(tests); + +// vim: set et ts=4 sw=4: