Skip to content

Commit 7850844

Browse files
committed
Better unit tests for Rational
1 parent c97abb6 commit 7850844

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

src/test/java/functional/RationalTest.kt

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,20 @@ class RationalTest {
77
@Test
88
fun testIntExtension() {
99
assertEquals(Rational(4, 1), 4.r())
10+
for (i in 1..100) {
11+
assertEquals(Rational(i, 1), i.r())
12+
}
1013
}
1114

12-
@Test fun testPairExtension() {
15+
@Test
16+
fun testPairExtension() {
1317
assertEquals(Rational(2, 3), Pair(2, 3).r())
18+
19+
for (l in 1..10) {
20+
for (r in 1..10) {
21+
val p = Pair(l, r)
22+
assertEquals(Rational(l, r), p.r())
23+
}
24+
}
1425
}
15-
}
26+
}

0 commit comments

Comments
 (0)