3202
This commit is contained in:
25
tests/test_3202.cpp
Normal file
25
tests/test_3202.cpp
Normal file
@@ -0,0 +1,25 @@
|
||||
#include <gtest/gtest.h>
|
||||
#include <solution/3202.h>
|
||||
|
||||
class MaximumLengthWithKTest : public ::testing::Test
|
||||
{
|
||||
protected:
|
||||
void AssertMaximumLength(const std::vector<int> &nums, int k, int expected)
|
||||
{
|
||||
int *arr = const_cast<int *>(nums.data());
|
||||
int result = maximumLength(arr, nums.size(), k);
|
||||
EXPECT_EQ(result, expected);
|
||||
}
|
||||
};
|
||||
|
||||
// 示例 1:nums = [1,2,3,4,5], k = 2 => 输出 5
|
||||
TEST_F(MaximumLengthWithKTest, AllIncreasing)
|
||||
{
|
||||
AssertMaximumLength({1, 2, 3, 4, 5}, 2, 5);
|
||||
}
|
||||
|
||||
// 示例 2:nums = [1,4,2,3,1,4], k = 3 => 输出 4
|
||||
TEST_F(MaximumLengthWithKTest, AlternatingValidPairs)
|
||||
{
|
||||
AssertMaximumLength({1, 4, 2, 3, 1, 4}, 3, 4);
|
||||
}
|
||||
Reference in New Issue
Block a user