Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 1b29ed6

Browse files
Replace all - tests
1 parent df08d5a commit 1b29ed6

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

‎Makefile‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ SOURCE = src/wniemiec/util/cpp
66
BINARY = bin
77

88
all:
9+
rm -rf $(BINARY)
910
mkdir $(BINARY)
1011
$(CC) $(FLAGS) $(SOURCE)/StringUtils.cpp -o $(BINARY)/StringUtils.o $(LFLAGS)
1112

‎test/CMakeLists.txt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ include_directories(${GTEST_INCLUDE_DIRS})
1313

1414
# Link runTests with what we want to test and the GTest and pthread library
1515
file(GLOB object_files
16-
"../src/wniemiec/util/cpp/*.o"
16+
"../bin/*.o"
1717
)
1818
list(FILTER object_files EXCLUDE REGEX ".*main.o.*$")
1919
file(GLOB test_files

‎test/wniemiec/util/cpp/StringUtilsTest.cpp‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,17 @@ TEST_F(StringUtilsTest, test_split_with_three_terms)
3838
terms
3939
);
4040
}
41+
42+
TEST_F(StringUtilsTest, test_replace_all_with_one_value_and_size_one)
43+
{
44+
std::string str = "hello world";
45+
std::string expected_str = "hello-world";
46+
std::string old_value = " ";
47+
std::string new_value = "-";
48+
std::string obtained_str = StringUtils::replace_all(str, old_value, new_value);
49+
50+
EXPECT_STREQ(
51+
expected_str.c_str(),
52+
obtained_str.c_str()
53+
);
54+
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /