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 3d3f490

Browse files
Tests
1 parent 043b669 commit 3d3f490

File tree

2 files changed

+53
-14
lines changed

2 files changed

+53
-14
lines changed

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

Lines changed: 51 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,46 @@ TEST_F(StringUtilsTest, test_split_with_separator_size_two)
5454
});
5555
}
5656

57-
TEST_F(StringUtilsTest, test_split_with_empty_str)
57+
TEST_F(StringUtilsTest, test_to_upper_with_empty_str)
5858
{
5959
with_str("");
60-
do_split_with_sep(" ");
61-
assert_terms_are({""});
60+
do_to_upper();
61+
assert_result_is("");
62+
}
63+
64+
TEST_F(StringUtilsTest, test_to_upper_with_lower_str_size_one)
65+
{
66+
with_str("h");
67+
do_to_upper();
68+
assert_result_is("H");
69+
}
70+
71+
TEST_F(StringUtilsTest, test_to_upper_with_lower_str_size_two)
72+
{
73+
with_str("he");
74+
do_to_upper();
75+
assert_result_is("HE");
76+
}
77+
78+
TEST_F(StringUtilsTest, test_to_upper_with_upper_str_size_one)
79+
{
80+
with_str("H");
81+
do_to_upper();
82+
assert_result_is("H");
83+
}
84+
85+
TEST_F(StringUtilsTest, test_to_upper_with_upper_str_size_two)
86+
{
87+
with_str("HE");
88+
do_to_upper();
89+
assert_result_is("HE");
90+
}
91+
92+
TEST_F(StringUtilsTest, test_to_upper_with_upper_and_lower_str)
93+
{
94+
with_str("hEllo wOrlD");
95+
do_to_upper();
96+
assert_result_is("HELLO WORLD");
6297
}
6398

6499
TEST_F(StringUtilsTest, test_replace_all_with_one_value_and_new_value_with_size_one)
@@ -94,6 +129,19 @@ void StringUtilsTest::assert_terms_are(std::vector<std::string> expected_terms)
94129
EXPECT_EQ(expected_terms, obtained_terms);
95130
}
96131

132+
void StringUtilsTest::do_to_upper()
133+
{
134+
obtained_result = StringUtils::to_upper(selected_string);
135+
}
136+
137+
void StringUtilsTest::assert_result_is(std::string expected_result)
138+
{
139+
EXPECT_STREQ(
140+
expected_result.c_str(),
141+
obtained_result.c_str()
142+
);
143+
}
144+
97145
void StringUtilsTest::do_replace_all_with_old_and_new_value(
98146
std::string old_value,
99147
std::string new_value
@@ -107,13 +155,3 @@ void StringUtilsTest::do_replace_all_with_old_and_new_value(
107155

108156

109157
}
110-
111-
void StringUtilsTest::assert_result_is(std::string expected_result)
112-
{
113-
EXPECT_STREQ(
114-
expected_result.c_str(),
115-
obtained_result.c_str()
116-
);
117-
}
118-
119-

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,11 @@ namespace wniemiec { namespace util { namespace cpp {
3232
void with_str(std::string str);
3333
void do_split_with_sep(std::string sep);
3434
void assert_terms_are(std::vector<std::string> expected_terms);
35+
void do_to_upper();
36+
void assert_result_is(std::string expected_result);
3537
void do_replace_all_with_old_and_new_value(
3638
std::string old_value,
3739
std::string new_value
3840
);
39-
void assert_result_is(std::string expected_result);
4041
};
4142
}}}

0 commit comments

Comments
(0)

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