-
-
Notifications
You must be signed in to change notification settings - Fork 405
Expand file tree
/
Copy pathFactorialTest.kt
More file actions
36 lines (29 loc) · 792 Bytes
/
FactorialTest.kt
File metadata and controls
36 lines (29 loc) · 792 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package math
import math.getFactorial
import org.junit.Test
import java.security.InvalidParameterException
class FactorialTest {
@Test
fun testFactorialNormal() {
val input = 6L
val expectedFactorial = 720L
assert(getFactorial(input) == expectedFactorial)
}
@Test(expected = InvalidParameterException::class)
fun testFactorialOfNegativeNumber() {
val input = -1L
getFactorial(input)
}
@Test
fun testFactorialOfZero() {
val input = 0L
val expectedFactorial = 1L
assert(getFactorial(input) == expectedFactorial)
}
@Test
fun testFactorialOfHighValue() {
val input = 20000L
val expectedFactorial = 0L
assert(getFactorial(input) == expectedFactorial)
}
}