#include <climits>
#include <gtest/gtest.h>
#include <solution/326.h>

class IsPowerOfThreeTest : public ::testing::Test
{
  protected:
    void AssertIsPowerOfThree(int input, bool expected)
    {
        EXPECT_EQ(isPowerOfThree(input), expected);
    }
};

// 示例测试用例
TEST_F(IsPowerOfThreeTest, ExampleTrueCases)
{
    AssertIsPowerOfThree(27, true);
    AssertIsPowerOfThree(9, true);
    AssertIsPowerOfThree(1, true); // 3^0 = 1
    AssertIsPowerOfThree(3, true);
}

TEST_F(IsPowerOfThreeTest, ExampleFalseCases)
{
    AssertIsPowerOfThree(0, false);
    AssertIsPowerOfThree(45, false);
    AssertIsPowerOfThree(-3, false);
    AssertIsPowerOfThree(10, false);
}

TEST_F(IsPowerOfThreeTest, EdgeCases)
{
    AssertIsPowerOfThree(INT_MIN, false);
    AssertIsPowerOfThree(INT_MAX, false); // INT_MAX = 2^31 - 1，不是3的幂
}