Files
leetcode/tests/test_3136.cpp
2025-07-15 19:06:57 +08:00

35 lines
771 B
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#include <gtest/gtest.h>
#include <solution/3136.h>
// 测试类定义
class IsValidTest : public ::testing::Test
{
};
// 示例 1输入 "234Adas",输出 true
TEST_F(IsValidTest, ValidWord)
{
char word[] = "234Adas";
EXPECT_TRUE(isValid(word));
}
// 示例 2输入 "b3",输出 false长度 < 3 且无元音)
TEST_F(IsValidTest, TooShortNoVowel)
{
char word[] = "b3";
EXPECT_FALSE(isValid(word));
}
// 示例 3输入 "a3$e",输出 false包含非法字符 $ 且无辅音)
TEST_F(IsValidTest, HasSymbolNoConsonant)
{
char word[] = "a3$e";
EXPECT_FALSE(isValid(word));
}
// 示例 3输入 "3pp",输出 false无元音
TEST_F(IsValidTest, NoConsonant)
{
char word[] = "3pp";
EXPECT_FALSE(isValid(word));
}