Skip to content

Commit

Permalink
WIP Replace kotest-property with parameterize
Browse files Browse the repository at this point in the history
  • Loading branch information
BenWoodworth committed May 18, 2024
1 parent 3e27570 commit b549697
Show file tree
Hide file tree
Showing 15 changed files with 21 additions and 16 deletions.
2 changes: 2 additions & 0 deletions src/commonTest/kotlin/NbtTagTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ package net.benwoodworth.knbt

import com.benwoodworth.parameterize.parameter
import com.benwoodworth.parameterize.parameterOf
import net.benwoodworth.knbt.test.filter
import net.benwoodworth.knbt.test.parameterizeTest
import net.benwoodworth.knbt.test.parameters.*
import kotlin.reflect.KProperty1
import kotlin.test.*
Expand Down
2 changes: 2 additions & 0 deletions src/commonTest/kotlin/NbtVariantJavaNetworkTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import kotlinx.serialization.decodeFromByteArray
import kotlinx.serialization.encodeToByteArray
import net.benwoodworth.knbt.okio.decodeFromBufferedSource
import net.benwoodworth.knbt.test.asSource
import net.benwoodworth.knbt.test.filter
import net.benwoodworth.knbt.test.parameterizeTest
import net.benwoodworth.knbt.test.parameters.*
import okio.buffer
import kotlin.test.*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import kotlinx.serialization.descriptors.SerialDescriptor
import kotlinx.serialization.descriptors.buildSerialDescriptor
import kotlinx.serialization.encoding.*
import net.benwoodworth.knbt.test.NbtFormat
import net.benwoodworth.knbt.test.parameters.parameterizeTest
import net.benwoodworth.knbt.test.parameterizeTest
import kotlin.test.Test
import kotlin.test.assertEquals
import kotlin.test.assertFailsWith
Expand Down
4 changes: 2 additions & 2 deletions src/commonTest/kotlin/internal/BinaryNbtReaderTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import net.benwoodworth.knbt.NbtVariant.Java
import net.benwoodworth.knbt.okio.decodeFromBufferedSource
import net.benwoodworth.knbt.test.TestSource
import net.benwoodworth.knbt.test.file.nbtFiles
import net.benwoodworth.knbt.test.parameters.filter
import net.benwoodworth.knbt.test.filter
import net.benwoodworth.knbt.test.parameters.parameterOfNbtCompressions
import net.benwoodworth.knbt.test.parameters.parameterizeTest
import net.benwoodworth.knbt.test.parameterizeTest
import okio.buffer
import okio.use
import kotlin.test.*
Expand Down
2 changes: 1 addition & 1 deletion src/commonTest/kotlin/internal/BinaryNbtWriterTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import net.benwoodworth.knbt.okio.encodeToBufferedSink
import net.benwoodworth.knbt.test.TestSink
import net.benwoodworth.knbt.test.asSource
import net.benwoodworth.knbt.test.file.nbtFiles
import net.benwoodworth.knbt.test.parameters.parameterizeTest
import net.benwoodworth.knbt.test.parameterizeTest
import okio.blackholeSink
import okio.buffer
import okio.use
Expand Down
2 changes: 1 addition & 1 deletion src/commonTest/kotlin/internal/LittleEndianBase128Test.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package net.benwoodworth.knbt.internal

import com.benwoodworth.parameterize.parameter
import net.benwoodworth.knbt.test.parameters.parameterizeTest
import net.benwoodworth.knbt.test.parameterizeTest
import okio.Buffer
import kotlin.test.Test
import kotlin.test.assertContentEquals
Expand Down
2 changes: 1 addition & 1 deletion src/commonTest/kotlin/internal/NbtReaderDecoderTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import com.benwoodworth.parameterize.parameter
import kotlinx.serialization.Serializable
import net.benwoodworth.knbt.*
import net.benwoodworth.knbt.test.NbtFormat
import net.benwoodworth.knbt.test.parameters.parameterizeTest
import net.benwoodworth.knbt.test.parameterizeTest
import kotlin.math.PI
import kotlin.test.Test
import kotlin.test.assertEquals
Expand Down
8 changes: 4 additions & 4 deletions src/commonTest/kotlin/internal/NbtTagTypeTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@ package net.benwoodworth.knbt.internal
import com.benwoodworth.parameterize.parameter
import net.benwoodworth.knbt.*
import net.benwoodworth.knbt.internal.NbtTagType.*
import net.benwoodworth.knbt.test.parameters.filter
import net.benwoodworth.knbt.test.filter
import net.benwoodworth.knbt.test.parameters.parameterOfBytes
import net.benwoodworth.knbt.test.parameters.parameterizeTest
import net.benwoodworth.knbt.test.parameterizeTest
import kotlin.test.Test
import kotlin.test.assertEquals
import kotlin.test.assertNull

