2022-11-21 08:51:23 +00:00
|
|
|
#include "s0032_longest_valid_parentheses.hpp"
|
|
|
|
|
|
|
|
#include <gtest/gtest.h>
|
|
|
|
|
|
|
|
TEST(Problem32, Case1) {
|
|
|
|
string i{"(()"};
|
|
|
|
int o{2};
|
2022-11-30 10:20:36 +00:00
|
|
|
S0032 solution;
|
2022-11-21 08:51:23 +00:00
|
|
|
EXPECT_EQ(solution.longestValidParentheses(i), o);
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(Problem32, Case2) {
|
|
|
|
string i{")()())"};
|
|
|
|
int o{4};
|
2022-11-30 10:20:36 +00:00
|
|
|
S0032 solution;
|
2022-11-21 08:51:23 +00:00
|
|
|
EXPECT_EQ(solution.longestValidParentheses(i), o);
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(Problem32, Case3) {
|
|
|
|
string i{"())"};
|
|
|
|
int o{2};
|
2022-11-30 10:20:36 +00:00
|
|
|
S0032 solution;
|
2022-11-21 08:51:23 +00:00
|
|
|
EXPECT_EQ(solution.longestValidParentheses(i), o);
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(Problem32, Case4) {
|
|
|
|
string i{"()(()"};
|
|
|
|
int o{2};
|
2022-11-30 10:20:36 +00:00
|
|
|
S0032 solution;
|
2022-11-21 08:51:23 +00:00
|
|
|
EXPECT_EQ(solution.longestValidParentheses(i), o);
|
|
|
|
}
|