#include <gtest/gtest.h>
#include <solution/232.h>

class MyQueueTest : public ::testing::Test
{
  protected:
    MyQueue *queue;

    void SetUp() override
    {
        queue = myQueueCreate();
        ASSERT_NE(queue, nullptr); // 确保创建成功
    }

    void TearDown() override
    {
        myQueueFree(queue);
    }
};

// Test1 对应你提供的操作序列
TEST_F(MyQueueTest, BasicOperations)
{
    // ["MyQueue", "push", "push", "peek", "pop", "empty"]
    // [[], [1], [2], [], [], []]

    myQueuePush(queue, 1); // queue: [1]
    myQueuePush(queue, 2); // queue: [1, 2]

    int peeked = myQueuePeek(queue); // should return 1
    EXPECT_EQ(peeked, 1);

    int popped = myQueuePop(queue); // should return 1, queue becomes [2]
    EXPECT_EQ(popped, 1);

    bool isEmpty = myQueueEmpty(queue); // should return false
    EXPECT_FALSE(isEmpty);
}

TEST_F(MyQueueTest, PushPeekEmpty)
{
    myQueuePush(queue, 1); // queue: [1]

    int peeked = myQueuePeek(queue); // should return 1
    EXPECT_EQ(peeked, 1);

    bool isEmpty = myQueueEmpty(queue); // should return false
    EXPECT_FALSE(isEmpty);
}