Skip to content

Commit 0e6446f

Browse files
committed
Added tests
1 parent 0b892d3 commit 0e6446f

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

src/main/java/g3501_3600/s3510_minimum_pair_removal_to_sort_array_ii/Solution.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55

66
public class Solution {
77
private static class Segment {
8-
private int start;
9-
private int end;
8+
private final int start;
9+
private final int end;
1010
private Segment left;
1111
private Segment right;
1212
private int lIdx;

src/test/java/g3501_3600/s3508_implement_router/RouterTest.java

+22
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,26 @@ void router2() {
4040
// Return [] and remove it from router.
4141
assertThat(router.forwardPacket(), equalTo(new int[] {}));
4242
}
43+
44+
@Test
45+
void router3() {
46+
// Initialize Router with memoryLimit of 3.
47+
Router router = new Router(3);
48+
// Packet is added. Return True.
49+
assertThat(router.addPacket(1, 4, 6), equalTo(true));
50+
// The only packet with destination 0 and timestamp in the inclusive range
51+
assertThat(router.getCount(4, 1, 4), equalTo(0));
52+
}
53+
54+
@Test
55+
void router4() {
56+
// Initialize Router with memoryLimit of 2.
57+
Router router = new Router(2);
58+
// Packet is added. Return True.
59+
assertThat(router.addPacket(2, 5, 1), equalTo(true));
60+
// Return [2, 5, 1] and remove it from router.
61+
assertThat(router.forwardPacket(), equalTo(new int[] {2, 5, 1}));
62+
// The only packet with destination 0 and timestamp in the inclusive range
63+
assertThat(router.getCount(5, 1, 1), equalTo(0));
64+
}
4365
}

0 commit comments

Comments
 (0)