class NbtTagTypeTest {
@Test
fun converting_to_NbtTagType_or_null_from_a_valid_ID_byte_should_return_the_correct_tag() = parameterizeTest {
val expectedType by parameter(NbtTagType.entries)
val expectedType by parameter(entries)
val id = expectedType.id

assertEquals(expectedType, id.toNbtTagTypeOrNull())
Expand All @@ -23,7 +23,7 @@ class NbtTagTypeTest {
fun converting_to_NbtTagType_or_null_from_an_invalid_ID_byte_should_return_null() = parameterizeTest {
val invalidId by parameterOfBytes()
.filter { id ->
NbtTagType.entries.none { it.id == id }
entries.none { it.id == id }
}

assertNull(invalidId.toNbtTagTypeOrNull())
Expand Down
2 changes: 1 addition & 1 deletion src/commonTest/kotlin/internal/StringsTest.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package net.benwoodworth.knbt.internal

import net.benwoodworth.knbt.test.parameters.parameterOfBytes
import net.benwoodworth.knbt.test.parameters.parameterizeTest
import net.benwoodworth.knbt.test.parameterizeTest
import kotlin.test.Test
import kotlin.test.assertEquals
import kotlin.test.assertTrue
Expand Down
2 changes: 1 addition & 1 deletion src/commonTest/kotlin/internal/TreeNbtReaderTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import net.benwoodworth.knbt.internal.NbtTagType.*
import net.benwoodworth.knbt.test.NbtFormat
import net.benwoodworth.knbt.test.TestValues
import net.benwoodworth.knbt.test.file.*
import net.benwoodworth.knbt.test.parameters.parameterizeTest
import net.benwoodworth.knbt.test.parameterizeTest
import net.benwoodworth.knbt.test.shouldReturn
import kotlin.test.Test

Expand Down
2 changes: 1 addition & 1 deletion src/commonTest/kotlin/internal/TreeNbtWriterTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import net.benwoodworth.knbt.test.NbtFormat
import net.benwoodworth.knbt.test.TestValues
import net.benwoodworth.knbt.test.file.testClass
import net.benwoodworth.knbt.test.file.testTag
import net.benwoodworth.knbt.test.parameters.parameterizeTest
import net.benwoodworth.knbt.test.parameterizeTest
import kotlin.test.Test
import kotlin.test.assertEquals

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import net.benwoodworth.knbt.NbtDecoder
import net.benwoodworth.knbt.NbtInt
import net.benwoodworth.knbt.NbtString
import net.benwoodworth.knbt.test.parameters.parameterOfDifferentStrings
import net.benwoodworth.knbt.test.parameters.parameterizeTest
import net.benwoodworth.knbt.test.parameterizeTest
import kotlin.test.Test

@OptIn(InternalSerializationApi::class, ExperimentalSerializationApi::class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import net.benwoodworth.knbt.NbtContentPolymorphicSerializer
import net.benwoodworth.knbt.NbtTag
import net.benwoodworth.knbt.StringifiedNbt
import net.benwoodworth.knbt.nbtCompound
import net.benwoodworth.knbt.test.parameters.parameterizeTest
import net.benwoodworth.knbt.test.parameterizeTest
import kotlin.test.Test

class NbtContentPolymorphicSerializationTest : SerializationTest() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import kotlinx.serialization.builtins.serializer
import net.benwoodworth.knbt.NbtByte
import net.benwoodworth.knbt.NbtString
import net.benwoodworth.knbt.fromBoolean
import net.benwoodworth.knbt.test.parameterizeTest
import net.benwoodworth.knbt.test.parameters.*
import net.benwoodworth.knbt.toBoolean
import kotlin.test.Test
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package net.benwoodworth.knbt.test.parameters
package net.benwoodworth.knbt.test

import com.benwoodworth.parameterize.ExperimentalParameterizeApi
import com.benwoodworth.parameterize.ParameterizeScope
Expand Down

0 comments on commit b549697

Please sign in to comment.