From: Avery Pennarun Date: Wed, 30 Dec 2009 20:46:17 +0000 (-0500) Subject: Merge branch 'master' of git://github.com/wlach/wvtest X-Git-Url: http://rtime.felk.cvut.cz/gitweb/wvtest.git/commitdiff_plain/db65ff5907571a5004bb3c500efd19421cb06d1a?hp=2d867d814f91ae7ccd66611feb90a15e8d9f50e9 Merge branch 'master' of git://github.com/wlach/wvtest * 'master' of git://github.com/wlach/wvtest: Basic support for checking (in)equality of std::string in C++ version --- diff --git a/cpp/t/wvtest.t.cc b/cpp/t/wvtest.t.cc index d445c06..aa028d6 100644 --- a/cpp/t/wvtest.t.cc +++ b/cpp/t/wvtest.t.cc @@ -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")); } diff --git a/cpp/wvtest.cc b/cpp/wvtest.cc index 5653744..3931cca 100644 --- a/cpp/wvtest.cc +++ b/cpp/wvtest.cc @@ -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) { diff --git a/cpp/wvtest.h b/cpp/wvtest.h index dbbd1de..ac9a526 100644 --- a/cpp/wvtest.h +++ b/cpp/wvtest.h @@ -12,6 +12,7 @@ #endif #include +#include 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,