From cf66ec55638af1a74df09193b226b46f37653079 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Sun, 8 Nov 2015 16:06:28 +0100 Subject: c -> cpp for test (nw) --- tests/lib/util/corestr.c | 54 ---------------------------------------------- tests/lib/util/corestr.cpp | 54 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+), 54 deletions(-) delete mode 100644 tests/lib/util/corestr.c create mode 100644 tests/lib/util/corestr.cpp (limited to 'tests/lib') diff --git a/tests/lib/util/corestr.c b/tests/lib/util/corestr.c deleted file mode 100644 index fa2dcabf48b..00000000000 --- a/tests/lib/util/corestr.c +++ /dev/null @@ -1,54 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic - -#include "gtest/gtest.h" -#include "corestr.h" - -TEST(corestr,strmakeupper) -{ - std::string value = "test"; - EXPECT_STREQ("TEST", strmakeupper(value).c_str()); -} - -TEST(corestr,strmakelower) -{ - std::string value = "ValUE"; - EXPECT_STREQ("value", strmakelower(value).c_str()); -} - -TEST(corestr,strreplace) -{ - std::string value = "Main string"; - EXPECT_EQ(1, strreplace(value,"str","aaa")); - EXPECT_STREQ("Main aaaing", value.c_str()); - EXPECT_EQ(4, strreplace(value,"a","b")); -} - -TEST(corestr,strtrimspace) -{ - std::string value = " a value for test "; - EXPECT_STREQ("a value for test", strtrimspace(value).c_str()); - value = "\r\n\ta value for test\r\n\n\r"; - EXPECT_STREQ("a value for test", strtrimspace(value).c_str()); -} - -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'); - EXPECT_STREQ("StrIng fOr dOIng rEplAcEs", value.c_str()); -} - -TEST(corestr,strdelchr) -{ - std::string value = "String for doing deletes"; - strdelchr(value,'a'); - strdelchr(value,'e'); - strdelchr(value,'i'); - strdelchr(value,'o'); - EXPECT_STREQ("Strng fr dng dlts", value.c_str()); -} - diff --git a/tests/lib/util/corestr.cpp b/tests/lib/util/corestr.cpp new file mode 100644 index 00000000000..fa2dcabf48b --- /dev/null +++ b/tests/lib/util/corestr.cpp @@ -0,0 +1,54 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic + +#include "gtest/gtest.h" +#include "corestr.h" + +TEST(corestr,strmakeupper) +{ + std::string value = "test"; + EXPECT_STREQ("TEST", strmakeupper(value).c_str()); +} + +TEST(corestr,strmakelower) +{ + std::string value = "ValUE"; + EXPECT_STREQ("value", strmakelower(value).c_str()); +} + +TEST(corestr,strreplace) +{ + std::string value = "Main string"; + EXPECT_EQ(1, strreplace(value,"str","aaa")); + EXPECT_STREQ("Main aaaing", value.c_str()); + EXPECT_EQ(4, strreplace(value,"a","b")); +} + +TEST(corestr,strtrimspace) +{ + std::string value = " a value for test "; + EXPECT_STREQ("a value for test", strtrimspace(value).c_str()); + value = "\r\n\ta value for test\r\n\n\r"; + EXPECT_STREQ("a value for test", strtrimspace(value).c_str()); +} + +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'); + EXPECT_STREQ("StrIng fOr dOIng rEplAcEs", value.c_str()); +} + +TEST(corestr,strdelchr) +{ + std::string value = "String for doing deletes"; + strdelchr(value,'a'); + strdelchr(value,'e'); + strdelchr(value,'i'); + strdelchr(value,'o'); + EXPECT_STREQ("Strng fr dng dlts", value.c_str()); +} + -- cgit v1.2.3-70-g09d2