Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit aa5efa4

Browse files
Tests for 560. Subarray Sum Equals K
1 parent bcc261b commit aa5efa4

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

‎test/leetcode_test.dart‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import 'medium/424.longest_repeating_character_replacement.test.dart' as longest
3030
import 'medium/49.group_anagrams.test.dart' as group_anagrams;
3131
import 'medium/5.longest_palindromic_substring.test.dart' as longest_palindromic_substring;
3232
import 'medium/516.longest_palindromic_subsequence.test.dart' as longest_palindromic_subsequence;
33+
import 'medium/560.subarray_sum_equals_k.test.dart' as subarray_sum_equals_k;
3334
import 'medium/647.palindromic_substrings.test.dart' as palindromic_substrings;
3435
import 'medium/8.string_to_integer_atoi.test.dart' as string_to_integer_atoi;
3536
import 'medium/912.sort_an_array.test.dart' as sort_an_array;
@@ -66,5 +67,6 @@ void main() {
6667
palindromic_substrings.main();
6768
longest_palindromic_subsequence.main();
6869
string_to_integer_atoi.main();
70+
subarray_sum_equals_k.main();
6971
});
7072
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import 'package:leetcode/src/medium/560.subarray_sum_equals_k/main.dart';
2+
import 'package:test/test.dart';
3+
4+
void main() {
5+
group('subarray_sum_equals_k', () {
6+
final f = Solution().subarraySum;
7+
8+
test('f([1, 2, 3, 6, 4, 6], 6)', () {
9+
expect(f([1, 2, 3, 6, 4, 6], 6), equals(3));
10+
});
11+
12+
test('f([-1, -1, 1], 0)', () {
13+
expect(f([-1, -1, 1], 0), equals(1));
14+
});
15+
16+
test('f([1, 2, 5, 3, 4], 6)', () {
17+
expect(f([1, 2, 5, 3, 4], 6), equals(0));
18+
});
19+
20+
test('f([1, 1, 1], 2)', () {
21+
expect(f([1, 1, 1], 2), equals(2));
22+
});
23+
24+
test('f([1], 1)', () {
25+
expect(f([1], 1), equals(1));
26+
});
27+
28+
test('f([-1, 2, -1, -2, -3], -3)', () {
29+
expect(f([-1, 2, -1, -2, -3], -3), equals(2));
30+
});
31+
}); // group 'subarray_sum_equals_k'
32+
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /