2022-11-15 07:58:41 +00:00
|
|
|
#include "s0028_find_the_index_of_the_first_occurrence_in_a_string.hpp"
|
|
|
|
|
|
|
|
#include <gtest/gtest.h>
|
|
|
|
|
|
|
|
TEST(Problem28, Case1) {
|
|
|
|
string haystack{"sadbutsad"};
|
|
|
|
string needle{"sad"};
|
|
|
|
int o{0};
|
2022-11-30 10:20:36 +00:00
|
|
|
S0028 solution;
|
2022-11-15 07:58:41 +00:00
|
|
|
EXPECT_EQ(solution.strStr(haystack, needle), o);
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(Problem28, Case2) {
|
|
|
|
string haystack{"leetcode"};
|
|
|
|
string needle{"leeto"};
|
|
|
|
int o{-1};
|
2022-11-30 10:20:36 +00:00
|
|
|
S0028 solution;
|
2022-11-15 07:58:41 +00:00
|
|
|
EXPECT_EQ(solution.strStr(haystack, needle), o);
|
|
|
|
}
|