2022-11-29 10:25:47 +00:00
|
|
|
#include "s0209_minimum_size_subarray_sum.hpp"
|
|
|
|
|
|
|
|
#include <gtest/gtest.h>
|
|
|
|
|
|
|
|
TEST(Problem209, Case1) {
|
|
|
|
int target{7};
|
|
|
|
vector<int> nums{2, 3, 1, 2, 4, 3};
|
|
|
|
int o{2};
|
2022-11-30 10:20:36 +00:00
|
|
|
S0209 solution;
|
2022-11-29 10:25:47 +00:00
|
|
|
EXPECT_EQ(solution.minSubArrayLen(target, nums), o);
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(Problem209, Case2) {
|
|
|
|
int target{4};
|
|
|
|
vector<int> nums{1, 4, 4};
|
|
|
|
int o{1};
|
2022-11-30 10:20:36 +00:00
|
|
|
S0209 solution;
|
2022-11-29 10:25:47 +00:00
|
|
|
EXPECT_EQ(solution.minSubArrayLen(target, nums), o);
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(Problem209, Case3) {
|
|
|
|
int target{11};
|
|
|
|
vector<int> nums{1, 1, 1, 1, 1, 1, 1, 1};
|
|
|
|
int o{0};
|
2022-11-30 10:20:36 +00:00
|
|
|
S0209 solution;
|
2022-11-29 10:25:47 +00:00
|
|
|
EXPECT_EQ(solution.minSubArrayLen(target, nums), o);
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(Problem209, Case4) {
|
|
|
|
int target{11};
|
|
|
|
vector<int> nums{1, 2, 3, 4, 5};
|
|
|
|
int o{3};
|
2022-11-30 10:20:36 +00:00
|
|
|
S0209 solution;
|
2022-11-29 10:25:47 +00:00
|
|
|
EXPECT_EQ(solution.minSubArrayLen(target, nums), o);
|
|
|
|
}
|