367
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
add_executable(test_2711 test_2711.cpp)
|
||||
target_link_libraries(test_2711 PUBLIC gtest_main 2711)
|
||||
add_executable(test_367 test_367.cpp)
|
||||
target_link_libraries(test_367 PUBLIC gtest_main 367)
|
||||
|
||||
enable_testing()
|
||||
add_test(NAME test_2711 COMMAND test_2711)
|
||||
add_test(NAME test_2711 COMMAND test_2711)
|
||||
add_test(NAME test_367 COMMAND test_367)
|
||||
26
tests/test_367.cpp
Normal file
26
tests/test_367.cpp
Normal file
@@ -0,0 +1,26 @@
|
||||
//
|
||||
// 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)); // 验证非完全平方数
|
||||
}
|
||||
Reference in New Issue
Block a user