All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jetbrains.spek.data_driven.namespace.kt Maven / Gradle / Ivy

The newest version!
package org.jetbrains.spek.data_driven

import org.jetbrains.spek.api.dsl.SpecBody
import org.jetbrains.spek.api.dsl.ActionBody
import org.jetbrains.spek.api.dsl.on as defaultOn


inline fun  SpecBody.on(description: String, vararg with: Data1, crossinline body: ActionBody.(i1: I1, e: Expected) -> Unit) {
    with.forEach {
        val (input, expected) = it
        defaultOn(description = description.format(input, expected)) {
            body(this, input, expected)
        }
    }
}

inline fun  SpecBody.on(description: String, vararg with: Data2, crossinline body: ActionBody.(i1: I1, i2: I2, e: Expected) -> Unit) {
    with.forEach {
        val (input1, input2, expected) = it
        defaultOn(description = description.format(input1, input2, expected)) {
            body(this, input1, input2, expected)
        }
    }
}

inline fun  SpecBody.on(description: String, vararg with: Data3, crossinline body: ActionBody.(i1: I1, i2: I2, i3: I3, e: Expected) -> Unit) {
    with.forEach {
        val (input1, input2, input3, expected) = it
        defaultOn(description = description.format(input1, input2, input3, expected)) {
            body(this, input1, input2, input3, expected)
        }
    }
}

data class Data1(val input1: I1, val expected: Expected)
data class Data2(val input1: I1, val input2: I2, val expected: Expected)
data class Data3(val input1: I1, val input2: I2, val input3: I3, val expected: Expected)
data class Data4(val input1: I1, val input2: I2, val input3: I3, val input4: T4, val expected: Expected)
data class Data5(val input1: I1, val input2: I2, val input3: I3, val input4: T4, val input5: T5, val expected: Expected)
data class Data6(val input1: I1, val input2: I2, val input3: I3, val input4: T4, val input5: T5, val input6: T6, val expected: Expected)
data class Data7(val input1: I1, val input2: I2, val input3: I3, val input4: T4, val input5: T5, val input6: T6, val input7: T7, val expected: Expected)
data class Data8(val input1: I1, val input2: I2, val input3: I3, val input4: T4, val input5: T5, val input6: T6, val input7: T7, val input9: T8, val expected: Expected)
data class Data9(val input1: I1, val input2: I2, val input3: I3, val input4: T4, val input5: T5, val input6: T6, val input7: T7, val input8: T8, val input9: T9, val expected: Expected)

inline fun  data(i1: I1, expected: E) = Data1(i1, expected = expected)
inline fun  data(i1: I1, i2: I2, expected: E) = Data2(i1, i2, expected = expected)
inline fun  data(i1: I1, i2: I2, i3: I3, expected: E) = Data3(i1, i2, i3, expected = expected)
inline fun  data(i1: I1, i2: I2, i3: I3, i4: I4, expected: E) = Data4(i1, i2, i3, i4, expected = expected)
inline fun  data(i1: I1, i2: I2, i3: I3, i4: I4, i5: I5, expected: E) = Data5(i1, i2, i3, i4, i5, expected = expected)
inline fun  data(i1: I1, i2: I2, i3: I3, i4: I4, i5: I5, i6: I6, expected: E) = Data6(i1, i2, i3, i4, i5, i6, expected = expected)
inline fun  data(i1: I1, i2: I2, i3: I3, i4: I4, i5: I5, i6: I6, i7: I7, expected: E) = Data7(i1, i2, i3, i4, i5, i6, i7, expected = expected)
inline fun  data(i1: I1, i2: I2, i3: I3, i4: I4, i5: I5, i6: I6, i7: I7, i8: I8, expected: E) = Data8(i1, i2, i3, i4, i5, i6, i7, i8, expected = expected)
inline fun  data(i1: I1, i2: I2, i3: I3, i4: I4, i5: I5, i6: I6, i7: I7, i8: I8, i9: I9, expected: E) = Data9(i1, i2, i3, i4, i5, i6, i7, i8, i9, expected = expected)




© 2015 - 2025 Weber Informatics LLC | Privacy Policy