Skip to content

Commit

Permalink
Cover all primitive aryEq functions
Browse files Browse the repository at this point in the history
  • Loading branch information
TWiStErRob committed Apr 8, 2024
1 parent aa3f92b commit ebedfb9
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 2 deletions.
65 changes: 64 additions & 1 deletion tests/src/test/kotlin/test/AdditionalMatchersTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,77 @@ class AdditionalCaptorsTest : TestBase() {
}

@Test
fun testAryEqPrimitive() {
fun testAryEqBoolean() {
mock<Methods>().apply {
booleanArray(booleanArrayOf(true, false, true))
verify(this).booleanArray(aryEq(booleanArrayOf(true, false, true)))
verify(this, never()).booleanArray(aryEq(booleanArrayOf(true, false)))
}
}

@Test
fun testAryEqByte() {
mock<Methods>().apply {
byteArray(byteArrayOf(1, 2, 3))
verify(this).byteArray(aryEq(byteArrayOf(1, 2, 3)))
verify(this, never()).byteArray(aryEq(byteArrayOf(1, 2)))
}
}

@Test
fun testAryEqShort() {
mock<Methods>().apply {
shortArray(shortArrayOf(1, 2, 3))
verify(this).shortArray(aryEq(shortArrayOf(1, 2, 3)))
verify(this, never()).shortArray(aryEq(shortArrayOf(1, 2)))
}
}

@Test
fun testAryEqInt() {
mock<Methods>().apply {
intArray(intArrayOf(1, 2, 3))
verify(this).intArray(aryEq(intArrayOf(1, 2, 3)))
verify(this, never()).intArray(aryEq(intArrayOf(1, 2)))
}
}

@Test
fun testAryEqLong() {
mock<Methods>().apply {
longArray(longArrayOf(1, 2, 3))
verify(this).longArray(aryEq(longArrayOf(1, 2, 3)))
verify(this, never()).longArray(aryEq(longArrayOf(1, 2)))
}
}

@Test
fun testAryEqChar() {
mock<Methods>().apply {
charArray(charArrayOf('1', '2', '3'))
verify(this).charArray(aryEq(charArrayOf('1', '2', '3')))
verify(this, never()).charArray(aryEq(charArrayOf('1', '2')))
}
}

@Test
fun testAryEqFloat() {
mock<Methods>().apply {
floatArray(floatArrayOf(1f, 2f, 3.4f))
verify(this).floatArray(aryEq(floatArrayOf(1f, 2f, 3.4f)))
verify(this, never()).floatArray(aryEq(floatArrayOf(1f, 2f)))
}
}

@Test
fun testAryEqDouble() {
mock<Methods>().apply {
doubleArray(doubleArrayOf(1.0, 2.0, 3.4))
verify(this).doubleArray(aryEq(doubleArrayOf(1.0, 2.0, 3.4)))
verify(this, never()).doubleArray(aryEq(doubleArrayOf(1.0, 2.0)))
}
}

@Test
fun testAryEq() {
mock<Methods>().apply {
Expand Down
9 changes: 8 additions & 1 deletion tests/src/test/kotlin/test/Classes.kt
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ class Closed

interface Methods {

fun intArray(i: IntArray)
fun closed(c: Closed)
fun closedArray(a: Array<Closed>)
fun closedNullableArray(a: Array<Closed?>)
Expand All @@ -54,13 +53,21 @@ interface Methods {
fun closedSet(s: Set<Closed>)
fun string(s: String)
fun boolean(b: Boolean)
fun booleanArray(d: BooleanArray)
fun byte(b: Byte)
fun byteArray(b: ByteArray)
fun char(c: Char)
fun charArray(c: CharArray)
fun short(s: Short)
fun shortArray(s: ShortArray)
fun int(i: Int)
fun intArray(i: IntArray)
fun long(l: Long)
fun longArray(l: LongArray)
fun float(f: Float)
fun floatArray(f: FloatArray)
fun double(d: Double)
fun doubleArray(d: DoubleArray)
fun closedVararg(vararg c: Closed)
fun throwableClass(t: ThrowableClass)
fun nullableString(s: String?)
Expand Down

0 comments on commit ebedfb9

Please sign in to comment.