]> rtime.felk.cvut.cz Git - wvtest.git/commitdiff
Fix standalone compilation of wvtest/cpp.
authorAvery Pennarun <apenwarr@gmail.com>
Fri, 1 May 2009 01:49:23 +0000 (21:49 -0400)
committerAvery Pennarun <apenwarr@gmail.com>
Fri, 1 May 2009 02:00:55 +0000 (22:00 -0400)
Makefile
cpp/Makefile [new file with mode: 0644]
cpp/t/.gitignore [new file with mode: 0644]
cpp/t/wvtest.t.cc [new file with mode: 0644]
cpp/wvtest.cc
cpp/wvtest.h
cpp/wvtestmain.cc
python/Makefile

index 3755d3c1cb4c03508f4379493928fb981bc2dd14..6d238d2c50af604d9e7b67ccdd2dd07486ec3744 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -7,6 +7,12 @@ all:
 runtests:
        make -C python runtests
        make -C dotnet runtests
+       make -C cpp runtests
        
 test:
        ./wvtestrunner.pl $(MAKE) runtests
+
+clean::
+       make -C python clean
+       make -C dotnet clean
+       make -C cpp clean
diff --git a/cpp/Makefile b/cpp/Makefile
new file mode 100644 (file)
index 0000000..5d8b6a8
--- /dev/null
@@ -0,0 +1,16 @@
+
+all:
+       @echo "Try: make test"
+       @false
+       
+t/wvtest: wvtestmain.cc wvtest.cc t/wvtest.t.cc
+       g++ -D WVTEST_CONFIGURED -o $@ -I. $^
+       
+runtests: t/wvtest
+       t/wvtest
+
+test:
+       ../wvtestrunner.pl $(MAKE) runtests
+       
+clean::
+       rm -f *~ *.o t/*.o t/wvtest
diff --git a/cpp/t/.gitignore b/cpp/t/.gitignore
new file mode 100644 (file)
index 0000000..160e518
--- /dev/null
@@ -0,0 +1 @@
+wvtest
diff --git a/cpp/t/wvtest.t.cc b/cpp/t/wvtest.t.cc
new file mode 100644 (file)
index 0000000..d445c06
--- /dev/null
@@ -0,0 +1,10 @@
+#include "wvtest.h"
+
+WVTEST_MAIN("wvtest tests")
+{
+    WVPASS(1);
+    WVPASSEQ(1, 1);
+    WVPASSNE(1, 2);
+    WVPASSEQ(1, 1);
+    WVPASSLT(1, 2);
+}
index 809d1ec31a48850874e1711185b30749b6b9704c..5cb1d21c71bc584ad4bffb725f350a6c51acab92 100644 (file)
@@ -5,7 +5,6 @@
  * Part of an automated testing framework.  See wvtest.h.
  */
 #include "wvtest.h"
-#include "wvautoconf.h"
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
index 69015d31b40d81329323e9c0cc499db32fc79afe..3fc64f3196a21370cf588b77e37e0aa0f3840869 100644 (file)
 #ifndef __WVTEST_H
 #define __WVTEST_H
 
+#ifndef WVTEST_CONFIGURED
+# error "Missing settings: HAVE_VALGRIND_MEMCHECK_H HAVE_WVCRASH WVTEST_CONFIGURED"
+#endif
+
 #include <time.h>
 
 class WvTest
@@ -58,6 +62,8 @@ public:
     WvTest::start_check(__FILE__, __LINE__, "NOT(" #cond ")", !(cond))
 #define WVFAILEQ(a, b) \
     WvTest::start_check_eq(__FILE__, __LINE__, (a), (b), false)
+#define WVPASSNE(a, b) WVFAILEQ(a, b)
+#define WVFAILNE(a, b) WVPASSEQ(a, b)
 
 #define WVTEST_MAIN3(descr, ff, ll, slowness) \
     static void _wvtest_main_##ll(); \
index 9f18ac314f092454138691f8f7244121d80b1387..c67528975091325ba1ac1028a8375741a24f0960 100644 (file)
@@ -1,6 +1,7 @@
 #include "wvtest.h"
-#include "wvcrash.h"
-#include "wvstring.h"
+#ifdef HAVE_WVCRASH
+# include "wvcrash.h"
+#endif
 #include <stdlib.h>
 #include <stdio.h>
 #ifdef _WIN32
@@ -50,7 +51,8 @@ static int fd_count(const char *when)
 
 int main(int argc, char **argv)
 {
-#ifdef _WIN32
+    char buf[200];
+#if defined(_WIN32) && defined(HAVE_WVCRASH)
     setup_console_crash();
 #endif
 
@@ -76,7 +78,10 @@ int main(int argc, char **argv)
        WVPASS(startfd == endfd);
 #ifndef _WIN32
        if (startfd != endfd)
-           system(WvString("ls -l /proc/%s/fd", getpid()));
+       {
+           sprintf(buf, "ls -l /proc/%d/fd", getpid());
+           system(buf);
+       }
 #endif    
     }
     
index d12f1dd45940b8fe93752a8bdf9f30af401d412e..46750bff8e711b481508ae1ab320b598d3ecc7c0 100644 (file)
@@ -9,3 +9,6 @@ runtests:
 
 test:
        ../wvtestrunner.pl $(MAKE) runtests
+
+clean::
+       rm -f *~ t/*~ *.pyc t/*.pyc
\ No newline at end of file