36 lines
745 B
C++
36 lines
745 B
C++
#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};
|
|
S0209 solution;
|
|
EXPECT_EQ(solution.minSubArrayLen(target, nums), o);
|
|
}
|
|
|
|
TEST(Problem209, Case2) {
|
|
int target{4};
|
|
vector<int> nums{1, 4, 4};
|
|
int o{1};
|
|
S0209 solution;
|
|
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};
|
|
S0209 solution;
|
|
EXPECT_EQ(solution.minSubArrayLen(target, nums), o);
|
|
}
|
|
|
|
TEST(Problem209, Case4) {
|
|
int target{11};
|
|
vector<int> nums{1, 2, 3, 4, 5};
|
|
int o{3};
|
|
S0209 solution;
|
|
EXPECT_EQ(solution.minSubArrayLen(target, nums), o);
|
|
}
|