Skip to content

Update samples that do not work in Playground #382

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions core/common/test/samples/byteStringSample.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ package kotlinx.io.samples
import kotlinx.io.*
import kotlinx.io.bytestring.ByteString
import kotlinx.io.bytestring.encodeToByteString
import kotlin.test.Test
import kotlin.test.assertEquals
import kotlin.test.assertTrue
import kotlin.test.*

class ByteStringSamples {
@Test
Expand Down
3 changes: 1 addition & 2 deletions core/common/test/samples/moduleDescriptionSample.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
package kotlinx.io.samples

import kotlinx.io.*
import kotlin.test.Test
import kotlin.test.assertEquals
import kotlin.test.*

data class Message(val timestamp: Long, val text: String) {
companion object
Expand Down
5 changes: 2 additions & 3 deletions core/common/test/samples/rawSinkSample.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
package kotlinx.io.samples

import kotlinx.io.*
import kotlin.test.Test
import kotlin.test.assertEquals
import kotlin.test.*

class Crc32Sample {
@OptIn(ExperimentalUnsignedTypes::class)
Expand All @@ -25,7 +24,7 @@ class Crc32Sample {
private var crc32: UInt = 0xffffffffU

private fun update(value: Byte) {
val index = value.xor(crc32.toByte()).toUByte()
val index = value.toUInt().xor(crc32).toUByte()
crc32 = crc32Table[index.toInt()].xor(crc32.shr(8))
}

Expand Down
3 changes: 1 addition & 2 deletions core/common/test/samples/rawSourceSample.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
package kotlinx.io.samples

import kotlinx.io.*
import kotlin.test.Test
import kotlin.test.assertEquals
import kotlin.test.*

class RC4SourceSample {
@Test
Expand Down
4 changes: 1 addition & 3 deletions core/common/test/samples/unsafe/unsafeSamples.kt
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ import kotlin.io.encoding.Base64
import kotlin.io.encoding.ExperimentalEncodingApi
import kotlin.math.min
import kotlin.random.Random
import kotlin.test.Test
import kotlin.test.assertEquals
import kotlin.test.assertTrue
import kotlin.test.*

class UnsafeBufferOperationsSamples {
@OptIn(UnsafeIoApi::class)
Expand Down
5 changes: 1 addition & 4 deletions core/jvm/test/samples/samplesJvm.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@ import java.io.ByteArrayOutputStream
import java.nio.ByteBuffer
import java.util.zip.GZIPInputStream
import java.util.zip.GZIPOutputStream
import kotlin.test.Test
import kotlin.test.assertContentEquals
import kotlin.test.assertEquals
import kotlin.test.assertTrue
import kotlin.test.*

class KotlinxIoSamplesJvm {
@Test
Expand Down
3 changes: 1 addition & 2 deletions core/jvm/test/samples/unsafeAccessSamplesJvm.kt
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ import java.nio.file.Files
import java.nio.file.StandardOpenOption
import java.security.MessageDigest
import kotlin.random.Random
import kotlin.test.Test
import kotlin.test.assertEquals
import kotlin.test.*

@OptIn(UnsafeIoApi::class)
class UnsafeReadWriteSamplesJvm {
Expand Down