Created
June 15, 2019 11:57
-
-
Save theapache64/489de40fbfec80fd89bfab0d3c7c38f5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object Calculator { | |
fun divide(a: Int, b: Int): Int { | |
return a / b | |
} | |
} | |
@RunWith(Parameterized::class) | |
class ParameterizedTest( | |
private val num1: Int, | |
private val num2: Int, | |
private val result: Int | |
) { | |
@Test | |
fun divideTest() { | |
println("$num1/$num2=$result") | |
assertEquals(Calculator.divide(num1, num2), result) | |
} | |
companion object { | |
@JvmStatic | |
@Parameterized.Parameters | |
fun testData(): Array<Array<Any>> { | |
return arrayOf<Array<Any>>( | |
arrayOf(10, 2, 5), | |
arrayOf(8, 4, 2), | |
arrayOf(100, 5, 20) | |
) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment