27 lines
559 B
C++
27 lines
559 B
C++
//
|
|
// Created by xfj12 on 2025/3/25.
|
|
//
|
|
|
|
#include <gtest/gtest.h>
|
|
#include <solution/367.h>
|
|
TEST(IsPerfectSquareTest, PerfectSquareCase)
|
|
{
|
|
// [IN] 16
|
|
// [OUT] true
|
|
EXPECT_TRUE(isPerfectSquare(16)); // 验证完全平方数
|
|
}
|
|
|
|
TEST(IsPerfectSquareTest, NonPerfectSquareCase)
|
|
{
|
|
// [IN] 14
|
|
// [OUT] false
|
|
EXPECT_FALSE(isPerfectSquare(14)); // 验证非完全平方数
|
|
}
|
|
|
|
TEST(IsPerfectSquareTest, BigIntNonPerfectSquareCase)
|
|
{
|
|
// [IN] 14
|
|
// [OUT] false
|
|
EXPECT_FALSE(isPerfectSquare(2147483647)); // 验证非完全平方数
|
|
}
|