Skip to content

Commit 2c0222f

Browse files
committed
Added tests
1 parent ad56c13 commit 2c0222f

File tree

2 files changed

+27
-0
lines changed
  • src/test/kotlin/g3501_3600

2 files changed

+27
-0
lines changed

src/test/kotlin/g3501_3600/s3508_implement_router/RouterTest.kt

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,26 @@ internal class RouterTest {
4545
// Return [] and remove it from router.
4646
assertThat<IntArray>(router.forwardPacket(), equalTo<IntArray>(intArrayOf()))
4747
}
48+
49+
@Test
50+
fun router3() {
51+
// Initialize Router with memoryLimit of 3.
52+
val router = Router(3)
53+
// Packet is added. Return True.
54+
assertThat(router.addPacket(1, 4, 6), equalTo(true))
55+
// The only packet with destination 0 and timestamp in the inclusive range
56+
assertThat(router.getCount(4, 1, 4), equalTo(0))
57+
}
58+
59+
@Test
60+
fun router4() {
61+
// Initialize Router with memoryLimit of 2.
62+
val router = Router(2)
63+
// Packet is added. Return True.
64+
assertThat(router.addPacket(2, 5, 1), equalTo(true))
65+
// Return [2, 5, 1] and remove it from router.
66+
assertThat(router.forwardPacket(), equalTo(intArrayOf(2, 5, 1)))
67+
// The only packet with destination 0 and timestamp in the inclusive range
68+
assertThat(router.getCount(5, 1, 1), equalTo(0))
69+
}
4870
}

src/test/kotlin/g3501_3600/s3509_maximum_product_of_subsequences_with_an_alternating_sum_equal_to_k/SolutionTest.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,9 @@ internal class SolutionTest {
2525
equalTo<Int>(9),
2626
)
2727
}
28+
29+
@Test
30+
fun maxProduct4() {
31+
assertThat(Solution().maxProduct(intArrayOf(12, 0, 9), 21, 20), equalTo(0))
32+
}
2833
}

0 commit comments

Comments
 (0)