diff --git a/build.gradle.kts b/build.gradle.kts index e810bb9..23f27a5 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -7,20 +7,34 @@ buildscript { // and we want that it to apply the ch.tutteli conventions rootProject.version = "1.2.0" rootProject.group = "ch.tutteli.kbox" - rootProject.description = "A utility library for Kotlin " + rootProject.description = "A utility library for Kotlin" + extra.set("generationFolder", project.files("src/commonMain/generated/kotlin")) + extra.set("generationTestFolder", project.files("src/commonTest/generated/kotlin")) } +val generationFolder: ConfigurableFileCollection by extra +val generationTestFolder: ConfigurableFileCollection by extra + plugins { id("build-logic.published-kotlin-multiplatform") + id("code-generation.generate") alias(libs.plugins.detekt) alias(libs.plugins.nexus.publish) } + + kotlin { sourceSets { + commonMain { + kotlin.srcDir(generationFolder) + } + commonTest { + + kotlin.srcDir(generationTestFolder) dependencies { - implementation(libs.atrium.fluent.get().let { "${it.module}:${it.version}"}) { + implementation(libs.atrium.fluent.get().let { "${it.module}:${it.version}" }) { exclude(group = "ch.tutteli.kbox") } } diff --git a/gradle/build-logic/basics/src/main/kotlin/extensions.kt b/gradle/build-logic/basics/src/main/kotlin/extensions.kt index e15c144..6027a01 100644 --- a/gradle/build-logic/basics/src/main/kotlin/extensions.kt +++ b/gradle/build-logic/basics/src/main/kotlin/extensions.kt @@ -1,7 +1,7 @@ import org.gradle.api.DomainObjectCollection import org.gradle.kotlin.dsl.withType -// TODO check if already moved into own tegonal repo and fetch via gt +// TODO 1.5.0 check if already moved into own tegonal repo and fetch via gt // copied from com.github.vlsi.gradle.dsl.configureEach, using this instead so that we don't have to import inline fun DomainObjectCollection.configureEach(noinline configuration: S.() -> Unit) = withType().configureEach(configuration) diff --git a/gradle/buildLibs.versions.toml b/gradle/buildLibs.versions.toml index 8c657cd..ce662e2 100644 --- a/gradle/buildLibs.versions.toml +++ b/gradle/buildLibs.versions.toml @@ -1,8 +1,6 @@ [versions] dokka = "1.9.20" jacocoTool = "0.8.9" -# using the latest kbox version in the build-logic itself -kbox = "1.2.0" kotlin = "2.0.0" task-tree = "3.0.0" tutteli = "5.0.1" @@ -11,7 +9,6 @@ vlsi = "1.90" [libraries] dokka-plugin = { module = "org.jetbrains.dokka:org.jetbrains.dokka.gradle.plugin", version.ref = "dokka" } dokka-base = { module = "org.jetbrains.dokka:dokka-base", version.ref = "dokka" } -kbox = { module = "ch.tutteli.kbox:kbox", version.ref = "kbox" } kotlin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" } taskTree = { module = "com.dorongold.plugins:task-tree", version.ref = "task-tree" } diff --git a/gradle/code-generation/build.gradle.kts b/gradle/code-generation/build.gradle.kts new file mode 100644 index 0000000..da5264a --- /dev/null +++ b/gradle/code-generation/build.gradle.kts @@ -0,0 +1,7 @@ +plugins { + id("build-logic.kotlin-dsl-gradle-plugin") +} + +allprojects { + group = "ch.tutteli.kbox.code-generation" +} diff --git a/gradle/code-generation/settings.gradle.kts b/gradle/code-generation/settings.gradle.kts new file mode 100644 index 0000000..17daf09 --- /dev/null +++ b/gradle/code-generation/settings.gradle.kts @@ -0,0 +1,24 @@ +rootProject.name = "code-generation" + +pluginManagement { + includeBuild("../build-logic-conventions") +} + +dependencyResolutionManagement { + repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) + repositories { + gradlePluginPortal() + } + versionCatalogs { + create("libs") { + from(files("../libs.versions.toml")) + } + } + versionCatalogs { + create("buildLibs") { + from(files("../buildLibs.versions.toml")) + } + } +} + +enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS") diff --git a/gradle/code-generation/src/main/kotlin/code-generation.generate.gradle.kts b/gradle/code-generation/src/main/kotlin/code-generation.generate.gradle.kts new file mode 100644 index 0000000..041b7fa --- /dev/null +++ b/gradle/code-generation/src/main/kotlin/code-generation.generate.gradle.kts @@ -0,0 +1,331 @@ +import java.util.* + +val generationFolder: ConfigurableFileCollection by rootProject.extra +val generationTestFolder: ConfigurableFileCollection by rootProject.extra + +val packageName = "ch.tutteli.kbox" +val packageNameAsPath = packageName.replace('.', '/') + +fun dontModifyNotice(place: String) = + """ + |// -------------------------------------------------------------------------------------------------------------------- + |// automatically generated, don't modify here but in: + |// $place + |// -------------------------------------------------------------------------------------------------------------------- + | + """.trimMargin() + +val dontModifyNotice = dontModifyNotice("gradle/code-generation/src/main/kotlin/code-generation.generate.gradle.kts") + +fun createStringBuilder(packageName: String) = StringBuilder(dontModifyNotice) + .append("package ").append(packageName).append("\n\n") + +val numOfArgs = 9 + +fun getTupleName(numOfValues: Int) = when (numOfValues) { + 2 -> "Pair" + 3 -> "Triple" + else -> "Tuple$numOfValues" +} + +fun getArgName(numOfValues: Int, index: Int) = when (index) { + 1 -> if (numOfValues <= 3) "first" else "a$index" + 2 -> if (numOfValues <= 3) "second" else "a$index" + 3 -> if (numOfValues <= 3) "third" else "a$index" + else -> "a$index" +} + +val generate: TaskProvider = tasks.register("generate") { + doFirst { + val packageDir = File(generationFolder.asPath + "/" + packageNameAsPath) + val append = StringBuilder(dontModifyNotice) + .append("@file:Suppress(\"MethodOverloading\")\n") + .append("package ").append(packageName).append("\n\n") + + val glue = StringBuilder(dontModifyNotice) + .append("@file:Suppress(\"MethodOverloading\")\n") + .append("package ").append(packageName).append("\n\n") + + val map = createStringBuilder(packageName) + + (2..numOfArgs).forEach { upperNumber -> + val numbers = (1..upperNumber).toList() + val typeArgs = numbers.joinToString(", ") { "A$it" } + val constructorProperties = numbers.joinToString(",\n ") { "val a$it: A$it" } + val tupleName = getTupleName(upperNumber) + val tuple = createStringBuilder(packageName) + + // we don't create a Tuple2, and Tuple3 + if (upperNumber >= 4) { + tuple.append( + """ + |/** + | * Represents a simple data structure to hold $upperNumber values. + | * + | * @since 1.3.0 + | */ + |@Suppress("UndocumentedPublicProperty") + |data class $tupleName<$typeArgs>( + | $constructorProperties, + |) + """.trimMargin() + ) + tuple.appendLine() + + val tupleFile = packageDir.resolve("Tuple$upperNumber.kt") + tupleFile.writeText(tuple.toString()) + } + + + + (1..numOfArgs - upperNumber).forEach { upperNumber2 -> + val upperNumber3 = upperNumber + upperNumber2 + val numbers2 = (1..upperNumber2) + val numbers3 = (1..upperNumber3) + val typeArgs2 = numbers2.joinToString(", ") { "A${it + upperNumber}" } + val typeArgs3 = numbers3.joinToString(", ") { "A$it" } + + val toTupleName = getTupleName(upperNumber3) + val tupleNameParam = getTupleName(upperNumber2) + val tupleNameParamLowercase = tupleNameParam.lowercase() + + val params = numbers2.joinToString(", ") { "a${it + upperNumber}: A${it + upperNumber}" } + val args = numbers2.joinToString(", ") { "a${it + upperNumber}" } + val properties = numbers.joinToString(", ") { getArgName(upperNumber, it) } + + + append.append( + """ + |/** + |* Transforms this [$tupleName] into a [$toTupleName] by appending the given arguments. + |* + |* @since 1.3.0 + |*/${if (upperNumber2 >= 6) "\n@Suppress(\"LongParameterList\")" else ""} + |fun <$typeArgs3> $tupleName<$typeArgs>.append( + | $params + |): $toTupleName<$typeArgs3> = + | $toTupleName($properties, $args) + | + """.trimMargin() + ).appendLine() + + if (upperNumber2 > 1) { + val properties2 = numbers2.joinToString(", ") { + "$tupleNameParamLowercase.${getArgName(upperNumber2, it)}" + } + + glue.append( + """ + |/** + |* Glues the given [$tupleNameParamLowercase] to this [$tupleName] and thus results in a [$toTupleName]. + |* + |* You can also think of it as all values of the given [$tupleNameParamLowercase] are [$tupleName.append]ed to this [$tupleName]. + |* + |* @since 1.3.0 + |*/ + |fun <$typeArgs3> $tupleName<$typeArgs>.glue( + | $tupleNameParamLowercase: $tupleNameParam<$typeArgs2> + |): $toTupleName<$typeArgs3> = + | $toTupleName($properties, $properties2) + | + """.trimMargin() + ).appendLine() + } + } + + numbers.forEach { argNum -> + val modifiedTypeArgs = numbers.joinToString(", ") { "A$it" + if (it == argNum) "New" else "" } + val args = numbers.joinToString(", ") { arg -> + getArgName(upperNumber, arg).let { + if (arg == argNum) "transform($it)" else it + } + } + + val argNameToMap = getArgName(upperNumber, argNum) + val argNameCapitalized = argNameToMap.replaceFirstChar { + if (it.isLowerCase()) it.titlecase(Locale.getDefault()) else it.toString() + } + map.append( + """ + |/** + |* Maps [$tupleName.$argNameToMap] with the given [transform] function and returns a new [$tupleName]. + |* + |* @since 1.3.0 + |*/ + |fun <$typeArgs, A${argNum}New> $tupleName<$typeArgs>.map$argNameCapitalized( + | transform: (A$argNum) -> A${argNum}New + |): $tupleName<$modifiedTypeArgs> = + | $tupleName($args) + | + """.trimMargin() + ).appendLine() + } + } + + val appendFile = packageDir.resolve("tupleAppend.kt") + appendFile.writeText(append.toString()) + + val glueFile = packageDir.resolve("tupleGlue.kt") + glueFile.writeText(glue.toString()) + + val mapFile = packageDir.resolve("tupleMap.kt") + mapFile.writeText(map.toString()) + } +} +generationFolder.builtBy(generate) + +fun StringBuilder.appendTest(testName: String) = this.append( + """ + |import ch.tutteli.atrium.api.fluent.en_GB.* + |import ch.tutteli.atrium.api.verbs.expect + |import ch.tutteli.kbox.* + |import kotlin.test.Test + | + |class $testName { + | + """.trimMargin() +).appendLine() + +val generateTest: TaskProvider = tasks.register("generateTest") { + doFirst { + val packageDir = File(generationTestFolder.asPath + "/" + packageNameAsPath) + val argValues = sequenceOf( + "\"string\"", + "1", + "2L", + "3F", + "4.0", + "'c'", + "1.toShort()", + "2.toByte()", + "listOf(1, 2)", + ) + + (2..numOfArgs).forEach { upperNumber -> + val numbers = (1..upperNumber) + val tupleName = getTupleName(upperNumber) + val tupleCreation = """$tupleName(${argValues.take(upperNumber).joinToString(", ")})""" + + val mapTest = createStringBuilder("$packageName.map") + .appendTest("${tupleName}MapTest") + + val appendTest = createStringBuilder("$packageName.append") + .appendTest("${tupleName}AppendTest") + + val glueTest = createStringBuilder("$packageName.glue") + .appendTest("${tupleName}GlueTest") + + numbers.forEach { argNum -> + val argNameToMap = getArgName(upperNumber, argNum) + val argNameCapitalized = argNameToMap.replaceFirstChar { + if (it.isLowerCase()) it.titlecase(Locale.getDefault()) else it.toString() + } + listOf(1, 2, 3).withIndex() + + val vals = argValues.take(upperNumber).withIndex().joinToString("\n ") { (index, value) -> + "val a${index + 1} = listOf($value)" + } + val tupleListCreation = + """$tupleName(${numbers.joinToString(", ") { "a$it" }})""" + val tupleListResult = """$tupleName(${ + argValues.take(upperNumber).withIndex().joinToString(", ") { (index, value) -> + if (index + 1 == argNum) value else "a${index + 1}" + } + })""" + val checkInstances = numbers.filter { it != argNum }.joinToString("\n ") { + """ + |feature { f(it::${getArgName(upperNumber, it)}) }.toBeTheInstance(a${it}) + """.trimMargin() + } + mapTest.append( + """ + | @Test + | fun map${argNameCapitalized}__identity__returns_equal_$tupleName() { + | expect( + | $tupleCreation + | .map${argNameCapitalized}(::identity) + | ).toEqual( + | $tupleCreation + | ) + | } + | + | @Test + | fun map${argNameCapitalized}__transformation_does_not_touch_other_properties() { + | $vals + | expect( + | $tupleListCreation + | .map${argNameCapitalized} { it.first() } + | ) { + | toEqual($tupleListResult) + | $checkInstances + | } + | } + """.trimMargin() + ).appendLine().appendLine() + } + + (1..numOfArgs - upperNumber).forEach { upperNumber2 -> + val upperNumber3 = upperNumber + upperNumber2 + val toTupleName = getTupleName(upperNumber3) + + val toTupleNameCreation = """$toTupleName(${argValues.take(upperNumber3).joinToString(", ")})""" + + appendTest.append( + """ + | @Test + | fun append_${upperNumber2}_values__results_in_a_$toTupleName() { + | expect( + | $tupleCreation + | .append(${argValues.drop(upperNumber).take(upperNumber2).joinToString(", ")}) + | ).toEqual( + | $toTupleNameCreation + | ) + | } + """.trimMargin() + ).appendLine().appendLine() + + if (upperNumber2 > 1) { + val tupleNameParam = getTupleName(upperNumber2) + val tupleNameParamCreation = + """$tupleNameParam(${argValues.drop(upperNumber).take(upperNumber2).joinToString(", ")})""" + + glueTest.append( + """ + | @Test + | fun glue_${tupleNameParam}__results_in_a_$toTupleName() { + | expect( + | $tupleCreation + | .glue($tupleNameParamCreation) + | ).toEqual( + | $toTupleNameCreation + | ) + | } + """.trimMargin() + ).appendLine().appendLine() + } + + } + + mapTest.append("}") + val mapTestFile = packageDir.resolve("map/${tupleName}MapTest.kt") + mapTestFile.writeText(mapTest.toString()) + + + //cannot append to tuple of max arity + if (upperNumber < numOfArgs) { + appendTest.append("}") + val appendTestFile = packageDir.resolve("append/${tupleName}AppendTest.kt") + appendTestFile.writeText(appendTest.toString()) + } + + //cannot glue to tuple of max arity with another, same same for tuple of max arity -1 + if (upperNumber < numOfArgs - 1) { + glueTest.append("}") + val glueTestFile = packageDir.resolve("glue/${tupleName}GlueTest.kt") + glueTestFile.writeText(glueTest.toString()) + } + } + } +} +generationTestFolder.builtBy(generateTest) + diff --git a/settings.gradle.kts b/settings.gradle.kts index 413ae8e..a41d217 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -5,6 +5,7 @@ pluginManagement { } includeBuild("gradle/build-logic") includeBuild("gradle/build-logic-conventions") + includeBuild("gradle/code-generation") } dependencyResolutionManagement { diff --git a/src/commonMain/generated/kotlin/ch/tutteli/kbox/Tuple4.kt b/src/commonMain/generated/kotlin/ch/tutteli/kbox/Tuple4.kt new file mode 100644 index 0000000..19ad0c9 --- /dev/null +++ b/src/commonMain/generated/kotlin/ch/tutteli/kbox/Tuple4.kt @@ -0,0 +1,18 @@ +// -------------------------------------------------------------------------------------------------------------------- +// automatically generated, don't modify here but in: +// gradle/code-generation/src/main/kotlin/code-generation.generate.gradle.kts +// -------------------------------------------------------------------------------------------------------------------- +package ch.tutteli.kbox + +/** + * Represents a simple data structure to hold 4 values. + * + * @since 1.3.0 + */ +@Suppress("UndocumentedPublicProperty") +data class Tuple4( + val a1: A1, + val a2: A2, + val a3: A3, + val a4: A4, +) diff --git a/src/commonMain/generated/kotlin/ch/tutteli/kbox/Tuple5.kt b/src/commonMain/generated/kotlin/ch/tutteli/kbox/Tuple5.kt new file mode 100644 index 0000000..6bf62a7 --- /dev/null +++ b/src/commonMain/generated/kotlin/ch/tutteli/kbox/Tuple5.kt @@ -0,0 +1,19 @@ +// -------------------------------------------------------------------------------------------------------------------- +// automatically generated, don't modify here but in: +// gradle/code-generation/src/main/kotlin/code-generation.generate.gradle.kts +// -------------------------------------------------------------------------------------------------------------------- +package ch.tutteli.kbox + +/** + * Represents a simple data structure to hold 5 values. + * + * @since 1.3.0 + */ +@Suppress("UndocumentedPublicProperty") +data class Tuple5( + val a1: A1, + val a2: A2, + val a3: A3, + val a4: A4, + val a5: A5, +) diff --git a/src/commonMain/generated/kotlin/ch/tutteli/kbox/Tuple6.kt b/src/commonMain/generated/kotlin/ch/tutteli/kbox/Tuple6.kt new file mode 100644 index 0000000..ac37d0c --- /dev/null +++ b/src/commonMain/generated/kotlin/ch/tutteli/kbox/Tuple6.kt @@ -0,0 +1,20 @@ +// -------------------------------------------------------------------------------------------------------------------- +// automatically generated, don't modify here but in: +// gradle/code-generation/src/main/kotlin/code-generation.generate.gradle.kts +// -------------------------------------------------------------------------------------------------------------------- +package ch.tutteli.kbox + +/** + * Represents a simple data structure to hold 6 values. + * + * @since 1.3.0 + */ +@Suppress("UndocumentedPublicProperty") +data class Tuple6( + val a1: A1, + val a2: A2, + val a3: A3, + val a4: A4, + val a5: A5, + val a6: A6, +) diff --git a/src/commonMain/generated/kotlin/ch/tutteli/kbox/Tuple7.kt b/src/commonMain/generated/kotlin/ch/tutteli/kbox/Tuple7.kt new file mode 100644 index 0000000..cc08867 --- /dev/null +++ b/src/commonMain/generated/kotlin/ch/tutteli/kbox/Tuple7.kt @@ -0,0 +1,21 @@ +// -------------------------------------------------------------------------------------------------------------------- +// automatically generated, don't modify here but in: +// gradle/code-generation/src/main/kotlin/code-generation.generate.gradle.kts +// -------------------------------------------------------------------------------------------------------------------- +package ch.tutteli.kbox + +/** + * Represents a simple data structure to hold 7 values. + * + * @since 1.3.0 + */ +@Suppress("UndocumentedPublicProperty") +data class Tuple7( + val a1: A1, + val a2: A2, + val a3: A3, + val a4: A4, + val a5: A5, + val a6: A6, + val a7: A7, +) diff --git a/src/commonMain/generated/kotlin/ch/tutteli/kbox/Tuple8.kt b/src/commonMain/generated/kotlin/ch/tutteli/kbox/Tuple8.kt new file mode 100644 index 0000000..c06ce44 --- /dev/null +++ b/src/commonMain/generated/kotlin/ch/tutteli/kbox/Tuple8.kt @@ -0,0 +1,22 @@ +// -------------------------------------------------------------------------------------------------------------------- +// automatically generated, don't modify here but in: +// gradle/code-generation/src/main/kotlin/code-generation.generate.gradle.kts +// -------------------------------------------------------------------------------------------------------------------- +package ch.tutteli.kbox + +/** + * Represents a simple data structure to hold 8 values. + * + * @since 1.3.0 + */ +@Suppress("UndocumentedPublicProperty") +data class Tuple8( + val a1: A1, + val a2: A2, + val a3: A3, + val a4: A4, + val a5: A5, + val a6: A6, + val a7: A7, + val a8: A8, +) diff --git a/src/commonMain/generated/kotlin/ch/tutteli/kbox/Tuple9.kt b/src/commonMain/generated/kotlin/ch/tutteli/kbox/Tuple9.kt new file mode 100644 index 0000000..5953d1f --- /dev/null +++ b/src/commonMain/generated/kotlin/ch/tutteli/kbox/Tuple9.kt @@ -0,0 +1,23 @@ +// -------------------------------------------------------------------------------------------------------------------- +// automatically generated, don't modify here but in: +// gradle/code-generation/src/main/kotlin/code-generation.generate.gradle.kts +// -------------------------------------------------------------------------------------------------------------------- +package ch.tutteli.kbox + +/** + * Represents a simple data structure to hold 9 values. + * + * @since 1.3.0 + */ +@Suppress("UndocumentedPublicProperty") +data class Tuple9( + val a1: A1, + val a2: A2, + val a3: A3, + val a4: A4, + val a5: A5, + val a6: A6, + val a7: A7, + val a8: A8, + val a9: A9, +) diff --git a/src/commonMain/generated/kotlin/ch/tutteli/kbox/tupleAppend.kt b/src/commonMain/generated/kotlin/ch/tutteli/kbox/tupleAppend.kt new file mode 100644 index 0000000..fbb7ce7 --- /dev/null +++ b/src/commonMain/generated/kotlin/ch/tutteli/kbox/tupleAppend.kt @@ -0,0 +1,290 @@ +// -------------------------------------------------------------------------------------------------------------------- +// automatically generated, don't modify here but in: +// gradle/code-generation/src/main/kotlin/code-generation.generate.gradle.kts +// -------------------------------------------------------------------------------------------------------------------- +@file:Suppress("MethodOverloading") +package ch.tutteli.kbox + +/** +* Transforms this [Pair] into a [Triple] by appending the given arguments. +* +* @since 1.3.0 +*/ +fun Pair.append( + a3: A3 +): Triple = + Triple(first, second, a3) + +/** +* Transforms this [Pair] into a [Tuple4] by appending the given arguments. +* +* @since 1.3.0 +*/ +fun Pair.append( + a3: A3, a4: A4 +): Tuple4 = + Tuple4(first, second, a3, a4) + +/** +* Transforms this [Pair] into a [Tuple5] by appending the given arguments. +* +* @since 1.3.0 +*/ +fun Pair.append( + a3: A3, a4: A4, a5: A5 +): Tuple5 = + Tuple5(first, second, a3, a4, a5) + +/** +* Transforms this [Pair] into a [Tuple6] by appending the given arguments. +* +* @since 1.3.0 +*/ +fun Pair.append( + a3: A3, a4: A4, a5: A5, a6: A6 +): Tuple6 = + Tuple6(first, second, a3, a4, a5, a6) + +/** +* Transforms this [Pair] into a [Tuple7] by appending the given arguments. +* +* @since 1.3.0 +*/ +fun Pair.append( + a3: A3, a4: A4, a5: A5, a6: A6, a7: A7 +): Tuple7 = + Tuple7(first, second, a3, a4, a5, a6, a7) + +/** +* Transforms this [Pair] into a [Tuple8] by appending the given arguments. +* +* @since 1.3.0 +*/ +@Suppress("LongParameterList") +fun Pair.append( + a3: A3, a4: A4, a5: A5, a6: A6, a7: A7, a8: A8 +): Tuple8 = + Tuple8(first, second, a3, a4, a5, a6, a7, a8) + +/** +* Transforms this [Pair] into a [Tuple9] by appending the given arguments. +* +* @since 1.3.0 +*/ +@Suppress("LongParameterList") +fun Pair.append( + a3: A3, a4: A4, a5: A5, a6: A6, a7: A7, a8: A8, a9: A9 +): Tuple9 = + Tuple9(first, second, a3, a4, a5, a6, a7, a8, a9) + +/** +* Transforms this [Triple] into a [Tuple4] by appending the given arguments. +* +* @since 1.3.0 +*/ +fun Triple.append( + a4: A4 +): Tuple4 = + Tuple4(first, second, third, a4) + +/** +* Transforms this [Triple] into a [Tuple5] by appending the given arguments. +* +* @since 1.3.0 +*/ +fun Triple.append( + a4: A4, a5: A5 +): Tuple5 = + Tuple5(first, second, third, a4, a5) + +/** +* Transforms this [Triple] into a [Tuple6] by appending the given arguments. +* +* @since 1.3.0 +*/ +fun Triple.append( + a4: A4, a5: A5, a6: A6 +): Tuple6 = + Tuple6(first, second, third, a4, a5, a6) + +/** +* Transforms this [Triple] into a [Tuple7] by appending the given arguments. +* +* @since 1.3.0 +*/ +fun Triple.append( + a4: A4, a5: A5, a6: A6, a7: A7 +): Tuple7 = + Tuple7(first, second, third, a4, a5, a6, a7) + +/** +* Transforms this [Triple] into a [Tuple8] by appending the given arguments. +* +* @since 1.3.0 +*/ +fun Triple.append( + a4: A4, a5: A5, a6: A6, a7: A7, a8: A8 +): Tuple8 = + Tuple8(first, second, third, a4, a5, a6, a7, a8) + +/** +* Transforms this [Triple] into a [Tuple9] by appending the given arguments. +* +* @since 1.3.0 +*/ +@Suppress("LongParameterList") +fun Triple.append( + a4: A4, a5: A5, a6: A6, a7: A7, a8: A8, a9: A9 +): Tuple9 = + Tuple9(first, second, third, a4, a5, a6, a7, a8, a9) + +/** +* Transforms this [Tuple4] into a [Tuple5] by appending the given arguments. +* +* @since 1.3.0 +*/ +fun Tuple4.append( + a5: A5 +): Tuple5 = + Tuple5(a1, a2, a3, a4, a5) + +/** +* Transforms this [Tuple4] into a [Tuple6] by appending the given arguments. +* +* @since 1.3.0 +*/ +fun Tuple4.append( + a5: A5, a6: A6 +): Tuple6 = + Tuple6(a1, a2, a3, a4, a5, a6) + +/** +* Transforms this [Tuple4] into a [Tuple7] by appending the given arguments. +* +* @since 1.3.0 +*/ +fun Tuple4.append( + a5: A5, a6: A6, a7: A7 +): Tuple7 = + Tuple7(a1, a2, a3, a4, a5, a6, a7) + +/** +* Transforms this [Tuple4] into a [Tuple8] by appending the given arguments. +* +* @since 1.3.0 +*/ +fun Tuple4.append( + a5: A5, a6: A6, a7: A7, a8: A8 +): Tuple8 = + Tuple8(a1, a2, a3, a4, a5, a6, a7, a8) + +/** +* Transforms this [Tuple4] into a [Tuple9] by appending the given arguments. +* +* @since 1.3.0 +*/ +fun Tuple4.append( + a5: A5, a6: A6, a7: A7, a8: A8, a9: A9 +): Tuple9 = + Tuple9(a1, a2, a3, a4, a5, a6, a7, a8, a9) + +/** +* Transforms this [Tuple5] into a [Tuple6] by appending the given arguments. +* +* @since 1.3.0 +*/ +fun Tuple5.append( + a6: A6 +): Tuple6 = + Tuple6(a1, a2, a3, a4, a5, a6) + +/** +* Transforms this [Tuple5] into a [Tuple7] by appending the given arguments. +* +* @since 1.3.0 +*/ +fun Tuple5.append( + a6: A6, a7: A7 +): Tuple7 = + Tuple7(a1, a2, a3, a4, a5, a6, a7) + +/** +* Transforms this [Tuple5] into a [Tuple8] by appending the given arguments. +* +* @since 1.3.0 +*/ +fun Tuple5.append( + a6: A6, a7: A7, a8: A8 +): Tuple8 = + Tuple8(a1, a2, a3, a4, a5, a6, a7, a8) + +/** +* Transforms this [Tuple5] into a [Tuple9] by appending the given arguments. +* +* @since 1.3.0 +*/ +fun Tuple5.append( + a6: A6, a7: A7, a8: A8, a9: A9 +): Tuple9 = + Tuple9(a1, a2, a3, a4, a5, a6, a7, a8, a9) + +/** +* Transforms this [Tuple6] into a [Tuple7] by appending the given arguments. +* +* @since 1.3.0 +*/ +fun Tuple6.append( + a7: A7 +): Tuple7 = + Tuple7(a1, a2, a3, a4, a5, a6, a7) + +/** +* Transforms this [Tuple6] into a [Tuple8] by appending the given arguments. +* +* @since 1.3.0 +*/ +fun Tuple6.append( + a7: A7, a8: A8 +): Tuple8 = + Tuple8(a1, a2, a3, a4, a5, a6, a7, a8) + +/** +* Transforms this [Tuple6] into a [Tuple9] by appending the given arguments. +* +* @since 1.3.0 +*/ +fun Tuple6.append( + a7: A7, a8: A8, a9: A9 +): Tuple9 = + Tuple9(a1, a2, a3, a4, a5, a6, a7, a8, a9) + +/** +* Transforms this [Tuple7] into a [Tuple8] by appending the given arguments. +* +* @since 1.3.0 +*/ +fun Tuple7.append( + a8: A8 +): Tuple8 = + Tuple8(a1, a2, a3, a4, a5, a6, a7, a8) + +/** +* Transforms this [Tuple7] into a [Tuple9] by appending the given arguments. +* +* @since 1.3.0 +*/ +fun Tuple7.append( + a8: A8, a9: A9 +): Tuple9 = + Tuple9(a1, a2, a3, a4, a5, a6, a7, a8, a9) + +/** +* Transforms this [Tuple8] into a [Tuple9] by appending the given arguments. +* +* @since 1.3.0 +*/ +fun Tuple8.append( + a9: A9 +): Tuple9 = + Tuple9(a1, a2, a3, a4, a5, a6, a7, a8, a9) + diff --git a/src/commonMain/generated/kotlin/ch/tutteli/kbox/tupleGlue.kt b/src/commonMain/generated/kotlin/ch/tutteli/kbox/tupleGlue.kt new file mode 100644 index 0000000..5ff4c1e --- /dev/null +++ b/src/commonMain/generated/kotlin/ch/tutteli/kbox/tupleGlue.kt @@ -0,0 +1,259 @@ +// -------------------------------------------------------------------------------------------------------------------- +// automatically generated, don't modify here but in: +// gradle/code-generation/src/main/kotlin/code-generation.generate.gradle.kts +// -------------------------------------------------------------------------------------------------------------------- +@file:Suppress("MethodOverloading") +package ch.tutteli.kbox + +/** +* Glues the given [pair] to this [Pair] and thus results in a [Tuple4]. +* +* You can also think of it as all values of the given [pair] are [Pair.append]ed to this [Pair]. +* +* @since 1.3.0 +*/ +fun Pair.glue( + pair: Pair +): Tuple4 = + Tuple4(first, second, pair.first, pair.second) + +/** +* Glues the given [triple] to this [Pair] and thus results in a [Tuple5]. +* +* You can also think of it as all values of the given [triple] are [Pair.append]ed to this [Pair]. +* +* @since 1.3.0 +*/ +fun Pair.glue( + triple: Triple +): Tuple5 = + Tuple5(first, second, triple.first, triple.second, triple.third) + +/** +* Glues the given [tuple4] to this [Pair] and thus results in a [Tuple6]. +* +* You can also think of it as all values of the given [tuple4] are [Pair.append]ed to this [Pair]. +* +* @since 1.3.0 +*/ +fun Pair.glue( + tuple4: Tuple4 +): Tuple6 = + Tuple6(first, second, tuple4.a1, tuple4.a2, tuple4.a3, tuple4.a4) + +/** +* Glues the given [tuple5] to this [Pair] and thus results in a [Tuple7]. +* +* You can also think of it as all values of the given [tuple5] are [Pair.append]ed to this [Pair]. +* +* @since 1.3.0 +*/ +fun Pair.glue( + tuple5: Tuple5 +): Tuple7 = + Tuple7(first, second, tuple5.a1, tuple5.a2, tuple5.a3, tuple5.a4, tuple5.a5) + +/** +* Glues the given [tuple6] to this [Pair] and thus results in a [Tuple8]. +* +* You can also think of it as all values of the given [tuple6] are [Pair.append]ed to this [Pair]. +* +* @since 1.3.0 +*/ +fun Pair.glue( + tuple6: Tuple6 +): Tuple8 = + Tuple8(first, second, tuple6.a1, tuple6.a2, tuple6.a3, tuple6.a4, tuple6.a5, tuple6.a6) + +/** +* Glues the given [tuple7] to this [Pair] and thus results in a [Tuple9]. +* +* You can also think of it as all values of the given [tuple7] are [Pair.append]ed to this [Pair]. +* +* @since 1.3.0 +*/ +fun Pair.glue( + tuple7: Tuple7 +): Tuple9 = + Tuple9(first, second, tuple7.a1, tuple7.a2, tuple7.a3, tuple7.a4, tuple7.a5, tuple7.a6, tuple7.a7) + +/** +* Glues the given [pair] to this [Triple] and thus results in a [Tuple5]. +* +* You can also think of it as all values of the given [pair] are [Triple.append]ed to this [Triple]. +* +* @since 1.3.0 +*/ +fun Triple.glue( + pair: Pair +): Tuple5 = + Tuple5(first, second, third, pair.first, pair.second) + +/** +* Glues the given [triple] to this [Triple] and thus results in a [Tuple6]. +* +* You can also think of it as all values of the given [triple] are [Triple.append]ed to this [Triple]. +* +* @since 1.3.0 +*/ +fun Triple.glue( + triple: Triple +): Tuple6 = + Tuple6(first, second, third, triple.first, triple.second, triple.third) + +/** +* Glues the given [tuple4] to this [Triple] and thus results in a [Tuple7]. +* +* You can also think of it as all values of the given [tuple4] are [Triple.append]ed to this [Triple]. +* +* @since 1.3.0 +*/ +fun Triple.glue( + tuple4: Tuple4 +): Tuple7 = + Tuple7(first, second, third, tuple4.a1, tuple4.a2, tuple4.a3, tuple4.a4) + +/** +* Glues the given [tuple5] to this [Triple] and thus results in a [Tuple8]. +* +* You can also think of it as all values of the given [tuple5] are [Triple.append]ed to this [Triple]. +* +* @since 1.3.0 +*/ +fun Triple.glue( + tuple5: Tuple5 +): Tuple8 = + Tuple8(first, second, third, tuple5.a1, tuple5.a2, tuple5.a3, tuple5.a4, tuple5.a5) + +/** +* Glues the given [tuple6] to this [Triple] and thus results in a [Tuple9]. +* +* You can also think of it as all values of the given [tuple6] are [Triple.append]ed to this [Triple]. +* +* @since 1.3.0 +*/ +fun Triple.glue( + tuple6: Tuple6 +): Tuple9 = + Tuple9(first, second, third, tuple6.a1, tuple6.a2, tuple6.a3, tuple6.a4, tuple6.a5, tuple6.a6) + +/** +* Glues the given [pair] to this [Tuple4] and thus results in a [Tuple6]. +* +* You can also think of it as all values of the given [pair] are [Tuple4.append]ed to this [Tuple4]. +* +* @since 1.3.0 +*/ +fun Tuple4.glue( + pair: Pair +): Tuple6 = + Tuple6(a1, a2, a3, a4, pair.first, pair.second) + +/** +* Glues the given [triple] to this [Tuple4] and thus results in a [Tuple7]. +* +* You can also think of it as all values of the given [triple] are [Tuple4.append]ed to this [Tuple4]. +* +* @since 1.3.0 +*/ +fun Tuple4.glue( + triple: Triple +): Tuple7 = + Tuple7(a1, a2, a3, a4, triple.first, triple.second, triple.third) + +/** +* Glues the given [tuple4] to this [Tuple4] and thus results in a [Tuple8]. +* +* You can also think of it as all values of the given [tuple4] are [Tuple4.append]ed to this [Tuple4]. +* +* @since 1.3.0 +*/ +fun Tuple4.glue( + tuple4: Tuple4 +): Tuple8 = + Tuple8(a1, a2, a3, a4, tuple4.a1, tuple4.a2, tuple4.a3, tuple4.a4) + +/** +* Glues the given [tuple5] to this [Tuple4] and thus results in a [Tuple9]. +* +* You can also think of it as all values of the given [tuple5] are [Tuple4.append]ed to this [Tuple4]. +* +* @since 1.3.0 +*/ +fun Tuple4.glue( + tuple5: Tuple5 +): Tuple9 = + Tuple9(a1, a2, a3, a4, tuple5.a1, tuple5.a2, tuple5.a3, tuple5.a4, tuple5.a5) + +/** +* Glues the given [pair] to this [Tuple5] and thus results in a [Tuple7]. +* +* You can also think of it as all values of the given [pair] are [Tuple5.append]ed to this [Tuple5]. +* +* @since 1.3.0 +*/ +fun Tuple5.glue( + pair: Pair +): Tuple7 = + Tuple7(a1, a2, a3, a4, a5, pair.first, pair.second) + +/** +* Glues the given [triple] to this [Tuple5] and thus results in a [Tuple8]. +* +* You can also think of it as all values of the given [triple] are [Tuple5.append]ed to this [Tuple5]. +* +* @since 1.3.0 +*/ +fun Tuple5.glue( + triple: Triple +): Tuple8 = + Tuple8(a1, a2, a3, a4, a5, triple.first, triple.second, triple.third) + +/** +* Glues the given [tuple4] to this [Tuple5] and thus results in a [Tuple9]. +* +* You can also think of it as all values of the given [tuple4] are [Tuple5.append]ed to this [Tuple5]. +* +* @since 1.3.0 +*/ +fun Tuple5.glue( + tuple4: Tuple4 +): Tuple9 = + Tuple9(a1, a2, a3, a4, a5, tuple4.a1, tuple4.a2, tuple4.a3, tuple4.a4) + +/** +* Glues the given [pair] to this [Tuple6] and thus results in a [Tuple8]. +* +* You can also think of it as all values of the given [pair] are [Tuple6.append]ed to this [Tuple6]. +* +* @since 1.3.0 +*/ +fun Tuple6.glue( + pair: Pair +): Tuple8 = + Tuple8(a1, a2, a3, a4, a5, a6, pair.first, pair.second) + +/** +* Glues the given [triple] to this [Tuple6] and thus results in a [Tuple9]. +* +* You can also think of it as all values of the given [triple] are [Tuple6.append]ed to this [Tuple6]. +* +* @since 1.3.0 +*/ +fun Tuple6.glue( + triple: Triple +): Tuple9 = + Tuple9(a1, a2, a3, a4, a5, a6, triple.first, triple.second, triple.third) + +/** +* Glues the given [pair] to this [Tuple7] and thus results in a [Tuple9]. +* +* You can also think of it as all values of the given [pair] are [Tuple7.append]ed to this [Tuple7]. +* +* @since 1.3.0 +*/ +fun Tuple7.glue( + pair: Pair +): Tuple9 = + Tuple9(a1, a2, a3, a4, a5, a6, a7, pair.first, pair.second) + diff --git a/src/commonMain/generated/kotlin/ch/tutteli/kbox/tupleMap.kt b/src/commonMain/generated/kotlin/ch/tutteli/kbox/tupleMap.kt new file mode 100644 index 0000000..c936a73 --- /dev/null +++ b/src/commonMain/generated/kotlin/ch/tutteli/kbox/tupleMap.kt @@ -0,0 +1,446 @@ +// -------------------------------------------------------------------------------------------------------------------- +// automatically generated, don't modify here but in: +// gradle/code-generation/src/main/kotlin/code-generation.generate.gradle.kts +// -------------------------------------------------------------------------------------------------------------------- +package ch.tutteli.kbox + +/** +* Maps [Pair.first] with the given [transform] function and returns a new [Pair]. +* +* @since 1.3.0 +*/ +fun Pair.mapFirst( + transform: (A1) -> A1New +): Pair = + Pair(transform(first), second) + +/** +* Maps [Pair.second] with the given [transform] function and returns a new [Pair]. +* +* @since 1.3.0 +*/ +fun Pair.mapSecond( + transform: (A2) -> A2New +): Pair = + Pair(first, transform(second)) + +/** +* Maps [Triple.first] with the given [transform] function and returns a new [Triple]. +* +* @since 1.3.0 +*/ +fun Triple.mapFirst( + transform: (A1) -> A1New +): Triple = + Triple(transform(first), second, third) + +/** +* Maps [Triple.second] with the given [transform] function and returns a new [Triple]. +* +* @since 1.3.0 +*/ +fun Triple.mapSecond( + transform: (A2) -> A2New +): Triple = + Triple(first, transform(second), third) + +/** +* Maps [Triple.third] with the given [transform] function and returns a new [Triple]. +* +* @since 1.3.0 +*/ +fun Triple.mapThird( + transform: (A3) -> A3New +): Triple = + Triple(first, second, transform(third)) + +/** +* Maps [Tuple4.a1] with the given [transform] function and returns a new [Tuple4]. +* +* @since 1.3.0 +*/ +fun Tuple4.mapA1( + transform: (A1) -> A1New +): Tuple4 = + Tuple4(transform(a1), a2, a3, a4) + +/** +* Maps [Tuple4.a2] with the given [transform] function and returns a new [Tuple4]. +* +* @since 1.3.0 +*/ +fun Tuple4.mapA2( + transform: (A2) -> A2New +): Tuple4 = + Tuple4(a1, transform(a2), a3, a4) + +/** +* Maps [Tuple4.a3] with the given [transform] function and returns a new [Tuple4]. +* +* @since 1.3.0 +*/ +fun Tuple4.mapA3( + transform: (A3) -> A3New +): Tuple4 = + Tuple4(a1, a2, transform(a3), a4) + +/** +* Maps [Tuple4.a4] with the given [transform] function and returns a new [Tuple4]. +* +* @since 1.3.0 +*/ +fun Tuple4.mapA4( + transform: (A4) -> A4New +): Tuple4 = + Tuple4(a1, a2, a3, transform(a4)) + +/** +* Maps [Tuple5.a1] with the given [transform] function and returns a new [Tuple5]. +* +* @since 1.3.0 +*/ +fun Tuple5.mapA1( + transform: (A1) -> A1New +): Tuple5 = + Tuple5(transform(a1), a2, a3, a4, a5) + +/** +* Maps [Tuple5.a2] with the given [transform] function and returns a new [Tuple5]. +* +* @since 1.3.0 +*/ +fun Tuple5.mapA2( + transform: (A2) -> A2New +): Tuple5 = + Tuple5(a1, transform(a2), a3, a4, a5) + +/** +* Maps [Tuple5.a3] with the given [transform] function and returns a new [Tuple5]. +* +* @since 1.3.0 +*/ +fun Tuple5.mapA3( + transform: (A3) -> A3New +): Tuple5 = + Tuple5(a1, a2, transform(a3), a4, a5) + +/** +* Maps [Tuple5.a4] with the given [transform] function and returns a new [Tuple5]. +* +* @since 1.3.0 +*/ +fun Tuple5.mapA4( + transform: (A4) -> A4New +): Tuple5 = + Tuple5(a1, a2, a3, transform(a4), a5) + +/** +* Maps [Tuple5.a5] with the given [transform] function and returns a new [Tuple5]. +* +* @since 1.3.0 +*/ +fun Tuple5.mapA5( + transform: (A5) -> A5New +): Tuple5 = + Tuple5(a1, a2, a3, a4, transform(a5)) + +/** +* Maps [Tuple6.a1] with the given [transform] function and returns a new [Tuple6]. +* +* @since 1.3.0 +*/ +fun Tuple6.mapA1( + transform: (A1) -> A1New +): Tuple6 = + Tuple6(transform(a1), a2, a3, a4, a5, a6) + +/** +* Maps [Tuple6.a2] with the given [transform] function and returns a new [Tuple6]. +* +* @since 1.3.0 +*/ +fun Tuple6.mapA2( + transform: (A2) -> A2New +): Tuple6 = + Tuple6(a1, transform(a2), a3, a4, a5, a6) + +/** +* Maps [Tuple6.a3] with the given [transform] function and returns a new [Tuple6]. +* +* @since 1.3.0 +*/ +fun Tuple6.mapA3( + transform: (A3) -> A3New +): Tuple6 = + Tuple6(a1, a2, transform(a3), a4, a5, a6) + +/** +* Maps [Tuple6.a4] with the given [transform] function and returns a new [Tuple6]. +* +* @since 1.3.0 +*/ +fun Tuple6.mapA4( + transform: (A4) -> A4New +): Tuple6 = + Tuple6(a1, a2, a3, transform(a4), a5, a6) + +/** +* Maps [Tuple6.a5] with the given [transform] function and returns a new [Tuple6]. +* +* @since 1.3.0 +*/ +fun Tuple6.mapA5( + transform: (A5) -> A5New +): Tuple6 = + Tuple6(a1, a2, a3, a4, transform(a5), a6) + +/** +* Maps [Tuple6.a6] with the given [transform] function and returns a new [Tuple6]. +* +* @since 1.3.0 +*/ +fun Tuple6.mapA6( + transform: (A6) -> A6New +): Tuple6 = + Tuple6(a1, a2, a3, a4, a5, transform(a6)) + +/** +* Maps [Tuple7.a1] with the given [transform] function and returns a new [Tuple7]. +* +* @since 1.3.0 +*/ +fun Tuple7.mapA1( + transform: (A1) -> A1New +): Tuple7 = + Tuple7(transform(a1), a2, a3, a4, a5, a6, a7) + +/** +* Maps [Tuple7.a2] with the given [transform] function and returns a new [Tuple7]. +* +* @since 1.3.0 +*/ +fun Tuple7.mapA2( + transform: (A2) -> A2New +): Tuple7 = + Tuple7(a1, transform(a2), a3, a4, a5, a6, a7) + +/** +* Maps [Tuple7.a3] with the given [transform] function and returns a new [Tuple7]. +* +* @since 1.3.0 +*/ +fun Tuple7.mapA3( + transform: (A3) -> A3New +): Tuple7 = + Tuple7(a1, a2, transform(a3), a4, a5, a6, a7) + +/** +* Maps [Tuple7.a4] with the given [transform] function and returns a new [Tuple7]. +* +* @since 1.3.0 +*/ +fun Tuple7.mapA4( + transform: (A4) -> A4New +): Tuple7 = + Tuple7(a1, a2, a3, transform(a4), a5, a6, a7) + +/** +* Maps [Tuple7.a5] with the given [transform] function and returns a new [Tuple7]. +* +* @since 1.3.0 +*/ +fun Tuple7.mapA5( + transform: (A5) -> A5New +): Tuple7 = + Tuple7(a1, a2, a3, a4, transform(a5), a6, a7) + +/** +* Maps [Tuple7.a6] with the given [transform] function and returns a new [Tuple7]. +* +* @since 1.3.0 +*/ +fun Tuple7.mapA6( + transform: (A6) -> A6New +): Tuple7 = + Tuple7(a1, a2, a3, a4, a5, transform(a6), a7) + +/** +* Maps [Tuple7.a7] with the given [transform] function and returns a new [Tuple7]. +* +* @since 1.3.0 +*/ +fun Tuple7.mapA7( + transform: (A7) -> A7New +): Tuple7 = + Tuple7(a1, a2, a3, a4, a5, a6, transform(a7)) + +/** +* Maps [Tuple8.a1] with the given [transform] function and returns a new [Tuple8]. +* +* @since 1.3.0 +*/ +fun Tuple8.mapA1( + transform: (A1) -> A1New +): Tuple8 = + Tuple8(transform(a1), a2, a3, a4, a5, a6, a7, a8) + +/** +* Maps [Tuple8.a2] with the given [transform] function and returns a new [Tuple8]. +* +* @since 1.3.0 +*/ +fun Tuple8.mapA2( + transform: (A2) -> A2New +): Tuple8 = + Tuple8(a1, transform(a2), a3, a4, a5, a6, a7, a8) + +/** +* Maps [Tuple8.a3] with the given [transform] function and returns a new [Tuple8]. +* +* @since 1.3.0 +*/ +fun Tuple8.mapA3( + transform: (A3) -> A3New +): Tuple8 = + Tuple8(a1, a2, transform(a3), a4, a5, a6, a7, a8) + +/** +* Maps [Tuple8.a4] with the given [transform] function and returns a new [Tuple8]. +* +* @since 1.3.0 +*/ +fun Tuple8.mapA4( + transform: (A4) -> A4New +): Tuple8 = + Tuple8(a1, a2, a3, transform(a4), a5, a6, a7, a8) + +/** +* Maps [Tuple8.a5] with the given [transform] function and returns a new [Tuple8]. +* +* @since 1.3.0 +*/ +fun Tuple8.mapA5( + transform: (A5) -> A5New +): Tuple8 = + Tuple8(a1, a2, a3, a4, transform(a5), a6, a7, a8) + +/** +* Maps [Tuple8.a6] with the given [transform] function and returns a new [Tuple8]. +* +* @since 1.3.0 +*/ +fun Tuple8.mapA6( + transform: (A6) -> A6New +): Tuple8 = + Tuple8(a1, a2, a3, a4, a5, transform(a6), a7, a8) + +/** +* Maps [Tuple8.a7] with the given [transform] function and returns a new [Tuple8]. +* +* @since 1.3.0 +*/ +fun Tuple8.mapA7( + transform: (A7) -> A7New +): Tuple8 = + Tuple8(a1, a2, a3, a4, a5, a6, transform(a7), a8) + +/** +* Maps [Tuple8.a8] with the given [transform] function and returns a new [Tuple8]. +* +* @since 1.3.0 +*/ +fun Tuple8.mapA8( + transform: (A8) -> A8New +): Tuple8 = + Tuple8(a1, a2, a3, a4, a5, a6, a7, transform(a8)) + +/** +* Maps [Tuple9.a1] with the given [transform] function and returns a new [Tuple9]. +* +* @since 1.3.0 +*/ +fun Tuple9.mapA1( + transform: (A1) -> A1New +): Tuple9 = + Tuple9(transform(a1), a2, a3, a4, a5, a6, a7, a8, a9) + +/** +* Maps [Tuple9.a2] with the given [transform] function and returns a new [Tuple9]. +* +* @since 1.3.0 +*/ +fun Tuple9.mapA2( + transform: (A2) -> A2New +): Tuple9 = + Tuple9(a1, transform(a2), a3, a4, a5, a6, a7, a8, a9) + +/** +* Maps [Tuple9.a3] with the given [transform] function and returns a new [Tuple9]. +* +* @since 1.3.0 +*/ +fun Tuple9.mapA3( + transform: (A3) -> A3New +): Tuple9 = + Tuple9(a1, a2, transform(a3), a4, a5, a6, a7, a8, a9) + +/** +* Maps [Tuple9.a4] with the given [transform] function and returns a new [Tuple9]. +* +* @since 1.3.0 +*/ +fun Tuple9.mapA4( + transform: (A4) -> A4New +): Tuple9 = + Tuple9(a1, a2, a3, transform(a4), a5, a6, a7, a8, a9) + +/** +* Maps [Tuple9.a5] with the given [transform] function and returns a new [Tuple9]. +* +* @since 1.3.0 +*/ +fun Tuple9.mapA5( + transform: (A5) -> A5New +): Tuple9 = + Tuple9(a1, a2, a3, a4, transform(a5), a6, a7, a8, a9) + +/** +* Maps [Tuple9.a6] with the given [transform] function and returns a new [Tuple9]. +* +* @since 1.3.0 +*/ +fun Tuple9.mapA6( + transform: (A6) -> A6New +): Tuple9 = + Tuple9(a1, a2, a3, a4, a5, transform(a6), a7, a8, a9) + +/** +* Maps [Tuple9.a7] with the given [transform] function and returns a new [Tuple9]. +* +* @since 1.3.0 +*/ +fun Tuple9.mapA7( + transform: (A7) -> A7New +): Tuple9 = + Tuple9(a1, a2, a3, a4, a5, a6, transform(a7), a8, a9) + +/** +* Maps [Tuple9.a8] with the given [transform] function and returns a new [Tuple9]. +* +* @since 1.3.0 +*/ +fun Tuple9.mapA8( + transform: (A8) -> A8New +): Tuple9 = + Tuple9(a1, a2, a3, a4, a5, a6, a7, transform(a8), a9) + +/** +* Maps [Tuple9.a9] with the given [transform] function and returns a new [Tuple9]. +* +* @since 1.3.0 +*/ +fun Tuple9.mapA9( + transform: (A9) -> A9New +): Tuple9 = + Tuple9(a1, a2, a3, a4, a5, a6, a7, a8, transform(a9)) + diff --git a/src/commonMain/kotlin/ch/tutteli/kbox/mapPair.kt b/src/commonMain/kotlin/ch/tutteli/kbox/mapPair.kt deleted file mode 100644 index f4beaa7..0000000 --- a/src/commonMain/kotlin/ch/tutteli/kbox/mapPair.kt +++ /dev/null @@ -1,21 +0,0 @@ -package ch.tutteli.kbox - -/** - * Maps the first element of this [Pair] with the given function [transform]. - * - * @return A new pair with the result of the transformation as first and the existing second as second element. - * - * @since 1.3.0 - */ -fun Pair.mapFirst(transform: (FirstT) -> R): Pair = - Pair(transform(first), second) - -/** - * Maps the second element of this [Pair] with the given function [transform]. - * - * @return A new pair with the existing first element as first and the result of the transformation as second element. - * - * @since 1.3.0 - */ -fun Pair.mapSecond(transform: (SecondT) -> R): Pair = - Pair(first, transform(second)) diff --git a/src/commonTest/generated/kotlin/ch/tutteli/kbox/append/PairAppendTest.kt b/src/commonTest/generated/kotlin/ch/tutteli/kbox/append/PairAppendTest.kt new file mode 100644 index 0000000..d9cb067 --- /dev/null +++ b/src/commonTest/generated/kotlin/ch/tutteli/kbox/append/PairAppendTest.kt @@ -0,0 +1,84 @@ +// -------------------------------------------------------------------------------------------------------------------- +// automatically generated, don't modify here but in: +// gradle/code-generation/src/main/kotlin/code-generation.generate.gradle.kts +// -------------------------------------------------------------------------------------------------------------------- +package ch.tutteli.kbox.append + +import ch.tutteli.atrium.api.fluent.en_GB.* +import ch.tutteli.atrium.api.verbs.expect +import ch.tutteli.kbox.* +import kotlin.test.Test + +class PairAppendTest { + + @Test + fun append_1_values__results_in_a_Triple() { + expect( + Pair("string", 1) + .append(2L) + ).toEqual( + Triple("string", 1, 2L) + ) + } + + @Test + fun append_2_values__results_in_a_Tuple4() { + expect( + Pair("string", 1) + .append(2L, 3F) + ).toEqual( + Tuple4("string", 1, 2L, 3F) + ) + } + + @Test + fun append_3_values__results_in_a_Tuple5() { + expect( + Pair("string", 1) + .append(2L, 3F, 4.0) + ).toEqual( + Tuple5("string", 1, 2L, 3F, 4.0) + ) + } + + @Test + fun append_4_values__results_in_a_Tuple6() { + expect( + Pair("string", 1) + .append(2L, 3F, 4.0, 'c') + ).toEqual( + Tuple6("string", 1, 2L, 3F, 4.0, 'c') + ) + } + + @Test + fun append_5_values__results_in_a_Tuple7() { + expect( + Pair("string", 1) + .append(2L, 3F, 4.0, 'c', 1.toShort()) + ).toEqual( + Tuple7("string", 1, 2L, 3F, 4.0, 'c', 1.toShort()) + ) + } + + @Test + fun append_6_values__results_in_a_Tuple8() { + expect( + Pair("string", 1) + .append(2L, 3F, 4.0, 'c', 1.toShort(), 2.toByte()) + ).toEqual( + Tuple8("string", 1, 2L, 3F, 4.0, 'c', 1.toShort(), 2.toByte()) + ) + } + + @Test + fun append_7_values__results_in_a_Tuple9() { + expect( + Pair("string", 1) + .append(2L, 3F, 4.0, 'c', 1.toShort(), 2.toByte(), listOf(1, 2)) + ).toEqual( + Tuple9("string", 1, 2L, 3F, 4.0, 'c', 1.toShort(), 2.toByte(), listOf(1, 2)) + ) + } + +} \ No newline at end of file diff --git a/src/commonTest/generated/kotlin/ch/tutteli/kbox/append/TripleAppendTest.kt b/src/commonTest/generated/kotlin/ch/tutteli/kbox/append/TripleAppendTest.kt new file mode 100644 index 0000000..093a426 --- /dev/null +++ b/src/commonTest/generated/kotlin/ch/tutteli/kbox/append/TripleAppendTest.kt @@ -0,0 +1,74 @@ +// -------------------------------------------------------------------------------------------------------------------- +// automatically generated, don't modify here but in: +// gradle/code-generation/src/main/kotlin/code-generation.generate.gradle.kts +// -------------------------------------------------------------------------------------------------------------------- +package ch.tutteli.kbox.append + +import ch.tutteli.atrium.api.fluent.en_GB.* +import ch.tutteli.atrium.api.verbs.expect +import ch.tutteli.kbox.* +import kotlin.test.Test + +class TripleAppendTest { + + @Test + fun append_1_values__results_in_a_Tuple4() { + expect( + Triple("string", 1, 2L) + .append(3F) + ).toEqual( + Tuple4("string", 1, 2L, 3F) + ) + } + + @Test + fun append_2_values__results_in_a_Tuple5() { + expect( + Triple("string", 1, 2L) + .append(3F, 4.0) + ).toEqual( + Tuple5("string", 1, 2L, 3F, 4.0) + ) + } + + @Test + fun append_3_values__results_in_a_Tuple6() { + expect( + Triple("string", 1, 2L) + .append(3F, 4.0, 'c') + ).toEqual( + Tuple6("string", 1, 2L, 3F, 4.0, 'c') + ) + } + + @Test + fun append_4_values__results_in_a_Tuple7() { + expect( + Triple("string", 1, 2L) + .append(3F, 4.0, 'c', 1.toShort()) + ).toEqual( + Tuple7("string", 1, 2L, 3F, 4.0, 'c', 1.toShort()) + ) + } + + @Test + fun append_5_values__results_in_a_Tuple8() { + expect( + Triple("string", 1, 2L) + .append(3F, 4.0, 'c', 1.toShort(), 2.toByte()) + ).toEqual( + Tuple8("string", 1, 2L, 3F, 4.0, 'c', 1.toShort(), 2.toByte()) + ) + } + + @Test + fun append_6_values__results_in_a_Tuple9() { + expect( + Triple("string", 1, 2L) + .append(3F, 4.0, 'c', 1.toShort(), 2.toByte(), listOf(1, 2)) + ).toEqual( + Tuple9("string", 1, 2L, 3F, 4.0, 'c', 1.toShort(), 2.toByte(), listOf(1, 2)) + ) + } + +} \ No newline at end of file diff --git a/src/commonTest/generated/kotlin/ch/tutteli/kbox/append/Tuple4AppendTest.kt b/src/commonTest/generated/kotlin/ch/tutteli/kbox/append/Tuple4AppendTest.kt new file mode 100644 index 0000000..31c862d --- /dev/null +++ b/src/commonTest/generated/kotlin/ch/tutteli/kbox/append/Tuple4AppendTest.kt @@ -0,0 +1,64 @@ +// -------------------------------------------------------------------------------------------------------------------- +// automatically generated, don't modify here but in: +// gradle/code-generation/src/main/kotlin/code-generation.generate.gradle.kts +// -------------------------------------------------------------------------------------------------------------------- +package ch.tutteli.kbox.append + +import ch.tutteli.atrium.api.fluent.en_GB.* +import ch.tutteli.atrium.api.verbs.expect +import ch.tutteli.kbox.* +import kotlin.test.Test + +class Tuple4AppendTest { + + @Test + fun append_1_values__results_in_a_Tuple5() { + expect( + Tuple4("string", 1, 2L, 3F) + .append(4.0) + ).toEqual( + Tuple5("string", 1, 2L, 3F, 4.0) + ) + } + + @Test + fun append_2_values__results_in_a_Tuple6() { + expect( + Tuple4("string", 1, 2L, 3F) + .append(4.0, 'c') + ).toEqual( + Tuple6("string", 1, 2L, 3F, 4.0, 'c') + ) + } + + @Test + fun append_3_values__results_in_a_Tuple7() { + expect( + Tuple4("string", 1, 2L, 3F) + .append(4.0, 'c', 1.toShort()) + ).toEqual( + Tuple7("string", 1, 2L, 3F, 4.0, 'c', 1.toShort()) + ) + } + + @Test + fun append_4_values__results_in_a_Tuple8() { + expect( + Tuple4("string", 1, 2L, 3F) + .append(4.0, 'c', 1.toShort(), 2.toByte()) + ).toEqual( + Tuple8("string", 1, 2L, 3F, 4.0, 'c', 1.toShort(), 2.toByte()) + ) + } + + @Test + fun append_5_values__results_in_a_Tuple9() { + expect( + Tuple4("string", 1, 2L, 3F) + .append(4.0, 'c', 1.toShort(), 2.toByte(), listOf(1, 2)) + ).toEqual( + Tuple9("string", 1, 2L, 3F, 4.0, 'c', 1.toShort(), 2.toByte(), listOf(1, 2)) + ) + } + +} \ No newline at end of file diff --git a/src/commonTest/generated/kotlin/ch/tutteli/kbox/append/Tuple5AppendTest.kt b/src/commonTest/generated/kotlin/ch/tutteli/kbox/append/Tuple5AppendTest.kt new file mode 100644 index 0000000..26cf803 --- /dev/null +++ b/src/commonTest/generated/kotlin/ch/tutteli/kbox/append/Tuple5AppendTest.kt @@ -0,0 +1,54 @@ +// -------------------------------------------------------------------------------------------------------------------- +// automatically generated, don't modify here but in: +// gradle/code-generation/src/main/kotlin/code-generation.generate.gradle.kts +// -------------------------------------------------------------------------------------------------------------------- +package ch.tutteli.kbox.append + +import ch.tutteli.atrium.api.fluent.en_GB.* +import ch.tutteli.atrium.api.verbs.expect +import ch.tutteli.kbox.* +import kotlin.test.Test + +class Tuple5AppendTest { + + @Test + fun append_1_values__results_in_a_Tuple6() { + expect( + Tuple5("string", 1, 2L, 3F, 4.0) + .append('c') + ).toEqual( + Tuple6("string", 1, 2L, 3F, 4.0, 'c') + ) + } + + @Test + fun append_2_values__results_in_a_Tuple7() { + expect( + Tuple5("string", 1, 2L, 3F, 4.0) + .append('c', 1.toShort()) + ).toEqual( + Tuple7("string", 1, 2L, 3F, 4.0, 'c', 1.toShort()) + ) + } + + @Test + fun append_3_values__results_in_a_Tuple8() { + expect( + Tuple5("string", 1, 2L, 3F, 4.0) + .append('c', 1.toShort(), 2.toByte()) + ).toEqual( + Tuple8("string", 1, 2L, 3F, 4.0, 'c', 1.toShort(), 2.toByte()) + ) + } + + @Test + fun append_4_values__results_in_a_Tuple9() { + expect( + Tuple5("string", 1, 2L, 3F, 4.0) + .append('c', 1.toShort(), 2.toByte(), listOf(1, 2)) + ).toEqual( + Tuple9("string", 1, 2L, 3F, 4.0, 'c', 1.toShort(), 2.toByte(), listOf(1, 2)) + ) + } + +} \ No newline at end of file diff --git a/src/commonTest/generated/kotlin/ch/tutteli/kbox/append/Tuple6AppendTest.kt b/src/commonTest/generated/kotlin/ch/tutteli/kbox/append/Tuple6AppendTest.kt new file mode 100644 index 0000000..a146967 --- /dev/null +++ b/src/commonTest/generated/kotlin/ch/tutteli/kbox/append/Tuple6AppendTest.kt @@ -0,0 +1,44 @@ +// -------------------------------------------------------------------------------------------------------------------- +// automatically generated, don't modify here but in: +// gradle/code-generation/src/main/kotlin/code-generation.generate.gradle.kts +// -------------------------------------------------------------------------------------------------------------------- +package ch.tutteli.kbox.append + +import ch.tutteli.atrium.api.fluent.en_GB.* +import ch.tutteli.atrium.api.verbs.expect +import ch.tutteli.kbox.* +import kotlin.test.Test + +class Tuple6AppendTest { + + @Test + fun append_1_values__results_in_a_Tuple7() { + expect( + Tuple6("string", 1, 2L, 3F, 4.0, 'c') + .append(1.toShort()) + ).toEqual( + Tuple7("string", 1, 2L, 3F, 4.0, 'c', 1.toShort()) + ) + } + + @Test + fun append_2_values__results_in_a_Tuple8() { + expect( + Tuple6("string", 1, 2L, 3F, 4.0, 'c') + .append(1.toShort(), 2.toByte()) + ).toEqual( + Tuple8("string", 1, 2L, 3F, 4.0, 'c', 1.toShort(), 2.toByte()) + ) + } + + @Test + fun append_3_values__results_in_a_Tuple9() { + expect( + Tuple6("string", 1, 2L, 3F, 4.0, 'c') + .append(1.toShort(), 2.toByte(), listOf(1, 2)) + ).toEqual( + Tuple9("string", 1, 2L, 3F, 4.0, 'c', 1.toShort(), 2.toByte(), listOf(1, 2)) + ) + } + +} \ No newline at end of file diff --git a/src/commonTest/generated/kotlin/ch/tutteli/kbox/append/Tuple7AppendTest.kt b/src/commonTest/generated/kotlin/ch/tutteli/kbox/append/Tuple7AppendTest.kt new file mode 100644 index 0000000..6046dc4 --- /dev/null +++ b/src/commonTest/generated/kotlin/ch/tutteli/kbox/append/Tuple7AppendTest.kt @@ -0,0 +1,34 @@ +// -------------------------------------------------------------------------------------------------------------------- +// automatically generated, don't modify here but in: +// gradle/code-generation/src/main/kotlin/code-generation.generate.gradle.kts +// -------------------------------------------------------------------------------------------------------------------- +package ch.tutteli.kbox.append + +import ch.tutteli.atrium.api.fluent.en_GB.* +import ch.tutteli.atrium.api.verbs.expect +import ch.tutteli.kbox.* +import kotlin.test.Test + +class Tuple7AppendTest { + + @Test + fun append_1_values__results_in_a_Tuple8() { + expect( + Tuple7("string", 1, 2L, 3F, 4.0, 'c', 1.toShort()) + .append(2.toByte()) + ).toEqual( + Tuple8("string", 1, 2L, 3F, 4.0, 'c', 1.toShort(), 2.toByte()) + ) + } + + @Test + fun append_2_values__results_in_a_Tuple9() { + expect( + Tuple7("string", 1, 2L, 3F, 4.0, 'c', 1.toShort()) + .append(2.toByte(), listOf(1, 2)) + ).toEqual( + Tuple9("string", 1, 2L, 3F, 4.0, 'c', 1.toShort(), 2.toByte(), listOf(1, 2)) + ) + } + +} \ No newline at end of file diff --git a/src/commonTest/generated/kotlin/ch/tutteli/kbox/append/Tuple8AppendTest.kt b/src/commonTest/generated/kotlin/ch/tutteli/kbox/append/Tuple8AppendTest.kt new file mode 100644 index 0000000..6c9695f --- /dev/null +++ b/src/commonTest/generated/kotlin/ch/tutteli/kbox/append/Tuple8AppendTest.kt @@ -0,0 +1,24 @@ +// -------------------------------------------------------------------------------------------------------------------- +// automatically generated, don't modify here but in: +// gradle/code-generation/src/main/kotlin/code-generation.generate.gradle.kts +// -------------------------------------------------------------------------------------------------------------------- +package ch.tutteli.kbox.append + +import ch.tutteli.atrium.api.fluent.en_GB.* +import ch.tutteli.atrium.api.verbs.expect +import ch.tutteli.kbox.* +import kotlin.test.Test + +class Tuple8AppendTest { + + @Test + fun append_1_values__results_in_a_Tuple9() { + expect( + Tuple8("string", 1, 2L, 3F, 4.0, 'c', 1.toShort(), 2.toByte()) + .append(listOf(1, 2)) + ).toEqual( + Tuple9("string", 1, 2L, 3F, 4.0, 'c', 1.toShort(), 2.toByte(), listOf(1, 2)) + ) + } + +} \ No newline at end of file diff --git a/src/commonTest/generated/kotlin/ch/tutteli/kbox/glue/PairGlueTest.kt b/src/commonTest/generated/kotlin/ch/tutteli/kbox/glue/PairGlueTest.kt new file mode 100644 index 0000000..4131616 --- /dev/null +++ b/src/commonTest/generated/kotlin/ch/tutteli/kbox/glue/PairGlueTest.kt @@ -0,0 +1,74 @@ +// -------------------------------------------------------------------------------------------------------------------- +// automatically generated, don't modify here but in: +// gradle/code-generation/src/main/kotlin/code-generation.generate.gradle.kts +// -------------------------------------------------------------------------------------------------------------------- +package ch.tutteli.kbox.glue + +import ch.tutteli.atrium.api.fluent.en_GB.* +import ch.tutteli.atrium.api.verbs.expect +import ch.tutteli.kbox.* +import kotlin.test.Test + +class PairGlueTest { + + @Test + fun glue_Pair__results_in_a_Tuple4() { + expect( + Pair("string", 1) + .glue(Pair(2L, 3F)) + ).toEqual( + Tuple4("string", 1, 2L, 3F) + ) + } + + @Test + fun glue_Triple__results_in_a_Tuple5() { + expect( + Pair("string", 1) + .glue(Triple(2L, 3F, 4.0)) + ).toEqual( + Tuple5("string", 1, 2L, 3F, 4.0) + ) + } + + @Test + fun glue_Tuple4__results_in_a_Tuple6() { + expect( + Pair("string", 1) + .glue(Tuple4(2L, 3F, 4.0, 'c')) + ).toEqual( + Tuple6("string", 1, 2L, 3F, 4.0, 'c') + ) + } + + @Test + fun glue_Tuple5__results_in_a_Tuple7() { + expect( + Pair("string", 1) + .glue(Tuple5(2L, 3F, 4.0, 'c', 1.toShort())) + ).toEqual( + Tuple7("string", 1, 2L, 3F, 4.0, 'c', 1.toShort()) + ) + } + + @Test + fun glue_Tuple6__results_in_a_Tuple8() { + expect( + Pair("string", 1) + .glue(Tuple6(2L, 3F, 4.0, 'c', 1.toShort(), 2.toByte())) + ).toEqual( + Tuple8("string", 1, 2L, 3F, 4.0, 'c', 1.toShort(), 2.toByte()) + ) + } + + @Test + fun glue_Tuple7__results_in_a_Tuple9() { + expect( + Pair("string", 1) + .glue(Tuple7(2L, 3F, 4.0, 'c', 1.toShort(), 2.toByte(), listOf(1, 2))) + ).toEqual( + Tuple9("string", 1, 2L, 3F, 4.0, 'c', 1.toShort(), 2.toByte(), listOf(1, 2)) + ) + } + +} \ No newline at end of file diff --git a/src/commonTest/generated/kotlin/ch/tutteli/kbox/glue/TripleGlueTest.kt b/src/commonTest/generated/kotlin/ch/tutteli/kbox/glue/TripleGlueTest.kt new file mode 100644 index 0000000..fd73b47 --- /dev/null +++ b/src/commonTest/generated/kotlin/ch/tutteli/kbox/glue/TripleGlueTest.kt @@ -0,0 +1,64 @@ +// -------------------------------------------------------------------------------------------------------------------- +// automatically generated, don't modify here but in: +// gradle/code-generation/src/main/kotlin/code-generation.generate.gradle.kts +// -------------------------------------------------------------------------------------------------------------------- +package ch.tutteli.kbox.glue + +import ch.tutteli.atrium.api.fluent.en_GB.* +import ch.tutteli.atrium.api.verbs.expect +import ch.tutteli.kbox.* +import kotlin.test.Test + +class TripleGlueTest { + + @Test + fun glue_Pair__results_in_a_Tuple5() { + expect( + Triple("string", 1, 2L) + .glue(Pair(3F, 4.0)) + ).toEqual( + Tuple5("string", 1, 2L, 3F, 4.0) + ) + } + + @Test + fun glue_Triple__results_in_a_Tuple6() { + expect( + Triple("string", 1, 2L) + .glue(Triple(3F, 4.0, 'c')) + ).toEqual( + Tuple6("string", 1, 2L, 3F, 4.0, 'c') + ) + } + + @Test + fun glue_Tuple4__results_in_a_Tuple7() { + expect( + Triple("string", 1, 2L) + .glue(Tuple4(3F, 4.0, 'c', 1.toShort())) + ).toEqual( + Tuple7("string", 1, 2L, 3F, 4.0, 'c', 1.toShort()) + ) + } + + @Test + fun glue_Tuple5__results_in_a_Tuple8() { + expect( + Triple("string", 1, 2L) + .glue(Tuple5(3F, 4.0, 'c', 1.toShort(), 2.toByte())) + ).toEqual( + Tuple8("string", 1, 2L, 3F, 4.0, 'c', 1.toShort(), 2.toByte()) + ) + } + + @Test + fun glue_Tuple6__results_in_a_Tuple9() { + expect( + Triple("string", 1, 2L) + .glue(Tuple6(3F, 4.0, 'c', 1.toShort(), 2.toByte(), listOf(1, 2))) + ).toEqual( + Tuple9("string", 1, 2L, 3F, 4.0, 'c', 1.toShort(), 2.toByte(), listOf(1, 2)) + ) + } + +} \ No newline at end of file diff --git a/src/commonTest/generated/kotlin/ch/tutteli/kbox/glue/Tuple4GlueTest.kt b/src/commonTest/generated/kotlin/ch/tutteli/kbox/glue/Tuple4GlueTest.kt new file mode 100644 index 0000000..36cb649 --- /dev/null +++ b/src/commonTest/generated/kotlin/ch/tutteli/kbox/glue/Tuple4GlueTest.kt @@ -0,0 +1,54 @@ +// -------------------------------------------------------------------------------------------------------------------- +// automatically generated, don't modify here but in: +// gradle/code-generation/src/main/kotlin/code-generation.generate.gradle.kts +// -------------------------------------------------------------------------------------------------------------------- +package ch.tutteli.kbox.glue + +import ch.tutteli.atrium.api.fluent.en_GB.* +import ch.tutteli.atrium.api.verbs.expect +import ch.tutteli.kbox.* +import kotlin.test.Test + +class Tuple4GlueTest { + + @Test + fun glue_Pair__results_in_a_Tuple6() { + expect( + Tuple4("string", 1, 2L, 3F) + .glue(Pair(4.0, 'c')) + ).toEqual( + Tuple6("string", 1, 2L, 3F, 4.0, 'c') + ) + } + + @Test + fun glue_Triple__results_in_a_Tuple7() { + expect( + Tuple4("string", 1, 2L, 3F) + .glue(Triple(4.0, 'c', 1.toShort())) + ).toEqual( + Tuple7("string", 1, 2L, 3F, 4.0, 'c', 1.toShort()) + ) + } + + @Test + fun glue_Tuple4__results_in_a_Tuple8() { + expect( + Tuple4("string", 1, 2L, 3F) + .glue(Tuple4(4.0, 'c', 1.toShort(), 2.toByte())) + ).toEqual( + Tuple8("string", 1, 2L, 3F, 4.0, 'c', 1.toShort(), 2.toByte()) + ) + } + + @Test + fun glue_Tuple5__results_in_a_Tuple9() { + expect( + Tuple4("string", 1, 2L, 3F) + .glue(Tuple5(4.0, 'c', 1.toShort(), 2.toByte(), listOf(1, 2))) + ).toEqual( + Tuple9("string", 1, 2L, 3F, 4.0, 'c', 1.toShort(), 2.toByte(), listOf(1, 2)) + ) + } + +} \ No newline at end of file diff --git a/src/commonTest/generated/kotlin/ch/tutteli/kbox/glue/Tuple5GlueTest.kt b/src/commonTest/generated/kotlin/ch/tutteli/kbox/glue/Tuple5GlueTest.kt new file mode 100644 index 0000000..7f4b6ba --- /dev/null +++ b/src/commonTest/generated/kotlin/ch/tutteli/kbox/glue/Tuple5GlueTest.kt @@ -0,0 +1,44 @@ +// -------------------------------------------------------------------------------------------------------------------- +// automatically generated, don't modify here but in: +// gradle/code-generation/src/main/kotlin/code-generation.generate.gradle.kts +// -------------------------------------------------------------------------------------------------------------------- +package ch.tutteli.kbox.glue + +import ch.tutteli.atrium.api.fluent.en_GB.* +import ch.tutteli.atrium.api.verbs.expect +import ch.tutteli.kbox.* +import kotlin.test.Test + +class Tuple5GlueTest { + + @Test + fun glue_Pair__results_in_a_Tuple7() { + expect( + Tuple5("string", 1, 2L, 3F, 4.0) + .glue(Pair('c', 1.toShort())) + ).toEqual( + Tuple7("string", 1, 2L, 3F, 4.0, 'c', 1.toShort()) + ) + } + + @Test + fun glue_Triple__results_in_a_Tuple8() { + expect( + Tuple5("string", 1, 2L, 3F, 4.0) + .glue(Triple('c', 1.toShort(), 2.toByte())) + ).toEqual( + Tuple8("string", 1, 2L, 3F, 4.0, 'c', 1.toShort(), 2.toByte()) + ) + } + + @Test + fun glue_Tuple4__results_in_a_Tuple9() { + expect( + Tuple5("string", 1, 2L, 3F, 4.0) + .glue(Tuple4('c', 1.toShort(), 2.toByte(), listOf(1, 2))) + ).toEqual( + Tuple9("string", 1, 2L, 3F, 4.0, 'c', 1.toShort(), 2.toByte(), listOf(1, 2)) + ) + } + +} \ No newline at end of file diff --git a/src/commonTest/generated/kotlin/ch/tutteli/kbox/glue/Tuple6GlueTest.kt b/src/commonTest/generated/kotlin/ch/tutteli/kbox/glue/Tuple6GlueTest.kt new file mode 100644 index 0000000..6a7dc26 --- /dev/null +++ b/src/commonTest/generated/kotlin/ch/tutteli/kbox/glue/Tuple6GlueTest.kt @@ -0,0 +1,34 @@ +// -------------------------------------------------------------------------------------------------------------------- +// automatically generated, don't modify here but in: +// gradle/code-generation/src/main/kotlin/code-generation.generate.gradle.kts +// -------------------------------------------------------------------------------------------------------------------- +package ch.tutteli.kbox.glue + +import ch.tutteli.atrium.api.fluent.en_GB.* +import ch.tutteli.atrium.api.verbs.expect +import ch.tutteli.kbox.* +import kotlin.test.Test + +class Tuple6GlueTest { + + @Test + fun glue_Pair__results_in_a_Tuple8() { + expect( + Tuple6("string", 1, 2L, 3F, 4.0, 'c') + .glue(Pair(1.toShort(), 2.toByte())) + ).toEqual( + Tuple8("string", 1, 2L, 3F, 4.0, 'c', 1.toShort(), 2.toByte()) + ) + } + + @Test + fun glue_Triple__results_in_a_Tuple9() { + expect( + Tuple6("string", 1, 2L, 3F, 4.0, 'c') + .glue(Triple(1.toShort(), 2.toByte(), listOf(1, 2))) + ).toEqual( + Tuple9("string", 1, 2L, 3F, 4.0, 'c', 1.toShort(), 2.toByte(), listOf(1, 2)) + ) + } + +} \ No newline at end of file diff --git a/src/commonTest/generated/kotlin/ch/tutteli/kbox/glue/Tuple7GlueTest.kt b/src/commonTest/generated/kotlin/ch/tutteli/kbox/glue/Tuple7GlueTest.kt new file mode 100644 index 0000000..5fc09d2 --- /dev/null +++ b/src/commonTest/generated/kotlin/ch/tutteli/kbox/glue/Tuple7GlueTest.kt @@ -0,0 +1,24 @@ +// -------------------------------------------------------------------------------------------------------------------- +// automatically generated, don't modify here but in: +// gradle/code-generation/src/main/kotlin/code-generation.generate.gradle.kts +// -------------------------------------------------------------------------------------------------------------------- +package ch.tutteli.kbox.glue + +import ch.tutteli.atrium.api.fluent.en_GB.* +import ch.tutteli.atrium.api.verbs.expect +import ch.tutteli.kbox.* +import kotlin.test.Test + +class Tuple7GlueTest { + + @Test + fun glue_Pair__results_in_a_Tuple9() { + expect( + Tuple7("string", 1, 2L, 3F, 4.0, 'c', 1.toShort()) + .glue(Pair(2.toByte(), listOf(1, 2))) + ).toEqual( + Tuple9("string", 1, 2L, 3F, 4.0, 'c', 1.toShort(), 2.toByte(), listOf(1, 2)) + ) + } + +} \ No newline at end of file diff --git a/src/commonTest/generated/kotlin/ch/tutteli/kbox/map/PairMapTest.kt b/src/commonTest/generated/kotlin/ch/tutteli/kbox/map/PairMapTest.kt new file mode 100644 index 0000000..c10abd1 --- /dev/null +++ b/src/commonTest/generated/kotlin/ch/tutteli/kbox/map/PairMapTest.kt @@ -0,0 +1,60 @@ +// -------------------------------------------------------------------------------------------------------------------- +// automatically generated, don't modify here but in: +// gradle/code-generation/src/main/kotlin/code-generation.generate.gradle.kts +// -------------------------------------------------------------------------------------------------------------------- +package ch.tutteli.kbox.map + +import ch.tutteli.atrium.api.fluent.en_GB.* +import ch.tutteli.atrium.api.verbs.expect +import ch.tutteli.kbox.* +import kotlin.test.Test + +class PairMapTest { + + @Test + fun mapFirst__identity__returns_equal_Pair() { + expect( + Pair("string", 1) + .mapFirst(::identity) + ).toEqual( + Pair("string", 1) + ) + } + + @Test + fun mapFirst__transformation_does_not_touch_other_properties() { + val a1 = listOf("string") + val a2 = listOf(1) + expect( + Pair(a1, a2) + .mapFirst { it.first() } + ) { + toEqual(Pair("string", a2)) + feature { f(it::second) }.toBeTheInstance(a2) + } + } + + @Test + fun mapSecond__identity__returns_equal_Pair() { + expect( + Pair("string", 1) + .mapSecond(::identity) + ).toEqual( + Pair("string", 1) + ) + } + + @Test + fun mapSecond__transformation_does_not_touch_other_properties() { + val a1 = listOf("string") + val a2 = listOf(1) + expect( + Pair(a1, a2) + .mapSecond { it.first() } + ) { + toEqual(Pair(a1, 1)) + feature { f(it::first) }.toBeTheInstance(a1) + } + } + +} \ No newline at end of file diff --git a/src/commonTest/generated/kotlin/ch/tutteli/kbox/map/TripleMapTest.kt b/src/commonTest/generated/kotlin/ch/tutteli/kbox/map/TripleMapTest.kt new file mode 100644 index 0000000..92d55ce --- /dev/null +++ b/src/commonTest/generated/kotlin/ch/tutteli/kbox/map/TripleMapTest.kt @@ -0,0 +1,89 @@ +// -------------------------------------------------------------------------------------------------------------------- +// automatically generated, don't modify here but in: +// gradle/code-generation/src/main/kotlin/code-generation.generate.gradle.kts +// -------------------------------------------------------------------------------------------------------------------- +package ch.tutteli.kbox.map + +import ch.tutteli.atrium.api.fluent.en_GB.* +import ch.tutteli.atrium.api.verbs.expect +import ch.tutteli.kbox.* +import kotlin.test.Test + +class TripleMapTest { + + @Test + fun mapFirst__identity__returns_equal_Triple() { + expect( + Triple("string", 1, 2L) + .mapFirst(::identity) + ).toEqual( + Triple("string", 1, 2L) + ) + } + + @Test + fun mapFirst__transformation_does_not_touch_other_properties() { + val a1 = listOf("string") + val a2 = listOf(1) + val a3 = listOf(2L) + expect( + Triple(a1, a2, a3) + .mapFirst { it.first() } + ) { + toEqual(Triple("string", a2, a3)) + feature { f(it::second) }.toBeTheInstance(a2) + feature { f(it::third) }.toBeTheInstance(a3) + } + } + + @Test + fun mapSecond__identity__returns_equal_Triple() { + expect( + Triple("string", 1, 2L) + .mapSecond(::identity) + ).toEqual( + Triple("string", 1, 2L) + ) + } + + @Test + fun mapSecond__transformation_does_not_touch_other_properties() { + val a1 = listOf("string") + val a2 = listOf(1) + val a3 = listOf(2L) + expect( + Triple(a1, a2, a3) + .mapSecond { it.first() } + ) { + toEqual(Triple(a1, 1, a3)) + feature { f(it::first) }.toBeTheInstance(a1) + feature { f(it::third) }.toBeTheInstance(a3) + } + } + + @Test + fun mapThird__identity__returns_equal_Triple() { + expect( + Triple("string", 1, 2L) + .mapThird(::identity) + ).toEqual( + Triple("string", 1, 2L) + ) + } + + @Test + fun mapThird__transformation_does_not_touch_other_properties() { + val a1 = listOf("string") + val a2 = listOf(1) + val a3 = listOf(2L) + expect( + Triple(a1, a2, a3) + .mapThird { it.first() } + ) { + toEqual(Triple(a1, a2, 2L)) + feature { f(it::first) }.toBeTheInstance(a1) + feature { f(it::second) }.toBeTheInstance(a2) + } + } + +} \ No newline at end of file diff --git a/src/commonTest/generated/kotlin/ch/tutteli/kbox/map/Tuple4MapTest.kt b/src/commonTest/generated/kotlin/ch/tutteli/kbox/map/Tuple4MapTest.kt new file mode 100644 index 0000000..b2222f9 --- /dev/null +++ b/src/commonTest/generated/kotlin/ch/tutteli/kbox/map/Tuple4MapTest.kt @@ -0,0 +1,122 @@ +// -------------------------------------------------------------------------------------------------------------------- +// automatically generated, don't modify here but in: +// gradle/code-generation/src/main/kotlin/code-generation.generate.gradle.kts +// -------------------------------------------------------------------------------------------------------------------- +package ch.tutteli.kbox.map + +import ch.tutteli.atrium.api.fluent.en_GB.* +import ch.tutteli.atrium.api.verbs.expect +import ch.tutteli.kbox.* +import kotlin.test.Test + +class Tuple4MapTest { + + @Test + fun mapA1__identity__returns_equal_Tuple4() { + expect( + Tuple4("string", 1, 2L, 3F) + .mapA1(::identity) + ).toEqual( + Tuple4("string", 1, 2L, 3F) + ) + } + + @Test + fun mapA1__transformation_does_not_touch_other_properties() { + val a1 = listOf("string") + val a2 = listOf(1) + val a3 = listOf(2L) + val a4 = listOf(3F) + expect( + Tuple4(a1, a2, a3, a4) + .mapA1 { it.first() } + ) { + toEqual(Tuple4("string", a2, a3, a4)) + feature { f(it::a2) }.toBeTheInstance(a2) + feature { f(it::a3) }.toBeTheInstance(a3) + feature { f(it::a4) }.toBeTheInstance(a4) + } + } + + @Test + fun mapA2__identity__returns_equal_Tuple4() { + expect( + Tuple4("string", 1, 2L, 3F) + .mapA2(::identity) + ).toEqual( + Tuple4("string", 1, 2L, 3F) + ) + } + + @Test + fun mapA2__transformation_does_not_touch_other_properties() { + val a1 = listOf("string") + val a2 = listOf(1) + val a3 = listOf(2L) + val a4 = listOf(3F) + expect( + Tuple4(a1, a2, a3, a4) + .mapA2 { it.first() } + ) { + toEqual(Tuple4(a1, 1, a3, a4)) + feature { f(it::a1) }.toBeTheInstance(a1) + feature { f(it::a3) }.toBeTheInstance(a3) + feature { f(it::a4) }.toBeTheInstance(a4) + } + } + + @Test + fun mapA3__identity__returns_equal_Tuple4() { + expect( + Tuple4("string", 1, 2L, 3F) + .mapA3(::identity) + ).toEqual( + Tuple4("string", 1, 2L, 3F) + ) + } + + @Test + fun mapA3__transformation_does_not_touch_other_properties() { + val a1 = listOf("string") + val a2 = listOf(1) + val a3 = listOf(2L) + val a4 = listOf(3F) + expect( + Tuple4(a1, a2, a3, a4) + .mapA3 { it.first() } + ) { + toEqual(Tuple4(a1, a2, 2L, a4)) + feature { f(it::a1) }.toBeTheInstance(a1) + feature { f(it::a2) }.toBeTheInstance(a2) + feature { f(it::a4) }.toBeTheInstance(a4) + } + } + + @Test + fun mapA4__identity__returns_equal_Tuple4() { + expect( + Tuple4("string", 1, 2L, 3F) + .mapA4(::identity) + ).toEqual( + Tuple4("string", 1, 2L, 3F) + ) + } + + @Test + fun mapA4__transformation_does_not_touch_other_properties() { + val a1 = listOf("string") + val a2 = listOf(1) + val a3 = listOf(2L) + val a4 = listOf(3F) + expect( + Tuple4(a1, a2, a3, a4) + .mapA4 { it.first() } + ) { + toEqual(Tuple4(a1, a2, a3, 3F)) + feature { f(it::a1) }.toBeTheInstance(a1) + feature { f(it::a2) }.toBeTheInstance(a2) + feature { f(it::a3) }.toBeTheInstance(a3) + } + } + +} \ No newline at end of file diff --git a/src/commonTest/generated/kotlin/ch/tutteli/kbox/map/Tuple5MapTest.kt b/src/commonTest/generated/kotlin/ch/tutteli/kbox/map/Tuple5MapTest.kt new file mode 100644 index 0000000..a66e78f --- /dev/null +++ b/src/commonTest/generated/kotlin/ch/tutteli/kbox/map/Tuple5MapTest.kt @@ -0,0 +1,159 @@ +// -------------------------------------------------------------------------------------------------------------------- +// automatically generated, don't modify here but in: +// gradle/code-generation/src/main/kotlin/code-generation.generate.gradle.kts +// -------------------------------------------------------------------------------------------------------------------- +package ch.tutteli.kbox.map + +import ch.tutteli.atrium.api.fluent.en_GB.* +import ch.tutteli.atrium.api.verbs.expect +import ch.tutteli.kbox.* +import kotlin.test.Test + +class Tuple5MapTest { + + @Test + fun mapA1__identity__returns_equal_Tuple5() { + expect( + Tuple5("string", 1, 2L, 3F, 4.0) + .mapA1(::identity) + ).toEqual( + Tuple5("string", 1, 2L, 3F, 4.0) + ) + } + + @Test + fun mapA1__transformation_does_not_touch_other_properties() { + val a1 = listOf("string") + val a2 = listOf(1) + val a3 = listOf(2L) + val a4 = listOf(3F) + val a5 = listOf(4.0) + expect( + Tuple5(a1, a2, a3, a4, a5) + .mapA1 { it.first() } + ) { + toEqual(Tuple5("string", a2, a3, a4, a5)) + feature { f(it::a2) }.toBeTheInstance(a2) + feature { f(it::a3) }.toBeTheInstance(a3) + feature { f(it::a4) }.toBeTheInstance(a4) + feature { f(it::a5) }.toBeTheInstance(a5) + } + } + + @Test + fun mapA2__identity__returns_equal_Tuple5() { + expect( + Tuple5("string", 1, 2L, 3F, 4.0) + .mapA2(::identity) + ).toEqual( + Tuple5("string", 1, 2L, 3F, 4.0) + ) + } + + @Test + fun mapA2__transformation_does_not_touch_other_properties() { + val a1 = listOf("string") + val a2 = listOf(1) + val a3 = listOf(2L) + val a4 = listOf(3F) + val a5 = listOf(4.0) + expect( + Tuple5(a1, a2, a3, a4, a5) + .mapA2 { it.first() } + ) { + toEqual(Tuple5(a1, 1, a3, a4, a5)) + feature { f(it::a1) }.toBeTheInstance(a1) + feature { f(it::a3) }.toBeTheInstance(a3) + feature { f(it::a4) }.toBeTheInstance(a4) + feature { f(it::a5) }.toBeTheInstance(a5) + } + } + + @Test + fun mapA3__identity__returns_equal_Tuple5() { + expect( + Tuple5("string", 1, 2L, 3F, 4.0) + .mapA3(::identity) + ).toEqual( + Tuple5("string", 1, 2L, 3F, 4.0) + ) + } + + @Test + fun mapA3__transformation_does_not_touch_other_properties() { + val a1 = listOf("string") + val a2 = listOf(1) + val a3 = listOf(2L) + val a4 = listOf(3F) + val a5 = listOf(4.0) + expect( + Tuple5(a1, a2, a3, a4, a5) + .mapA3 { it.first() } + ) { + toEqual(Tuple5(a1, a2, 2L, a4, a5)) + feature { f(it::a1) }.toBeTheInstance(a1) + feature { f(it::a2) }.toBeTheInstance(a2) + feature { f(it::a4) }.toBeTheInstance(a4) + feature { f(it::a5) }.toBeTheInstance(a5) + } + } + + @Test + fun mapA4__identity__returns_equal_Tuple5() { + expect( + Tuple5("string", 1, 2L, 3F, 4.0) + .mapA4(::identity) + ).toEqual( + Tuple5("string", 1, 2L, 3F, 4.0) + ) + } + + @Test + fun mapA4__transformation_does_not_touch_other_properties() { + val a1 = listOf("string") + val a2 = listOf(1) + val a3 = listOf(2L) + val a4 = listOf(3F) + val a5 = listOf(4.0) + expect( + Tuple5(a1, a2, a3, a4, a5) + .mapA4 { it.first() } + ) { + toEqual(Tuple5(a1, a2, a3, 3F, a5)) + feature { f(it::a1) }.toBeTheInstance(a1) + feature { f(it::a2) }.toBeTheInstance(a2) + feature { f(it::a3) }.toBeTheInstance(a3) + feature { f(it::a5) }.toBeTheInstance(a5) + } + } + + @Test + fun mapA5__identity__returns_equal_Tuple5() { + expect( + Tuple5("string", 1, 2L, 3F, 4.0) + .mapA5(::identity) + ).toEqual( + Tuple5("string", 1, 2L, 3F, 4.0) + ) + } + + @Test + fun mapA5__transformation_does_not_touch_other_properties() { + val a1 = listOf("string") + val a2 = listOf(1) + val a3 = listOf(2L) + val a4 = listOf(3F) + val a5 = listOf(4.0) + expect( + Tuple5(a1, a2, a3, a4, a5) + .mapA5 { it.first() } + ) { + toEqual(Tuple5(a1, a2, a3, a4, 4.0)) + feature { f(it::a1) }.toBeTheInstance(a1) + feature { f(it::a2) }.toBeTheInstance(a2) + feature { f(it::a3) }.toBeTheInstance(a3) + feature { f(it::a4) }.toBeTheInstance(a4) + } + } + +} \ No newline at end of file diff --git a/src/commonTest/generated/kotlin/ch/tutteli/kbox/map/Tuple6MapTest.kt b/src/commonTest/generated/kotlin/ch/tutteli/kbox/map/Tuple6MapTest.kt new file mode 100644 index 0000000..7140825 --- /dev/null +++ b/src/commonTest/generated/kotlin/ch/tutteli/kbox/map/Tuple6MapTest.kt @@ -0,0 +1,200 @@ +// -------------------------------------------------------------------------------------------------------------------- +// automatically generated, don't modify here but in: +// gradle/code-generation/src/main/kotlin/code-generation.generate.gradle.kts +// -------------------------------------------------------------------------------------------------------------------- +package ch.tutteli.kbox.map + +import ch.tutteli.atrium.api.fluent.en_GB.* +import ch.tutteli.atrium.api.verbs.expect +import ch.tutteli.kbox.* +import kotlin.test.Test + +class Tuple6MapTest { + + @Test + fun mapA1__identity__returns_equal_Tuple6() { + expect( + Tuple6("string", 1, 2L, 3F, 4.0, 'c') + .mapA1(::identity) + ).toEqual( + Tuple6("string", 1, 2L, 3F, 4.0, 'c') + ) + } + + @Test + fun mapA1__transformation_does_not_touch_other_properties() { + val a1 = listOf("string") + val a2 = listOf(1) + val a3 = listOf(2L) + val a4 = listOf(3F) + val a5 = listOf(4.0) + val a6 = listOf('c') + expect( + Tuple6(a1, a2, a3, a4, a5, a6) + .mapA1 { it.first() } + ) { + toEqual(Tuple6("string", a2, a3, a4, a5, a6)) + feature { f(it::a2) }.toBeTheInstance(a2) + feature { f(it::a3) }.toBeTheInstance(a3) + feature { f(it::a4) }.toBeTheInstance(a4) + feature { f(it::a5) }.toBeTheInstance(a5) + feature { f(it::a6) }.toBeTheInstance(a6) + } + } + + @Test + fun mapA2__identity__returns_equal_Tuple6() { + expect( + Tuple6("string", 1, 2L, 3F, 4.0, 'c') + .mapA2(::identity) + ).toEqual( + Tuple6("string", 1, 2L, 3F, 4.0, 'c') + ) + } + + @Test + fun mapA2__transformation_does_not_touch_other_properties() { + val a1 = listOf("string") + val a2 = listOf(1) + val a3 = listOf(2L) + val a4 = listOf(3F) + val a5 = listOf(4.0) + val a6 = listOf('c') + expect( + Tuple6(a1, a2, a3, a4, a5, a6) + .mapA2 { it.first() } + ) { + toEqual(Tuple6(a1, 1, a3, a4, a5, a6)) + feature { f(it::a1) }.toBeTheInstance(a1) + feature { f(it::a3) }.toBeTheInstance(a3) + feature { f(it::a4) }.toBeTheInstance(a4) + feature { f(it::a5) }.toBeTheInstance(a5) + feature { f(it::a6) }.toBeTheInstance(a6) + } + } + + @Test + fun mapA3__identity__returns_equal_Tuple6() { + expect( + Tuple6("string", 1, 2L, 3F, 4.0, 'c') + .mapA3(::identity) + ).toEqual( + Tuple6("string", 1, 2L, 3F, 4.0, 'c') + ) + } + + @Test + fun mapA3__transformation_does_not_touch_other_properties() { + val a1 = listOf("string") + val a2 = listOf(1) + val a3 = listOf(2L) + val a4 = listOf(3F) + val a5 = listOf(4.0) + val a6 = listOf('c') + expect( + Tuple6(a1, a2, a3, a4, a5, a6) + .mapA3 { it.first() } + ) { + toEqual(Tuple6(a1, a2, 2L, a4, a5, a6)) + feature { f(it::a1) }.toBeTheInstance(a1) + feature { f(it::a2) }.toBeTheInstance(a2) + feature { f(it::a4) }.toBeTheInstance(a4) + feature { f(it::a5) }.toBeTheInstance(a5) + feature { f(it::a6) }.toBeTheInstance(a6) + } + } + + @Test + fun mapA4__identity__returns_equal_Tuple6() { + expect( + Tuple6("string", 1, 2L, 3F, 4.0, 'c') + .mapA4(::identity) + ).toEqual( + Tuple6("string", 1, 2L, 3F, 4.0, 'c') + ) + } + + @Test + fun mapA4__transformation_does_not_touch_other_properties() { + val a1 = listOf("string") + val a2 = listOf(1) + val a3 = listOf(2L) + val a4 = listOf(3F) + val a5 = listOf(4.0) + val a6 = listOf('c') + expect( + Tuple6(a1, a2, a3, a4, a5, a6) + .mapA4 { it.first() } + ) { + toEqual(Tuple6(a1, a2, a3, 3F, a5, a6)) + feature { f(it::a1) }.toBeTheInstance(a1) + feature { f(it::a2) }.toBeTheInstance(a2) + feature { f(it::a3) }.toBeTheInstance(a3) + feature { f(it::a5) }.toBeTheInstance(a5) + feature { f(it::a6) }.toBeTheInstance(a6) + } + } + + @Test + fun mapA5__identity__returns_equal_Tuple6() { + expect( + Tuple6("string", 1, 2L, 3F, 4.0, 'c') + .mapA5(::identity) + ).toEqual( + Tuple6("string", 1, 2L, 3F, 4.0, 'c') + ) + } + + @Test + fun mapA5__transformation_does_not_touch_other_properties() { + val a1 = listOf("string") + val a2 = listOf(1) + val a3 = listOf(2L) + val a4 = listOf(3F) + val a5 = listOf(4.0) + val a6 = listOf('c') + expect( + Tuple6(a1, a2, a3, a4, a5, a6) + .mapA5 { it.first() } + ) { + toEqual(Tuple6(a1, a2, a3, a4, 4.0, a6)) + feature { f(it::a1) }.toBeTheInstance(a1) + feature { f(it::a2) }.toBeTheInstance(a2) + feature { f(it::a3) }.toBeTheInstance(a3) + feature { f(it::a4) }.toBeTheInstance(a4) + feature { f(it::a6) }.toBeTheInstance(a6) + } + } + + @Test + fun mapA6__identity__returns_equal_Tuple6() { + expect( + Tuple6("string", 1, 2L, 3F, 4.0, 'c') + .mapA6(::identity) + ).toEqual( + Tuple6("string", 1, 2L, 3F, 4.0, 'c') + ) + } + + @Test + fun mapA6__transformation_does_not_touch_other_properties() { + val a1 = listOf("string") + val a2 = listOf(1) + val a3 = listOf(2L) + val a4 = listOf(3F) + val a5 = listOf(4.0) + val a6 = listOf('c') + expect( + Tuple6(a1, a2, a3, a4, a5, a6) + .mapA6 { it.first() } + ) { + toEqual(Tuple6(a1, a2, a3, a4, a5, 'c')) + feature { f(it::a1) }.toBeTheInstance(a1) + feature { f(it::a2) }.toBeTheInstance(a2) + feature { f(it::a3) }.toBeTheInstance(a3) + feature { f(it::a4) }.toBeTheInstance(a4) + feature { f(it::a5) }.toBeTheInstance(a5) + } + } + +} \ No newline at end of file diff --git a/src/commonTest/generated/kotlin/ch/tutteli/kbox/map/Tuple7MapTest.kt b/src/commonTest/generated/kotlin/ch/tutteli/kbox/map/Tuple7MapTest.kt new file mode 100644 index 0000000..3170218 --- /dev/null +++ b/src/commonTest/generated/kotlin/ch/tutteli/kbox/map/Tuple7MapTest.kt @@ -0,0 +1,245 @@ +// -------------------------------------------------------------------------------------------------------------------- +// automatically generated, don't modify here but in: +// gradle/code-generation/src/main/kotlin/code-generation.generate.gradle.kts +// -------------------------------------------------------------------------------------------------------------------- +package ch.tutteli.kbox.map + +import ch.tutteli.atrium.api.fluent.en_GB.* +import ch.tutteli.atrium.api.verbs.expect +import ch.tutteli.kbox.* +import kotlin.test.Test + +class Tuple7MapTest { + + @Test + fun mapA1__identity__returns_equal_Tuple7() { + expect( + Tuple7("string", 1, 2L, 3F, 4.0, 'c', 1.toShort()) + .mapA1(::identity) + ).toEqual( + Tuple7("string", 1, 2L, 3F, 4.0, 'c', 1.toShort()) + ) + } + + @Test + fun mapA1__transformation_does_not_touch_other_properties() { + val a1 = listOf("string") + val a2 = listOf(1) + val a3 = listOf(2L) + val a4 = listOf(3F) + val a5 = listOf(4.0) + val a6 = listOf('c') + val a7 = listOf(1.toShort()) + expect( + Tuple7(a1, a2, a3, a4, a5, a6, a7) + .mapA1 { it.first() } + ) { + toEqual(Tuple7("string", a2, a3, a4, a5, a6, a7)) + feature { f(it::a2) }.toBeTheInstance(a2) + feature { f(it::a3) }.toBeTheInstance(a3) + feature { f(it::a4) }.toBeTheInstance(a4) + feature { f(it::a5) }.toBeTheInstance(a5) + feature { f(it::a6) }.toBeTheInstance(a6) + feature { f(it::a7) }.toBeTheInstance(a7) + } + } + + @Test + fun mapA2__identity__returns_equal_Tuple7() { + expect( + Tuple7("string", 1, 2L, 3F, 4.0, 'c', 1.toShort()) + .mapA2(::identity) + ).toEqual( + Tuple7("string", 1, 2L, 3F, 4.0, 'c', 1.toShort()) + ) + } + + @Test + fun mapA2__transformation_does_not_touch_other_properties() { + val a1 = listOf("string") + val a2 = listOf(1) + val a3 = listOf(2L) + val a4 = listOf(3F) + val a5 = listOf(4.0) + val a6 = listOf('c') + val a7 = listOf(1.toShort()) + expect( + Tuple7(a1, a2, a3, a4, a5, a6, a7) + .mapA2 { it.first() } + ) { + toEqual(Tuple7(a1, 1, a3, a4, a5, a6, a7)) + feature { f(it::a1) }.toBeTheInstance(a1) + feature { f(it::a3) }.toBeTheInstance(a3) + feature { f(it::a4) }.toBeTheInstance(a4) + feature { f(it::a5) }.toBeTheInstance(a5) + feature { f(it::a6) }.toBeTheInstance(a6) + feature { f(it::a7) }.toBeTheInstance(a7) + } + } + + @Test + fun mapA3__identity__returns_equal_Tuple7() { + expect( + Tuple7("string", 1, 2L, 3F, 4.0, 'c', 1.toShort()) + .mapA3(::identity) + ).toEqual( + Tuple7("string", 1, 2L, 3F, 4.0, 'c', 1.toShort()) + ) + } + + @Test + fun mapA3__transformation_does_not_touch_other_properties() { + val a1 = listOf("string") + val a2 = listOf(1) + val a3 = listOf(2L) + val a4 = listOf(3F) + val a5 = listOf(4.0) + val a6 = listOf('c') + val a7 = listOf(1.toShort()) + expect( + Tuple7(a1, a2, a3, a4, a5, a6, a7) + .mapA3 { it.first() } + ) { + toEqual(Tuple7(a1, a2, 2L, a4, a5, a6, a7)) + feature { f(it::a1) }.toBeTheInstance(a1) + feature { f(it::a2) }.toBeTheInstance(a2) + feature { f(it::a4) }.toBeTheInstance(a4) + feature { f(it::a5) }.toBeTheInstance(a5) + feature { f(it::a6) }.toBeTheInstance(a6) + feature { f(it::a7) }.toBeTheInstance(a7) + } + } + + @Test + fun mapA4__identity__returns_equal_Tuple7() { + expect( + Tuple7("string", 1, 2L, 3F, 4.0, 'c', 1.toShort()) + .mapA4(::identity) + ).toEqual( + Tuple7("string", 1, 2L, 3F, 4.0, 'c', 1.toShort()) + ) + } + + @Test + fun mapA4__transformation_does_not_touch_other_properties() { + val a1 = listOf("string") + val a2 = listOf(1) + val a3 = listOf(2L) + val a4 = listOf(3F) + val a5 = listOf(4.0) + val a6 = listOf('c') + val a7 = listOf(1.toShort()) + expect( + Tuple7(a1, a2, a3, a4, a5, a6, a7) + .mapA4 { it.first() } + ) { + toEqual(Tuple7(a1, a2, a3, 3F, a5, a6, a7)) + feature { f(it::a1) }.toBeTheInstance(a1) + feature { f(it::a2) }.toBeTheInstance(a2) + feature { f(it::a3) }.toBeTheInstance(a3) + feature { f(it::a5) }.toBeTheInstance(a5) + feature { f(it::a6) }.toBeTheInstance(a6) + feature { f(it::a7) }.toBeTheInstance(a7) + } + } + + @Test + fun mapA5__identity__returns_equal_Tuple7() { + expect( + Tuple7("string", 1, 2L, 3F, 4.0, 'c', 1.toShort()) + .mapA5(::identity) + ).toEqual( + Tuple7("string", 1, 2L, 3F, 4.0, 'c', 1.toShort()) + ) + } + + @Test + fun mapA5__transformation_does_not_touch_other_properties() { + val a1 = listOf("string") + val a2 = listOf(1) + val a3 = listOf(2L) + val a4 = listOf(3F) + val a5 = listOf(4.0) + val a6 = listOf('c') + val a7 = listOf(1.toShort()) + expect( + Tuple7(a1, a2, a3, a4, a5, a6, a7) + .mapA5 { it.first() } + ) { + toEqual(Tuple7(a1, a2, a3, a4, 4.0, a6, a7)) + feature { f(it::a1) }.toBeTheInstance(a1) + feature { f(it::a2) }.toBeTheInstance(a2) + feature { f(it::a3) }.toBeTheInstance(a3) + feature { f(it::a4) }.toBeTheInstance(a4) + feature { f(it::a6) }.toBeTheInstance(a6) + feature { f(it::a7) }.toBeTheInstance(a7) + } + } + + @Test + fun mapA6__identity__returns_equal_Tuple7() { + expect( + Tuple7("string", 1, 2L, 3F, 4.0, 'c', 1.toShort()) + .mapA6(::identity) + ).toEqual( + Tuple7("string", 1, 2L, 3F, 4.0, 'c', 1.toShort()) + ) + } + + @Test + fun mapA6__transformation_does_not_touch_other_properties() { + val a1 = listOf("string") + val a2 = listOf(1) + val a3 = listOf(2L) + val a4 = listOf(3F) + val a5 = listOf(4.0) + val a6 = listOf('c') + val a7 = listOf(1.toShort()) + expect( + Tuple7(a1, a2, a3, a4, a5, a6, a7) + .mapA6 { it.first() } + ) { + toEqual(Tuple7(a1, a2, a3, a4, a5, 'c', a7)) + feature { f(it::a1) }.toBeTheInstance(a1) + feature { f(it::a2) }.toBeTheInstance(a2) + feature { f(it::a3) }.toBeTheInstance(a3) + feature { f(it::a4) }.toBeTheInstance(a4) + feature { f(it::a5) }.toBeTheInstance(a5) + feature { f(it::a7) }.toBeTheInstance(a7) + } + } + + @Test + fun mapA7__identity__returns_equal_Tuple7() { + expect( + Tuple7("string", 1, 2L, 3F, 4.0, 'c', 1.toShort()) + .mapA7(::identity) + ).toEqual( + Tuple7("string", 1, 2L, 3F, 4.0, 'c', 1.toShort()) + ) + } + + @Test + fun mapA7__transformation_does_not_touch_other_properties() { + val a1 = listOf("string") + val a2 = listOf(1) + val a3 = listOf(2L) + val a4 = listOf(3F) + val a5 = listOf(4.0) + val a6 = listOf('c') + val a7 = listOf(1.toShort()) + expect( + Tuple7(a1, a2, a3, a4, a5, a6, a7) + .mapA7 { it.first() } + ) { + toEqual(Tuple7(a1, a2, a3, a4, a5, a6, 1.toShort())) + feature { f(it::a1) }.toBeTheInstance(a1) + feature { f(it::a2) }.toBeTheInstance(a2) + feature { f(it::a3) }.toBeTheInstance(a3) + feature { f(it::a4) }.toBeTheInstance(a4) + feature { f(it::a5) }.toBeTheInstance(a5) + feature { f(it::a6) }.toBeTheInstance(a6) + } + } + +} \ No newline at end of file diff --git a/src/commonTest/generated/kotlin/ch/tutteli/kbox/map/Tuple8MapTest.kt b/src/commonTest/generated/kotlin/ch/tutteli/kbox/map/Tuple8MapTest.kt new file mode 100644 index 0000000..23d1541 --- /dev/null +++ b/src/commonTest/generated/kotlin/ch/tutteli/kbox/map/Tuple8MapTest.kt @@ -0,0 +1,294 @@ +// -------------------------------------------------------------------------------------------------------------------- +// automatically generated, don't modify here but in: +// gradle/code-generation/src/main/kotlin/code-generation.generate.gradle.kts +// -------------------------------------------------------------------------------------------------------------------- +package ch.tutteli.kbox.map + +import ch.tutteli.atrium.api.fluent.en_GB.* +import ch.tutteli.atrium.api.verbs.expect +import ch.tutteli.kbox.* +import kotlin.test.Test + +class Tuple8MapTest { + + @Test + fun mapA1__identity__returns_equal_Tuple8() { + expect( + Tuple8("string", 1, 2L, 3F, 4.0, 'c', 1.toShort(), 2.toByte()) + .mapA1(::identity) + ).toEqual( + Tuple8("string", 1, 2L, 3F, 4.0, 'c', 1.toShort(), 2.toByte()) + ) + } + + @Test + fun mapA1__transformation_does_not_touch_other_properties() { + val a1 = listOf("string") + val a2 = listOf(1) + val a3 = listOf(2L) + val a4 = listOf(3F) + val a5 = listOf(4.0) + val a6 = listOf('c') + val a7 = listOf(1.toShort()) + val a8 = listOf(2.toByte()) + expect( + Tuple8(a1, a2, a3, a4, a5, a6, a7, a8) + .mapA1 { it.first() } + ) { + toEqual(Tuple8("string", a2, a3, a4, a5, a6, a7, a8)) + feature { f(it::a2) }.toBeTheInstance(a2) + feature { f(it::a3) }.toBeTheInstance(a3) + feature { f(it::a4) }.toBeTheInstance(a4) + feature { f(it::a5) }.toBeTheInstance(a5) + feature { f(it::a6) }.toBeTheInstance(a6) + feature { f(it::a7) }.toBeTheInstance(a7) + feature { f(it::a8) }.toBeTheInstance(a8) + } + } + + @Test + fun mapA2__identity__returns_equal_Tuple8() { + expect( + Tuple8("string", 1, 2L, 3F, 4.0, 'c', 1.toShort(), 2.toByte()) + .mapA2(::identity) + ).toEqual( + Tuple8("string", 1, 2L, 3F, 4.0, 'c', 1.toShort(), 2.toByte()) + ) + } + + @Test + fun mapA2__transformation_does_not_touch_other_properties() { + val a1 = listOf("string") + val a2 = listOf(1) + val a3 = listOf(2L) + val a4 = listOf(3F) + val a5 = listOf(4.0) + val a6 = listOf('c') + val a7 = listOf(1.toShort()) + val a8 = listOf(2.toByte()) + expect( + Tuple8(a1, a2, a3, a4, a5, a6, a7, a8) + .mapA2 { it.first() } + ) { + toEqual(Tuple8(a1, 1, a3, a4, a5, a6, a7, a8)) + feature { f(it::a1) }.toBeTheInstance(a1) + feature { f(it::a3) }.toBeTheInstance(a3) + feature { f(it::a4) }.toBeTheInstance(a4) + feature { f(it::a5) }.toBeTheInstance(a5) + feature { f(it::a6) }.toBeTheInstance(a6) + feature { f(it::a7) }.toBeTheInstance(a7) + feature { f(it::a8) }.toBeTheInstance(a8) + } + } + + @Test + fun mapA3__identity__returns_equal_Tuple8() { + expect( + Tuple8("string", 1, 2L, 3F, 4.0, 'c', 1.toShort(), 2.toByte()) + .mapA3(::identity) + ).toEqual( + Tuple8("string", 1, 2L, 3F, 4.0, 'c', 1.toShort(), 2.toByte()) + ) + } + + @Test + fun mapA3__transformation_does_not_touch_other_properties() { + val a1 = listOf("string") + val a2 = listOf(1) + val a3 = listOf(2L) + val a4 = listOf(3F) + val a5 = listOf(4.0) + val a6 = listOf('c') + val a7 = listOf(1.toShort()) + val a8 = listOf(2.toByte()) + expect( + Tuple8(a1, a2, a3, a4, a5, a6, a7, a8) + .mapA3 { it.first() } + ) { + toEqual(Tuple8(a1, a2, 2L, a4, a5, a6, a7, a8)) + feature { f(it::a1) }.toBeTheInstance(a1) + feature { f(it::a2) }.toBeTheInstance(a2) + feature { f(it::a4) }.toBeTheInstance(a4) + feature { f(it::a5) }.toBeTheInstance(a5) + feature { f(it::a6) }.toBeTheInstance(a6) + feature { f(it::a7) }.toBeTheInstance(a7) + feature { f(it::a8) }.toBeTheInstance(a8) + } + } + + @Test + fun mapA4__identity__returns_equal_Tuple8() { + expect( + Tuple8("string", 1, 2L, 3F, 4.0, 'c', 1.toShort(), 2.toByte()) + .mapA4(::identity) + ).toEqual( + Tuple8("string", 1, 2L, 3F, 4.0, 'c', 1.toShort(), 2.toByte()) + ) + } + + @Test + fun mapA4__transformation_does_not_touch_other_properties() { + val a1 = listOf("string") + val a2 = listOf(1) + val a3 = listOf(2L) + val a4 = listOf(3F) + val a5 = listOf(4.0) + val a6 = listOf('c') + val a7 = listOf(1.toShort()) + val a8 = listOf(2.toByte()) + expect( + Tuple8(a1, a2, a3, a4, a5, a6, a7, a8) + .mapA4 { it.first() } + ) { + toEqual(Tuple8(a1, a2, a3, 3F, a5, a6, a7, a8)) + feature { f(it::a1) }.toBeTheInstance(a1) + feature { f(it::a2) }.toBeTheInstance(a2) + feature { f(it::a3) }.toBeTheInstance(a3) + feature { f(it::a5) }.toBeTheInstance(a5) + feature { f(it::a6) }.toBeTheInstance(a6) + feature { f(it::a7) }.toBeTheInstance(a7) + feature { f(it::a8) }.toBeTheInstance(a8) + } + } + + @Test + fun mapA5__identity__returns_equal_Tuple8() { + expect( + Tuple8("string", 1, 2L, 3F, 4.0, 'c', 1.toShort(), 2.toByte()) + .mapA5(::identity) + ).toEqual( + Tuple8("string", 1, 2L, 3F, 4.0, 'c', 1.toShort(), 2.toByte()) + ) + } + + @Test + fun mapA5__transformation_does_not_touch_other_properties() { + val a1 = listOf("string") + val a2 = listOf(1) + val a3 = listOf(2L) + val a4 = listOf(3F) + val a5 = listOf(4.0) + val a6 = listOf('c') + val a7 = listOf(1.toShort()) + val a8 = listOf(2.toByte()) + expect( + Tuple8(a1, a2, a3, a4, a5, a6, a7, a8) + .mapA5 { it.first() } + ) { + toEqual(Tuple8(a1, a2, a3, a4, 4.0, a6, a7, a8)) + feature { f(it::a1) }.toBeTheInstance(a1) + feature { f(it::a2) }.toBeTheInstance(a2) + feature { f(it::a3) }.toBeTheInstance(a3) + feature { f(it::a4) }.toBeTheInstance(a4) + feature { f(it::a6) }.toBeTheInstance(a6) + feature { f(it::a7) }.toBeTheInstance(a7) + feature { f(it::a8) }.toBeTheInstance(a8) + } + } + + @Test + fun mapA6__identity__returns_equal_Tuple8() { + expect( + Tuple8("string", 1, 2L, 3F, 4.0, 'c', 1.toShort(), 2.toByte()) + .mapA6(::identity) + ).toEqual( + Tuple8("string", 1, 2L, 3F, 4.0, 'c', 1.toShort(), 2.toByte()) + ) + } + + @Test + fun mapA6__transformation_does_not_touch_other_properties() { + val a1 = listOf("string") + val a2 = listOf(1) + val a3 = listOf(2L) + val a4 = listOf(3F) + val a5 = listOf(4.0) + val a6 = listOf('c') + val a7 = listOf(1.toShort()) + val a8 = listOf(2.toByte()) + expect( + Tuple8(a1, a2, a3, a4, a5, a6, a7, a8) + .mapA6 { it.first() } + ) { + toEqual(Tuple8(a1, a2, a3, a4, a5, 'c', a7, a8)) + feature { f(it::a1) }.toBeTheInstance(a1) + feature { f(it::a2) }.toBeTheInstance(a2) + feature { f(it::a3) }.toBeTheInstance(a3) + feature { f(it::a4) }.toBeTheInstance(a4) + feature { f(it::a5) }.toBeTheInstance(a5) + feature { f(it::a7) }.toBeTheInstance(a7) + feature { f(it::a8) }.toBeTheInstance(a8) + } + } + + @Test + fun mapA7__identity__returns_equal_Tuple8() { + expect( + Tuple8("string", 1, 2L, 3F, 4.0, 'c', 1.toShort(), 2.toByte()) + .mapA7(::identity) + ).toEqual( + Tuple8("string", 1, 2L, 3F, 4.0, 'c', 1.toShort(), 2.toByte()) + ) + } + + @Test + fun mapA7__transformation_does_not_touch_other_properties() { + val a1 = listOf("string") + val a2 = listOf(1) + val a3 = listOf(2L) + val a4 = listOf(3F) + val a5 = listOf(4.0) + val a6 = listOf('c') + val a7 = listOf(1.toShort()) + val a8 = listOf(2.toByte()) + expect( + Tuple8(a1, a2, a3, a4, a5, a6, a7, a8) + .mapA7 { it.first() } + ) { + toEqual(Tuple8(a1, a2, a3, a4, a5, a6, 1.toShort(), a8)) + feature { f(it::a1) }.toBeTheInstance(a1) + feature { f(it::a2) }.toBeTheInstance(a2) + feature { f(it::a3) }.toBeTheInstance(a3) + feature { f(it::a4) }.toBeTheInstance(a4) + feature { f(it::a5) }.toBeTheInstance(a5) + feature { f(it::a6) }.toBeTheInstance(a6) + feature { f(it::a8) }.toBeTheInstance(a8) + } + } + + @Test + fun mapA8__identity__returns_equal_Tuple8() { + expect( + Tuple8("string", 1, 2L, 3F, 4.0, 'c', 1.toShort(), 2.toByte()) + .mapA8(::identity) + ).toEqual( + Tuple8("string", 1, 2L, 3F, 4.0, 'c', 1.toShort(), 2.toByte()) + ) + } + + @Test + fun mapA8__transformation_does_not_touch_other_properties() { + val a1 = listOf("string") + val a2 = listOf(1) + val a3 = listOf(2L) + val a4 = listOf(3F) + val a5 = listOf(4.0) + val a6 = listOf('c') + val a7 = listOf(1.toShort()) + val a8 = listOf(2.toByte()) + expect( + Tuple8(a1, a2, a3, a4, a5, a6, a7, a8) + .mapA8 { it.first() } + ) { + toEqual(Tuple8(a1, a2, a3, a4, a5, a6, a7, 2.toByte())) + feature { f(it::a1) }.toBeTheInstance(a1) + feature { f(it::a2) }.toBeTheInstance(a2) + feature { f(it::a3) }.toBeTheInstance(a3) + feature { f(it::a4) }.toBeTheInstance(a4) + feature { f(it::a5) }.toBeTheInstance(a5) + feature { f(it::a6) }.toBeTheInstance(a6) + feature { f(it::a7) }.toBeTheInstance(a7) + } + } + +} \ No newline at end of file diff --git a/src/commonTest/generated/kotlin/ch/tutteli/kbox/map/Tuple9MapTest.kt b/src/commonTest/generated/kotlin/ch/tutteli/kbox/map/Tuple9MapTest.kt new file mode 100644 index 0000000..8ce527c --- /dev/null +++ b/src/commonTest/generated/kotlin/ch/tutteli/kbox/map/Tuple9MapTest.kt @@ -0,0 +1,347 @@ +// -------------------------------------------------------------------------------------------------------------------- +// automatically generated, don't modify here but in: +// gradle/code-generation/src/main/kotlin/code-generation.generate.gradle.kts +// -------------------------------------------------------------------------------------------------------------------- +package ch.tutteli.kbox.map + +import ch.tutteli.atrium.api.fluent.en_GB.* +import ch.tutteli.atrium.api.verbs.expect +import ch.tutteli.kbox.* +import kotlin.test.Test + +class Tuple9MapTest { + + @Test + fun mapA1__identity__returns_equal_Tuple9() { + expect( + Tuple9("string", 1, 2L, 3F, 4.0, 'c', 1.toShort(), 2.toByte(), listOf(1, 2)) + .mapA1(::identity) + ).toEqual( + Tuple9("string", 1, 2L, 3F, 4.0, 'c', 1.toShort(), 2.toByte(), listOf(1, 2)) + ) + } + + @Test + fun mapA1__transformation_does_not_touch_other_properties() { + val a1 = listOf("string") + val a2 = listOf(1) + val a3 = listOf(2L) + val a4 = listOf(3F) + val a5 = listOf(4.0) + val a6 = listOf('c') + val a7 = listOf(1.toShort()) + val a8 = listOf(2.toByte()) + val a9 = listOf(listOf(1, 2)) + expect( + Tuple9(a1, a2, a3, a4, a5, a6, a7, a8, a9) + .mapA1 { it.first() } + ) { + toEqual(Tuple9("string", a2, a3, a4, a5, a6, a7, a8, a9)) + feature { f(it::a2) }.toBeTheInstance(a2) + feature { f(it::a3) }.toBeTheInstance(a3) + feature { f(it::a4) }.toBeTheInstance(a4) + feature { f(it::a5) }.toBeTheInstance(a5) + feature { f(it::a6) }.toBeTheInstance(a6) + feature { f(it::a7) }.toBeTheInstance(a7) + feature { f(it::a8) }.toBeTheInstance(a8) + feature { f(it::a9) }.toBeTheInstance(a9) + } + } + + @Test + fun mapA2__identity__returns_equal_Tuple9() { + expect( + Tuple9("string", 1, 2L, 3F, 4.0, 'c', 1.toShort(), 2.toByte(), listOf(1, 2)) + .mapA2(::identity) + ).toEqual( + Tuple9("string", 1, 2L, 3F, 4.0, 'c', 1.toShort(), 2.toByte(), listOf(1, 2)) + ) + } + + @Test + fun mapA2__transformation_does_not_touch_other_properties() { + val a1 = listOf("string") + val a2 = listOf(1) + val a3 = listOf(2L) + val a4 = listOf(3F) + val a5 = listOf(4.0) + val a6 = listOf('c') + val a7 = listOf(1.toShort()) + val a8 = listOf(2.toByte()) + val a9 = listOf(listOf(1, 2)) + expect( + Tuple9(a1, a2, a3, a4, a5, a6, a7, a8, a9) + .mapA2 { it.first() } + ) { + toEqual(Tuple9(a1, 1, a3, a4, a5, a6, a7, a8, a9)) + feature { f(it::a1) }.toBeTheInstance(a1) + feature { f(it::a3) }.toBeTheInstance(a3) + feature { f(it::a4) }.toBeTheInstance(a4) + feature { f(it::a5) }.toBeTheInstance(a5) + feature { f(it::a6) }.toBeTheInstance(a6) + feature { f(it::a7) }.toBeTheInstance(a7) + feature { f(it::a8) }.toBeTheInstance(a8) + feature { f(it::a9) }.toBeTheInstance(a9) + } + } + + @Test + fun mapA3__identity__returns_equal_Tuple9() { + expect( + Tuple9("string", 1, 2L, 3F, 4.0, 'c', 1.toShort(), 2.toByte(), listOf(1, 2)) + .mapA3(::identity) + ).toEqual( + Tuple9("string", 1, 2L, 3F, 4.0, 'c', 1.toShort(), 2.toByte(), listOf(1, 2)) + ) + } + + @Test + fun mapA3__transformation_does_not_touch_other_properties() { + val a1 = listOf("string") + val a2 = listOf(1) + val a3 = listOf(2L) + val a4 = listOf(3F) + val a5 = listOf(4.0) + val a6 = listOf('c') + val a7 = listOf(1.toShort()) + val a8 = listOf(2.toByte()) + val a9 = listOf(listOf(1, 2)) + expect( + Tuple9(a1, a2, a3, a4, a5, a6, a7, a8, a9) + .mapA3 { it.first() } + ) { + toEqual(Tuple9(a1, a2, 2L, a4, a5, a6, a7, a8, a9)) + feature { f(it::a1) }.toBeTheInstance(a1) + feature { f(it::a2) }.toBeTheInstance(a2) + feature { f(it::a4) }.toBeTheInstance(a4) + feature { f(it::a5) }.toBeTheInstance(a5) + feature { f(it::a6) }.toBeTheInstance(a6) + feature { f(it::a7) }.toBeTheInstance(a7) + feature { f(it::a8) }.toBeTheInstance(a8) + feature { f(it::a9) }.toBeTheInstance(a9) + } + } + + @Test + fun mapA4__identity__returns_equal_Tuple9() { + expect( + Tuple9("string", 1, 2L, 3F, 4.0, 'c', 1.toShort(), 2.toByte(), listOf(1, 2)) + .mapA4(::identity) + ).toEqual( + Tuple9("string", 1, 2L, 3F, 4.0, 'c', 1.toShort(), 2.toByte(), listOf(1, 2)) + ) + } + + @Test + fun mapA4__transformation_does_not_touch_other_properties() { + val a1 = listOf("string") + val a2 = listOf(1) + val a3 = listOf(2L) + val a4 = listOf(3F) + val a5 = listOf(4.0) + val a6 = listOf('c') + val a7 = listOf(1.toShort()) + val a8 = listOf(2.toByte()) + val a9 = listOf(listOf(1, 2)) + expect( + Tuple9(a1, a2, a3, a4, a5, a6, a7, a8, a9) + .mapA4 { it.first() } + ) { + toEqual(Tuple9(a1, a2, a3, 3F, a5, a6, a7, a8, a9)) + feature { f(it::a1) }.toBeTheInstance(a1) + feature { f(it::a2) }.toBeTheInstance(a2) + feature { f(it::a3) }.toBeTheInstance(a3) + feature { f(it::a5) }.toBeTheInstance(a5) + feature { f(it::a6) }.toBeTheInstance(a6) + feature { f(it::a7) }.toBeTheInstance(a7) + feature { f(it::a8) }.toBeTheInstance(a8) + feature { f(it::a9) }.toBeTheInstance(a9) + } + } + + @Test + fun mapA5__identity__returns_equal_Tuple9() { + expect( + Tuple9("string", 1, 2L, 3F, 4.0, 'c', 1.toShort(), 2.toByte(), listOf(1, 2)) + .mapA5(::identity) + ).toEqual( + Tuple9("string", 1, 2L, 3F, 4.0, 'c', 1.toShort(), 2.toByte(), listOf(1, 2)) + ) + } + + @Test + fun mapA5__transformation_does_not_touch_other_properties() { + val a1 = listOf("string") + val a2 = listOf(1) + val a3 = listOf(2L) + val a4 = listOf(3F) + val a5 = listOf(4.0) + val a6 = listOf('c') + val a7 = listOf(1.toShort()) + val a8 = listOf(2.toByte()) + val a9 = listOf(listOf(1, 2)) + expect( + Tuple9(a1, a2, a3, a4, a5, a6, a7, a8, a9) + .mapA5 { it.first() } + ) { + toEqual(Tuple9(a1, a2, a3, a4, 4.0, a6, a7, a8, a9)) + feature { f(it::a1) }.toBeTheInstance(a1) + feature { f(it::a2) }.toBeTheInstance(a2) + feature { f(it::a3) }.toBeTheInstance(a3) + feature { f(it::a4) }.toBeTheInstance(a4) + feature { f(it::a6) }.toBeTheInstance(a6) + feature { f(it::a7) }.toBeTheInstance(a7) + feature { f(it::a8) }.toBeTheInstance(a8) + feature { f(it::a9) }.toBeTheInstance(a9) + } + } + + @Test + fun mapA6__identity__returns_equal_Tuple9() { + expect( + Tuple9("string", 1, 2L, 3F, 4.0, 'c', 1.toShort(), 2.toByte(), listOf(1, 2)) + .mapA6(::identity) + ).toEqual( + Tuple9("string", 1, 2L, 3F, 4.0, 'c', 1.toShort(), 2.toByte(), listOf(1, 2)) + ) + } + + @Test + fun mapA6__transformation_does_not_touch_other_properties() { + val a1 = listOf("string") + val a2 = listOf(1) + val a3 = listOf(2L) + val a4 = listOf(3F) + val a5 = listOf(4.0) + val a6 = listOf('c') + val a7 = listOf(1.toShort()) + val a8 = listOf(2.toByte()) + val a9 = listOf(listOf(1, 2)) + expect( + Tuple9(a1, a2, a3, a4, a5, a6, a7, a8, a9) + .mapA6 { it.first() } + ) { + toEqual(Tuple9(a1, a2, a3, a4, a5, 'c', a7, a8, a9)) + feature { f(it::a1) }.toBeTheInstance(a1) + feature { f(it::a2) }.toBeTheInstance(a2) + feature { f(it::a3) }.toBeTheInstance(a3) + feature { f(it::a4) }.toBeTheInstance(a4) + feature { f(it::a5) }.toBeTheInstance(a5) + feature { f(it::a7) }.toBeTheInstance(a7) + feature { f(it::a8) }.toBeTheInstance(a8) + feature { f(it::a9) }.toBeTheInstance(a9) + } + } + + @Test + fun mapA7__identity__returns_equal_Tuple9() { + expect( + Tuple9("string", 1, 2L, 3F, 4.0, 'c', 1.toShort(), 2.toByte(), listOf(1, 2)) + .mapA7(::identity) + ).toEqual( + Tuple9("string", 1, 2L, 3F, 4.0, 'c', 1.toShort(), 2.toByte(), listOf(1, 2)) + ) + } + + @Test + fun mapA7__transformation_does_not_touch_other_properties() { + val a1 = listOf("string") + val a2 = listOf(1) + val a3 = listOf(2L) + val a4 = listOf(3F) + val a5 = listOf(4.0) + val a6 = listOf('c') + val a7 = listOf(1.toShort()) + val a8 = listOf(2.toByte()) + val a9 = listOf(listOf(1, 2)) + expect( + Tuple9(a1, a2, a3, a4, a5, a6, a7, a8, a9) + .mapA7 { it.first() } + ) { + toEqual(Tuple9(a1, a2, a3, a4, a5, a6, 1.toShort(), a8, a9)) + feature { f(it::a1) }.toBeTheInstance(a1) + feature { f(it::a2) }.toBeTheInstance(a2) + feature { f(it::a3) }.toBeTheInstance(a3) + feature { f(it::a4) }.toBeTheInstance(a4) + feature { f(it::a5) }.toBeTheInstance(a5) + feature { f(it::a6) }.toBeTheInstance(a6) + feature { f(it::a8) }.toBeTheInstance(a8) + feature { f(it::a9) }.toBeTheInstance(a9) + } + } + + @Test + fun mapA8__identity__returns_equal_Tuple9() { + expect( + Tuple9("string", 1, 2L, 3F, 4.0, 'c', 1.toShort(), 2.toByte(), listOf(1, 2)) + .mapA8(::identity) + ).toEqual( + Tuple9("string", 1, 2L, 3F, 4.0, 'c', 1.toShort(), 2.toByte(), listOf(1, 2)) + ) + } + + @Test + fun mapA8__transformation_does_not_touch_other_properties() { + val a1 = listOf("string") + val a2 = listOf(1) + val a3 = listOf(2L) + val a4 = listOf(3F) + val a5 = listOf(4.0) + val a6 = listOf('c') + val a7 = listOf(1.toShort()) + val a8 = listOf(2.toByte()) + val a9 = listOf(listOf(1, 2)) + expect( + Tuple9(a1, a2, a3, a4, a5, a6, a7, a8, a9) + .mapA8 { it.first() } + ) { + toEqual(Tuple9(a1, a2, a3, a4, a5, a6, a7, 2.toByte(), a9)) + feature { f(it::a1) }.toBeTheInstance(a1) + feature { f(it::a2) }.toBeTheInstance(a2) + feature { f(it::a3) }.toBeTheInstance(a3) + feature { f(it::a4) }.toBeTheInstance(a4) + feature { f(it::a5) }.toBeTheInstance(a5) + feature { f(it::a6) }.toBeTheInstance(a6) + feature { f(it::a7) }.toBeTheInstance(a7) + feature { f(it::a9) }.toBeTheInstance(a9) + } + } + + @Test + fun mapA9__identity__returns_equal_Tuple9() { + expect( + Tuple9("string", 1, 2L, 3F, 4.0, 'c', 1.toShort(), 2.toByte(), listOf(1, 2)) + .mapA9(::identity) + ).toEqual( + Tuple9("string", 1, 2L, 3F, 4.0, 'c', 1.toShort(), 2.toByte(), listOf(1, 2)) + ) + } + + @Test + fun mapA9__transformation_does_not_touch_other_properties() { + val a1 = listOf("string") + val a2 = listOf(1) + val a3 = listOf(2L) + val a4 = listOf(3F) + val a5 = listOf(4.0) + val a6 = listOf('c') + val a7 = listOf(1.toShort()) + val a8 = listOf(2.toByte()) + val a9 = listOf(listOf(1, 2)) + expect( + Tuple9(a1, a2, a3, a4, a5, a6, a7, a8, a9) + .mapA9 { it.first() } + ) { + toEqual(Tuple9(a1, a2, a3, a4, a5, a6, a7, a8, listOf(1, 2))) + feature { f(it::a1) }.toBeTheInstance(a1) + feature { f(it::a2) }.toBeTheInstance(a2) + feature { f(it::a3) }.toBeTheInstance(a3) + feature { f(it::a4) }.toBeTheInstance(a4) + feature { f(it::a5) }.toBeTheInstance(a5) + feature { f(it::a6) }.toBeTheInstance(a6) + feature { f(it::a7) }.toBeTheInstance(a7) + feature { f(it::a8) }.toBeTheInstance(a8) + } + } + +} \ No newline at end of file diff --git a/src/commonTest/kotlin/ch/tutteli/kbox/MapPairTest.kt b/src/commonTest/kotlin/ch/tutteli/kbox/MapPairTest.kt deleted file mode 100644 index 296e6ab..0000000 --- a/src/commonTest/kotlin/ch/tutteli/kbox/MapPairTest.kt +++ /dev/null @@ -1,38 +0,0 @@ -package ch.tutteli.kbox - -import ch.tutteli.atrium.api.fluent.en_GB.first -import ch.tutteli.atrium.api.fluent.en_GB.second -import ch.tutteli.atrium.api.fluent.en_GB.toBeTheInstance -import ch.tutteli.atrium.api.fluent.en_GB.toEqual -import ch.tutteli.atrium.api.verbs.expect -import kotlin.test.Test - -class MapTupleTest { - @Test - fun mapFirst_identity_returns_equal_pair() { - expect(Pair(1, "hello").mapFirst(::identity)).toEqual(Pair(1, "hello")) - } - - @Test - fun mapFirst_returns_transformation_does_not_touch_second_element() { - val obj = listOf('h', 'e', 'l', 'l', 'o') - expect(Pair(1, obj).mapFirst { it + 1 }) { - toEqual(Pair(2, obj)) - second.toBeTheInstance(obj) - } - } - - @Test - fun mapSecond_identity_returns_equal_pair() { - expect(Pair(1, "hello").mapSecond(::identity)).toEqual(Pair(1, "hello")) - } - - @Test - fun mapSecond_returns_transformation_does_not_touch_first_element() { - val obj = listOf('h', 'e', 'l', 'l', 'o') - expect(Pair(obj, 1).mapSecond { it + 1 }) { - toEqual(Pair(obj, 2)) - first.toBeTheInstance(obj) - } - } -}