]> rtime.felk.cvut.cz Git - wvtest.git/commitdiff
Basic support for checking (in)equality of std::string in C++ version
authorWilliam Lachance <wrlach@gmail.com>
Tue, 11 Aug 2009 16:35:05 +0000 (12:35 -0400)
committerWilliam Lachance <wrlach@gmail.com>
Tue, 11 Aug 2009 16:35:05 +0000 (12:35 -0400)
cpp/t/wvtest.t.cc
cpp/wvtest.cc
cpp/wvtest.h

index d445c06f9fa07700ed01298d2f16bfc342bf362b..aa028d65d73f5559b4be593d51accd8db2802b25 100644 (file)
@@ -7,4 +7,10 @@ WVTEST_MAIN("wvtest tests")
     WVPASSNE(1, 2);
     WVPASSEQ(1, 1);
     WVPASSLT(1, 2);
+
+    WVPASSEQ("hello", "hello");
+    WVPASSNE("hello", "hello2");
+
+    WVPASSEQ(std::string("hello"), std::string("hello"));
+    WVPASSNE(std::string("hello"), std::string("hello2"));
 }
index 5653744e497f5ce74e891e9bd7a4f2cffbd68e6b..3931cca9bdb2230944c125d103399f8d4399386d 100644 (file)
@@ -382,6 +382,14 @@ bool WvTest::start_check_eq(const char *file, int line,
 }
 
 
+bool WvTest::start_check_eq(const char *file, int line,
+                           const std::string &a, const std::string &b, 
+                            bool expect_pass)
+{
+    return start_check_eq(file, line, a.c_str(), b.c_str(), expect_pass);
+}
+
+
 bool WvTest::start_check_eq(const char *file, int line, 
                             int a, int b, bool expect_pass)
 {
index dbbd1dedfc9952ddd93ae879c2961d90a01a8062..ac9a526d54bd1f79c496489cb5c875948488c7f7 100644 (file)
@@ -12,6 +12,7 @@
 #endif
 
 #include <time.h>
+#include <string>
 
 class WvTest
 {
@@ -39,6 +40,9 @@ public:
         { start(file, line, condstr); check(cond); return cond; }
     static bool start_check_eq(const char *file, int line,
                               const char *a, const char *b, bool expect_pass);
+    static bool start_check_eq(const char *file, int line,
+                              const std::string &a, const std::string &b, 
+                               bool expect_pass);
     static bool start_check_eq(const char *file, int line, int a, int b,
                                bool expect_pass);
     static bool start_check_lt(const char *file, int line,