diff options
author | 2015-09-02 13:49:59 +0200 | |
---|---|---|
committer | 2015-09-02 13:50:20 +0200 | |
commit | 70bddf12f5f92a71022c049fb6b8f4f8672af974 (patch) | |
tree | da554cf16908c6092dcbc4c01598a318520b5384 /tests | |
parent | a7943aa92f2c78c65c5313980c55357a31697b29 (diff) |
Added GoogleTest and convert tests to us it (nw)
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/util/corestr.c | 32 | ||||
-rw-r--r-- | tests/main.c | 9 |
2 files changed, 22 insertions, 19 deletions
diff --git a/tests/lib/util/corestr.c b/tests/lib/util/corestr.c index 97a9a2357ca..fa2dcabf48b 100644 --- a/tests/lib/util/corestr.c +++ b/tests/lib/util/corestr.c @@ -1,54 +1,54 @@ // license:BSD-3-Clause // copyright-holders:Miodrag Milanovic -#include "UnitTest++/UnitTest++.h" +#include "gtest/gtest.h" #include "corestr.h" -TEST(strmakeupper) +TEST(corestr,strmakeupper) { std::string value = "test"; - CHECK_EQUAL("TEST", strmakeupper(value).c_str()); + EXPECT_STREQ("TEST", strmakeupper(value).c_str()); } -TEST(strmakelower) +TEST(corestr,strmakelower) { std::string value = "ValUE"; - CHECK_EQUAL("value", strmakelower(value).c_str()); + EXPECT_STREQ("value", strmakelower(value).c_str()); } -TEST(strreplace) +TEST(corestr,strreplace) { std::string value = "Main string"; - CHECK_EQUAL(1, strreplace(value,"str","aaa")); - CHECK_EQUAL("Main aaaing", value.c_str()); - CHECK_EQUAL(4, strreplace(value,"a","b")); + EXPECT_EQ(1, strreplace(value,"str","aaa")); + EXPECT_STREQ("Main aaaing", value.c_str()); + EXPECT_EQ(4, strreplace(value,"a","b")); } -TEST(strtrimspace) +TEST(corestr,strtrimspace) { std::string value = " a value for test "; - CHECK_EQUAL("a value for test", strtrimspace(value).c_str()); + EXPECT_STREQ("a value for test", strtrimspace(value).c_str()); value = "\r\n\ta value for test\r\n\n\r"; - CHECK_EQUAL("a value for test", strtrimspace(value).c_str()); + EXPECT_STREQ("a value for test", strtrimspace(value).c_str()); } -TEST(strreplacechr) +TEST(corestr,strreplacechr) { std::string value = "String for doing replaces"; strreplacechr(value,'a','A'); strreplacechr(value,'e','E'); strreplacechr(value,'i','I'); strreplacechr(value,'o','O'); - CHECK_EQUAL("StrIng fOr dOIng rEplAcEs", value.c_str()); + EXPECT_STREQ("StrIng fOr dOIng rEplAcEs", value.c_str()); } -TEST(strdelchr) +TEST(corestr,strdelchr) { std::string value = "String for doing deletes"; strdelchr(value,'a'); strdelchr(value,'e'); strdelchr(value,'i'); strdelchr(value,'o'); - CHECK_EQUAL("Strng fr dng dlts", value.c_str()); + EXPECT_STREQ("Strng fr dng dlts", value.c_str()); } diff --git a/tests/main.c b/tests/main.c index d6bed4aeb67..a3ba19293f9 100644 --- a/tests/main.c +++ b/tests/main.c @@ -1,9 +1,12 @@ // license:BSD-3-Clause // copyright-holders:Miodrag Milanovic -#include "UnitTest++/UnitTest++.h" +#include <stdio.h> +#include "gtest/gtest.h" -int main(int, char const *[]) +int main(int argc, char **argv) { - return UnitTest::RunAllTests(); + testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); } + |