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 0b78e47

Browse files
Tests 8. String to Integer (atoi)
1 parent e3dd267 commit 0b78e47

File tree

2 files changed

+46
-0
lines changed

2 files changed

+46
-0
lines changed

‎test/leetcode_test.dart‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ 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;
3333
import 'medium/647.palindromic_substrings.test.dart' as palindromic_substrings;
34+
import 'medium/8.string_to_integer_atoi.test.dart' as string_to_integer_atoi;
3435
import 'medium/912.sort_an_array.test.dart' as sort_an_array;
3536

3637
void main() {
@@ -64,5 +65,6 @@ void main() {
6465
longest_palindromic_substring.main();
6566
palindromic_substrings.main();
6667
longest_palindromic_subsequence.main();
68+
string_to_integer_atoi.main();
6769
});
6870
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import 'package:leetcode/src/medium/8.string_to_integer_atoi/main.dart';
2+
import 'package:test/test.dart';
3+
4+
void main() {
5+
group('longest_palindromic_substring', () {
6+
final f = Solution().myAtoi;
7+
8+
test('f("")', () {
9+
expect(f(''), equals(0));
10+
});
11+
12+
test('f(" ")', () {
13+
expect(f(' '), equals(0));
14+
});
15+
16+
test('f("-2147483648")', () {
17+
expect(f('-2147483648'), equals(-2147483648));
18+
});
19+
20+
test('f("9223372036854775808")', () {
21+
expect(f('9223372036854775808'), equals(2147483647));
22+
});
23+
24+
test('f("words and 987")', () {
25+
expect(f('words and 987'), equals(0));
26+
});
27+
28+
test('f("42")', () {
29+
expect(f('42'), equals(42));
30+
});
31+
32+
test('f("+-12")', () {
33+
expect(f('+-12'), equals(0));
34+
});
35+
36+
test('f(" -42")', () {
37+
expect(f(' -42'), equals(-42));
38+
});
39+
40+
test('f("+4193 with words")', () {
41+
expect(f('+4193 with words'), equals(4193));
42+
});
43+
}); // group 'longest_palindromic_substring'
44+
}

0 commit comments

Comments
(0)

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