leetcode/tests/s0151_reverse_words_in_a_string.cpp

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