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

TEST(NumberGameTest, Test1)
{
    int nums[] = {5, 4, 2, 3};
    int numsSize = sizeof(nums) / sizeof(nums[0]);
    int returnSize = 0;

    int *result = numberGame(nums, numsSize, &returnSize);

    int expected[] = {3, 2, 5, 4};
    ASSERT_EQ(returnSize, 4);
    for (int i = 0; i < returnSize; ++i)
    {
        EXPECT_EQ(result[i], expected[i]);
    }

    free(result);
}

TEST(NumberGameTest, Test2)
{
    int nums[] = {2, 5};
    int numsSize = sizeof(nums) / sizeof(nums[0]);
    int returnSize = 0;

    int *result = numberGame(nums, numsSize, &returnSize);

    int expected[] = {5, 2};
    ASSERT_EQ(returnSize, 2);
    for (int i = 0; i < returnSize; ++i)
    {
        EXPECT_EQ(result[i], expected[i]);
    }

    free(result);
}