2974
This commit is contained in:
38
tests/test_2974.cpp
Normal file
38
tests/test_2974.cpp
Normal file
@@ -0,0 +1,38 @@
|
||||
#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);
|
||||
}
|
||||
Reference in New Issue
Block a user