290
This commit is contained in:
62
tests/test_290.cpp
Normal file
62
tests/test_290.cpp
Normal file
@@ -0,0 +1,62 @@
|
||||
#include <gtest/gtest.h>
|
||||
#include <solution/290.h>
|
||||
|
||||
class WordPatternTest : public ::testing::Test
|
||||
{
|
||||
};
|
||||
|
||||
// 示例 1: 输入 pattern = "abba", s = "dog cat cat dog" 输出 true
|
||||
TEST_F(WordPatternTest, Example1)
|
||||
{
|
||||
char pattern[] = "abba";
|
||||
char s[] = "dog cat cat dog";
|
||||
EXPECT_TRUE(wordPattern(pattern, s));
|
||||
}
|
||||
|
||||
// 示例 2: 输入 pattern = "abba", s = "dog cat cat fish" 输出 false
|
||||
TEST_F(WordPatternTest, Example2)
|
||||
{
|
||||
char pattern[] = "abba";
|
||||
char s[] = "dog cat cat fish";
|
||||
EXPECT_FALSE(wordPattern(pattern, s));
|
||||
}
|
||||
|
||||
// 示例 3: 输入 pattern = "aaaa", s = "dog cat cat dog" 输出 false
|
||||
TEST_F(WordPatternTest, Example3)
|
||||
{
|
||||
char pattern[] = "aaaa";
|
||||
char s[] = "dog cat cat dog";
|
||||
EXPECT_FALSE(wordPattern(pattern, s));
|
||||
}
|
||||
|
||||
// 示例 4: 输入 pattern = "abba", s = "dog dog dog dog" 输出 false
|
||||
TEST_F(WordPatternTest, Example4)
|
||||
{
|
||||
char pattern[] = "abba";
|
||||
char s[] = "dog dog dog dog";
|
||||
EXPECT_FALSE(wordPattern(pattern, s));
|
||||
}
|
||||
|
||||
// 示例 5: 输入 pattern = "abc", s = "dog cat dog" 输出 false
|
||||
TEST_F(WordPatternTest, Example5)
|
||||
{
|
||||
char pattern[] = "abc";
|
||||
char s[] = "dog cat dog";
|
||||
EXPECT_FALSE(wordPattern(pattern, s));
|
||||
}
|
||||
|
||||
// 示例 6: 输入 pattern = "aaa", s = "aa aa aa aa" 输出 false
|
||||
TEST_F(WordPatternTest, Example6)
|
||||
{
|
||||
char pattern[] = "aaa";
|
||||
char s[] = "aa aa aa aa";
|
||||
EXPECT_FALSE(wordPattern(pattern, s));
|
||||
}
|
||||
|
||||
// 示例 7: 输入 pattern = "e", s = "eukera" 输出 false
|
||||
TEST_F(WordPatternTest, Example7)
|
||||
{
|
||||
char pattern[] = "e";
|
||||
char s[] = "eukera";
|
||||
EXPECT_TRUE(wordPattern(pattern, s));
|
||||
}
|
||||
Reference in New Issue
Block a user