23 lines
432 B
C++
23 lines
432 B
C++
#include <gtest/gtest.h>
|
||
#include <solution/258.h>
|
||
|
||
// 测试类定义
|
||
class AddDigitsTest : public ::testing::Test
|
||
{
|
||
};
|
||
|
||
// 示例 1:输入 38,输出 2
|
||
TEST_F(AddDigitsTest, Example1)
|
||
{
|
||
int input = 38;
|
||
int expected = 2;
|
||
EXPECT_EQ(addDigits(input), expected);
|
||
}
|
||
|
||
// 示例 2:输入 0,输出 0
|
||
TEST_F(AddDigitsTest, Example2)
|
||
{
|
||
int input = 0;
|
||
int expected = 0;
|
||
EXPECT_EQ(addDigits(input), expected);
|
||
} |