leetcode/tests/s0151_reverse_words_in_a_string.cpp
2022-11-30 18:20:36 +08:00

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);
}