2022-03-20 03:37:54 +00:00
|
|
|
#include "s0003_longest_substring_without_repeating_characters.hpp"
|
|
|
|
|
|
|
|
#include <gtest/gtest.h>
|
|
|
|
|
|
|
|
TEST(Problem3, Case1) {
|
|
|
|
std::string s{std::string("abcabcbb")};
|
2022-11-30 10:20:36 +00:00
|
|
|
S0003 solution;
|
2022-03-20 03:37:54 +00:00
|
|
|
EXPECT_EQ(solution.lengthOfLongestSubstring(s), 3);
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(Problem3, Case2) {
|
|
|
|
std::string s{std::string("bbbbb")};
|
2022-11-30 10:20:36 +00:00
|
|
|
S0003 solution;
|
2022-03-20 03:37:54 +00:00
|
|
|
EXPECT_EQ(solution.lengthOfLongestSubstring(s), 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(Problem3, Case3) {
|
|
|
|
std::string s{std::string("pwwkew")};
|
2022-11-30 10:20:36 +00:00
|
|
|
S0003 solution;
|
2022-03-20 03:37:54 +00:00
|
|
|
EXPECT_EQ(solution.lengthOfLongestSubstring(s), 3);
|
|
|
|
}
|