This commit is contained in:
22
tests/s0005_longest_palindromic_substring.cpp
Normal file
22
tests/s0005_longest_palindromic_substring.cpp
Normal file
@@ -0,0 +1,22 @@
|
||||
#include "s0005_longest_palindromic_substring.hpp"
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
TEST(Problem5, Case1) {
|
||||
std::string s("babad");
|
||||
std::string r1("bab");
|
||||
std::string r2("aba");
|
||||
Solution1 solution1;
|
||||
Solution2 solution2;
|
||||
EXPECT_TRUE(solution1.longestPalindrome(s) == r1 || solution1.longestPalindrome(s) == r2);
|
||||
EXPECT_TRUE(solution2.longestPalindrome(s) == r1 || solution2.longestPalindrome(s) == r2);
|
||||
}
|
||||
|
||||
TEST(Problem5, Case2) {
|
||||
std::string s("cbbd");
|
||||
std::string r("bb");
|
||||
Solution1 solution1;
|
||||
Solution2 solution2;
|
||||
EXPECT_EQ(r.compare(solution1.longestPalindrome(s)), 0);
|
||||
EXPECT_EQ(r.compare(solution2.longestPalindrome(s)), 0);
|
||||
}
|
Reference in New Issue
Block a user