2022-11-02 09:32:58 +00:00
|
|
|
#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");
|
2022-11-30 10:20:36 +00:00
|
|
|
S0005 solution;
|
|
|
|
EXPECT_TRUE(solution.longestPalindrome1(s) == r1 || solution.longestPalindrome1(s) == r2);
|
|
|
|
EXPECT_TRUE(solution.longestPalindrome2(s) == r1 || solution.longestPalindrome2(s) == r2);
|
2022-11-02 09:32:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(Problem5, Case2) {
|
|
|
|
std::string s("cbbd");
|
|
|
|
std::string r("bb");
|
2022-11-30 10:20:36 +00:00
|
|
|
S0005 solution;
|
|
|
|
EXPECT_EQ(r.compare(solution.longestPalindrome1(s)), 0);
|
|
|
|
EXPECT_EQ(r.compare(solution.longestPalindrome2(s)), 0);
|
2022-11-02 09:32:58 +00:00
|
|
|
}
|