Bladeren bron

Whoa! Unittests.

Unittesting using automake's very kool™ `make check`, and adapting to test_qstrings.
Michele Orrù 11 jaren geleden
bovenliggende
commit
05ccbfdf0a
5 gewijzigde bestanden met toevoegingen van 14 en 3 verwijderingen
  1. 1 1
      configure.ac
  2. 2 0
      src/questions/Makefile.am
  3. 1 1
      src/questions/qstrings.c
  4. 9 0
      src/questions/tests/Makefile.am
  5. 1 1
      src/questions/tests/test_qstrings.c

+ 1 - 1
configure.ac

@@ -25,4 +25,4 @@ AC_FUNC_ERROR_AT_LINE
 AC_FUNC_MALLOC
 #AC_CHECK_FUNCS([dup2 setlocale strdup])
 
-AC_OUTPUT([Makefile src/Makefile src/questions/Makefile src/apps/Makefile ])
+AC_OUTPUT([Makefile src/Makefile src/questions/Makefile src/apps/Makefile src/questions/tests/Makefile ])

+ 2 - 0
src/questions/Makefile.am

@@ -1,3 +1,5 @@
+SUBDIRS = tests
+
 lib_LIBRARIES = libquestions.a
 AM_CFLAGS = -I ../include/
 libquestions_a_SOURCES = wiener.c pollard.c example.c allquestions.c

+ 1 - 1
src/questions/qstrings.c

@@ -4,7 +4,7 @@
  * \brief Extend stdlib support with some common functions used in questions.
  *
  */
-#include "qstrings.h"
+#include "qa/questions/qstrings.h"
 
 
 /**

+ 9 - 0
src/questions/tests/Makefile.am

@@ -0,0 +1,9 @@
+# unittesting my ass
+check_PROGRAMS = test_qstrings
+
+AM_CFLAGS = -I ../../include/
+
+test_qstrings_SOURCES = test_qstrings.c ../qstrings.c
+test_qstrings_LDADD = -L ../libquestions.a
+
+TESTS = test_qstrings

+ 1 - 1
src/questions/tests/test_qstrings.c

@@ -1,7 +1,7 @@
 #include <stddef.h>
 #include <assert.h>
 
-#include "qstrings.h"
+#include "qa/questions/qstrings.h"
 
 
 void test_is_vzero(void)