32 lines
746 B
C++
32 lines
746 B
C++
#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"};
|
|
S0151 solution;
|
|
EXPECT_EQ(solution.reverseWords(s), expected);
|
|
}
|
|
|
|
TEST(Problem151, Case2) {
|
|
string s{" hello world "};
|
|
string expected{"world hello"};
|
|
S0151 solution;
|
|
EXPECT_EQ(solution.reverseWords(s), expected);
|
|
}
|
|
|
|
TEST(Problem151, Case3) {
|
|
string s{"a good example"};
|
|
string expected{"example good a"};
|
|
S0151 solution;
|
|
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"};
|
|
S0151 solution;
|
|
EXPECT_EQ(solution.reverseWords(s), expected);
|
|
}
|