Skip to content

Instantly share code, notes, and snippets.

@theapache64
Created June 15, 2019 11:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save theapache64/489de40fbfec80fd89bfab0d3c7c38f5 to your computer and use it in GitHub Desktop.
Save theapache64/489de40fbfec80fd89bfab0d3c7c38f5 to your computer and use it in GitHub Desktop.
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