Skip to content

Commit 1b6f0fd

Browse files
authored
Improved tests 38, 44, 65, 81.
1 parent b6eabea commit 1b6f0fd

File tree

4 files changed

+89
-25
lines changed

4 files changed

+89
-25
lines changed

src/test/java/g0001_0100/s0038_count_and_say/SolutionTest.java

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,21 @@
88
class SolutionTest {
99
@Test
1010
void countAndSay() {
11-
Solution solution = new Solution();
12-
assertThat(solution.countAndSay(1), equalTo("1"));
13-
assertThat(solution.countAndSay(2), equalTo("11"));
14-
assertThat(solution.countAndSay(3), equalTo("21"));
15-
assertThat(solution.countAndSay(4), equalTo("1211"));
11+
assertThat(new Solution().countAndSay(1), equalTo("1"));
12+
}
13+
14+
@Test
15+
void countAndSay2() {
16+
assertThat(new Solution().countAndSay(2), equalTo("11"));
17+
}
18+
19+
@Test
20+
void countAndSay3() {
21+
assertThat(new Solution().countAndSay(3), equalTo("21"));
22+
}
23+
24+
@Test
25+
void countAndSay4() {
26+
assertThat(new Solution().countAndSay(4), equalTo("1211"));
1627
}
1728
}

src/test/java/g0001_0100/s0044_wildcard_matching/SolutionTest.java

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,26 @@
88
class SolutionTest {
99
@Test
1010
void isMatch() {
11-
Solution solution = new Solution();
12-
assertThat(solution.isMatch("aa", "a"), equalTo(false));
13-
assertThat(solution.isMatch("aa", "*"), equalTo(true));
14-
assertThat(solution.isMatch("cb", "?a"), equalTo(false));
15-
assertThat(solution.isMatch("adceb", "*a*b"), equalTo(true));
16-
assertThat(solution.isMatch("acdcb", "a*c?b"), equalTo(false));
11+
assertThat(new Solution().isMatch("aa", "a"), equalTo(false));
12+
}
13+
14+
@Test
15+
void isMatch2() {
16+
assertThat(new Solution().isMatch("aa", "*"), equalTo(true));
17+
}
18+
19+
@Test
20+
void isMatch3() {
21+
assertThat(new Solution().isMatch("cb", "?a"), equalTo(false));
22+
}
23+
24+
@Test
25+
void isMatch4() {
26+
assertThat(new Solution().isMatch("adceb", "*a*b"), equalTo(true));
27+
}
28+
29+
@Test
30+
void isMatch5() {
31+
assertThat(new Solution().isMatch("acdcb", "a*c?b"), equalTo(false));
1732
}
1833
}

src/test/java/g0001_0100/s0065_valid_number/SolutionTest.java

Lines changed: 46 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,51 @@
88
class SolutionTest {
99
@Test
1010
void isNumber() {
11-
Solution solution = new Solution();
12-
assertThat(solution.isNumber("0"), equalTo(true));
13-
assertThat(solution.isNumber("e"), equalTo(false));
14-
assertThat(solution.isNumber("."), equalTo(false));
15-
assertThat(solution.isNumber(".1"), equalTo(true));
16-
assertThat(solution.isNumber("+.1"), equalTo(true));
17-
assertThat(solution.isNumber("-.1"), equalTo(true));
18-
assertThat(solution.isNumber("++.1"), equalTo(false));
19-
assertThat(solution.isNumber("1e1"), equalTo(true));
20-
assertThat(solution.isNumber("1E1"), equalTo(true));
21-
assertThat(solution.isNumber("1.1E1"), equalTo(true));
11+
assertThat(new Solution().isNumber("0"), equalTo(true));
12+
}
13+
14+
@Test
15+
void isNumber2() {
16+
assertThat(new Solution().isNumber("e"), equalTo(false));
17+
}
18+
19+
@Test
20+
void isNumber3() {
21+
assertThat(new Solution().isNumber("."), equalTo(false));
22+
}
23+
24+
@Test
25+
void isNumber4() {
26+
assertThat(new Solution().isNumber(".1"), equalTo(true));
27+
}
28+
29+
@Test
30+
void isNumber5() {
31+
assertThat(new Solution().isNumber("+.1"), equalTo(true));
32+
}
33+
34+
@Test
35+
void isNumber6() {
36+
assertThat(new Solution().isNumber("-.1"), equalTo(true));
37+
}
38+
39+
@Test
40+
void isNumber7() {
41+
assertThat(new Solution().isNumber("++.1"), equalTo(false));
42+
}
43+
44+
@Test
45+
void isNumber8() {
46+
assertThat(new Solution().isNumber("1e1"), equalTo(true));
47+
}
48+
49+
@Test
50+
void isNumber9() {
51+
assertThat(new Solution().isNumber("1E1"), equalTo(true));
52+
}
53+
54+
@Test
55+
void isNumber10() {
56+
assertThat(new Solution().isNumber("1.1E1"), equalTo(true));
2257
}
2358
}

src/test/java/g0001_0100/s0081_search_in_rotated_sorted_array_ii/SolutionTest.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,11 @@
88
class SolutionTest {
99
@Test
1010
void search() {
11-
Solution solution = new Solution();
12-
assertThat(solution.search(new int[] {2, 5, 6, 0, 0, 1, 2}, 0), equalTo(true));
13-
assertThat(solution.search(new int[] {2, 5, 6, 0, 0, 1, 2}, 3), equalTo(false));
11+
assertThat(new Solution().search(new int[] {2, 5, 6, 0, 0, 1, 2}, 0), equalTo(true));
12+
}
13+
14+
@Test
15+
void search2() {
16+
assertThat(new Solution().search(new int[] {2, 5, 6, 0, 0, 1, 2}, 3), equalTo(false));
1417
}
1518
}

0 commit comments

Comments
 (0)