Files
leetcode/tests/test_258.cpp
2025-07-12 23:57:21 +08:00

23 lines
432 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/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);
}