Minimum Size Subarray Sum
This commit is contained in:
27
tests/s0076_minimum_window_substring.cpp
Normal file
27
tests/s0076_minimum_window_substring.cpp
Normal file
@@ -0,0 +1,27 @@
|
||||
#include "s0076_minimum_window_substring.hpp"
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
TEST(Problem76, Case1) {
|
||||
string s{"ADOBECODEBANC"};
|
||||
string t{"ABC"};
|
||||
string expected{"BANC"};
|
||||
Solution solution;
|
||||
EXPECT_EQ(solution.minWindow(s, t), expected);
|
||||
}
|
||||
|
||||
TEST(Problem76, Case2) {
|
||||
string s{"a"};
|
||||
string t{"a"};
|
||||
string expected{"a"};
|
||||
Solution solution;
|
||||
EXPECT_EQ(solution.minWindow(s, t), expected);
|
||||
}
|
||||
|
||||
TEST(Problem76, Case3) {
|
||||
string s{"a"};
|
||||
string t{"aa"};
|
||||
string expected{""};
|
||||
Solution solution;
|
||||
EXPECT_EQ(solution.minWindow(s, t), expected);
|
||||
}
|
35
tests/s0209_minimum_size_subarray_sum.cpp
Normal file
35
tests/s0209_minimum_size_subarray_sum.cpp
Normal file
@@ -0,0 +1,35 @@
|
||||
#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};
|
||||
Solution solution;
|
||||
EXPECT_EQ(solution.minSubArrayLen(target, nums), o);
|
||||
}
|
||||
|
||||
TEST(Problem209, Case2) {
|
||||
int target{4};
|
||||
vector<int> nums{1, 4, 4};
|
||||
int o{1};
|
||||
Solution 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};
|
||||
Solution 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};
|
||||
Solution solution;
|
||||
EXPECT_EQ(solution.minSubArrayLen(target, nums), o);
|
||||
}
|
Reference in New Issue
Block a user