2022-11-30 08:24:38 +00:00
|
|
|
#include "s0151_reverse_words_in_a_string.hpp"
|
|
|
|
|
|
|
|
#include <gtest/gtest.h>
|
|
|
|
|
|
|
|
TEST(Problem151, Case1) {
|
|
|
|
string s{"the sky is blue"};
|
|
|
|
string expected{"blue is sky the"};
|
2022-11-30 10:20:36 +00:00
|
|
|
S0151 solution;
|
2022-11-30 08:24:38 +00:00
|
|
|
EXPECT_EQ(solution.reverseWords(s), expected);
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(Problem151, Case2) {
|
|
|
|
string s{" hello world "};
|
|
|
|
string expected{"world hello"};
|
2022-11-30 10:20:36 +00:00
|
|
|
S0151 solution;
|
2022-11-30 08:24:38 +00:00
|
|
|
EXPECT_EQ(solution.reverseWords(s), expected);
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(Problem151, Case3) {
|
|
|
|
string s{"a good example"};
|
|
|
|
string expected{"example good a"};
|
2022-11-30 10:20:36 +00:00
|
|
|
S0151 solution;
|
2022-11-30 08:24:38 +00:00
|
|
|
EXPECT_EQ(solution.reverseWords(s), expected);
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(Problem151, Case4) {
|
|
|
|
string s{"F R I E N D S "};
|
|
|
|
string expected{"S D N E I R F"};
|
2022-11-30 10:20:36 +00:00
|
|
|
S0151 solution;
|
2022-11-30 08:24:38 +00:00
|
|
|
EXPECT_EQ(solution.reverseWords(s), expected);
|
|
|
|
}
|