improve ci
This commit is contained in:
92
.gitea/workflows/ci.yaml
Normal file
92
.gitea/workflows/ci.yaml
Normal file
@@ -0,0 +1,92 @@
|
|||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ develop, main ]
|
||||||
|
pull_request:
|
||||||
|
branches: [ main ]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
test:
|
||||||
|
runs-on: linux
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Setup Java
|
||||||
|
uses: actions/setup-java@v4
|
||||||
|
with:
|
||||||
|
java-version: '24'
|
||||||
|
distribution: 'temurin'
|
||||||
|
|
||||||
|
- name: Cache Gradle
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
key: gradle-${{ hashFiles('**/libs.versions.toml') }}
|
||||||
|
restore-keys: gradle-
|
||||||
|
path: |
|
||||||
|
~/.gradle/caches/
|
||||||
|
~/.gradle/wrapper/
|
||||||
|
|
||||||
|
- name: Cache Konan
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
key: konan-${{ hashFiles('**/libs.versions.toml') }}
|
||||||
|
restore-keys: konan-
|
||||||
|
path: |
|
||||||
|
~/.konan/
|
||||||
|
|
||||||
|
- name: Cache Node
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
key: node-${{ hashFiles('**/libs.versions.toml') }}
|
||||||
|
restore-keys: node-
|
||||||
|
path: |
|
||||||
|
~/.gradle/nodejs
|
||||||
|
~/.gradle/yarn
|
||||||
|
|
||||||
|
- name: Test
|
||||||
|
run: ./gradlew allTests
|
||||||
|
|
||||||
|
publish:
|
||||||
|
if: ${{ github.event_name == 'push' && github.ref_name == 'main' }}
|
||||||
|
needs: test
|
||||||
|
runs-on: linux
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Setup Java
|
||||||
|
uses: actions/setup-java@v4
|
||||||
|
with:
|
||||||
|
java-version: '24'
|
||||||
|
distribution: 'temurin'
|
||||||
|
|
||||||
|
- name: Cache Gradle
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
key: gradle-${{ hashFiles('**/libs.versions.toml') }}
|
||||||
|
restore-keys: gradle-
|
||||||
|
path: |
|
||||||
|
~/.gradle/caches/
|
||||||
|
~/.gradle/wrapper/
|
||||||
|
|
||||||
|
- name: Cache Konan
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
key: konan-${{ hashFiles('**/libs.versions.toml') }}
|
||||||
|
restore-keys: konan-
|
||||||
|
path: |
|
||||||
|
~/.konan/
|
||||||
|
|
||||||
|
- name: Cache Node
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
key: node-${{ hashFiles('**/libs.versions.toml') }}
|
||||||
|
restore-keys: node-
|
||||||
|
path: |
|
||||||
|
~/.gradle/nodejs
|
||||||
|
~/.gradle/yarn
|
||||||
|
|
||||||
|
- name: Publish
|
||||||
|
run: ./gradlew publish
|
||||||
|
env:
|
||||||
|
INFENDRO__TOKEN: ${{ secrets.TOKEN }}
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
|
|
||||||
env:
|
|
||||||
INFENDRO__TOKEN: ${{ secrets.TOKEN }}
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
publish:
|
|
||||||
runs-on: linux
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- uses: actions/cache/restore@v4
|
|
||||||
with:
|
|
||||||
key: gradle
|
|
||||||
path: |
|
|
||||||
~/.gradle/caches/
|
|
||||||
~/.gradle/wrapper/
|
|
||||||
~/.konan/
|
|
||||||
|
|
||||||
- uses: actions/setup-java@v4
|
|
||||||
with:
|
|
||||||
java-version: '24'
|
|
||||||
distribution: 'temurin'
|
|
||||||
|
|
||||||
- run: ./gradlew publish
|
|
||||||
|
|
||||||
- uses: actions/cache/save@v4
|
|
||||||
with:
|
|
||||||
key: gradle
|
|
||||||
path: |
|
|
||||||
~/.gradle/caches/
|
|
||||||
~/.gradle/wrapper/
|
|
||||||
~/.konan/
|
|
||||||
@@ -7,7 +7,7 @@ import kotlin.test.assertEquals
|
|||||||
|
|
||||||
class `Conversion Test` {
|
class `Conversion Test` {
|
||||||
@Test
|
@Test
|
||||||
fun `ByteArray - toInt()`() {
|
fun `ByteArray toInt`() {
|
||||||
val expected = 0x12345678
|
val expected = 0x12345678
|
||||||
val actual = arrayOf(
|
val actual = arrayOf(
|
||||||
byteArrayOf(0x12, 0x34, 0x56, 0x78).toInt(),
|
byteArrayOf(0x12, 0x34, 0x56, 0x78).toInt(),
|
||||||
@@ -18,7 +18,7 @@ class `Conversion Test` {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `UByteArray - toInt()`() {
|
fun `UByteArray toInt`() {
|
||||||
val expected = 0x12345678
|
val expected = 0x12345678
|
||||||
val actual = arrayOf(
|
val actual = arrayOf(
|
||||||
ubyteArrayOf(0x12U, 0x34U, 0x56U, 0x78U).toInt(),
|
ubyteArrayOf(0x12U, 0x34U, 0x56U, 0x78U).toInt(),
|
||||||
@@ -29,7 +29,7 @@ class `Conversion Test` {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `ByteArray - toUInt()`() {
|
fun `ByteArray toUInt`() {
|
||||||
val expected = 0x12345678U
|
val expected = 0x12345678U
|
||||||
val actual = arrayOf(
|
val actual = arrayOf(
|
||||||
byteArrayOf(0x12, 0x34, 0x56, 0x78).toUInt(),
|
byteArrayOf(0x12, 0x34, 0x56, 0x78).toUInt(),
|
||||||
@@ -40,7 +40,7 @@ class `Conversion Test` {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `UByteArray - toUInt()`() {
|
fun `UByteArray toUInt`() {
|
||||||
val expected = 0x12345678U
|
val expected = 0x12345678U
|
||||||
val actual = arrayOf(
|
val actual = arrayOf(
|
||||||
ubyteArrayOf(0x12U, 0x34U, 0x56U, 0x78U).toUInt(),
|
ubyteArrayOf(0x12U, 0x34U, 0x56U, 0x78U).toUInt(),
|
||||||
@@ -51,7 +51,7 @@ class `Conversion Test` {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `ByteArray - toIntArray()`() {
|
fun `ByteArray toIntArray`() {
|
||||||
val expected = intArrayOf(0x12345678, 0x12345678)
|
val expected = intArrayOf(0x12345678, 0x12345678)
|
||||||
val actual = arrayOf(
|
val actual = arrayOf(
|
||||||
byteArrayOf(
|
byteArrayOf(
|
||||||
@@ -68,7 +68,7 @@ class `Conversion Test` {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `UByteArray - toIntArray()`() {
|
fun `UByteArray toIntArray`() {
|
||||||
val expected = intArrayOf(0x12345678, 0x12345678)
|
val expected = intArrayOf(0x12345678, 0x12345678)
|
||||||
val actual = arrayOf(
|
val actual = arrayOf(
|
||||||
ubyteArrayOf(
|
ubyteArrayOf(
|
||||||
@@ -85,7 +85,7 @@ class `Conversion Test` {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `ByteArray - toUIntArray()`() {
|
fun `ByteArray toUIntArray`() {
|
||||||
val expected = uintArrayOf(0x12345678U, 0x12345678U)
|
val expected = uintArrayOf(0x12345678U, 0x12345678U)
|
||||||
val actual = arrayOf(
|
val actual = arrayOf(
|
||||||
byteArrayOf(
|
byteArrayOf(
|
||||||
@@ -102,7 +102,7 @@ class `Conversion Test` {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `UByteArray - toUIntArray()`() {
|
fun `UByteArray toUIntArray`() {
|
||||||
val expected = uintArrayOf(0x12345678U, 0x12345678U)
|
val expected = uintArrayOf(0x12345678U, 0x12345678U)
|
||||||
val actual = arrayOf(
|
val actual = arrayOf(
|
||||||
ubyteArrayOf(
|
ubyteArrayOf(
|
||||||
@@ -119,7 +119,7 @@ class `Conversion Test` {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `Int - toByteArray()`() {
|
fun `Int toByteArray`() {
|
||||||
val expected = arrayOf(
|
val expected = arrayOf(
|
||||||
byteArrayOf(0x12, 0x34, 0x56, 0x78),
|
byteArrayOf(0x12, 0x34, 0x56, 0x78),
|
||||||
byteArrayOf(0x78, 0x56, 0x34, 0x12),
|
byteArrayOf(0x78, 0x56, 0x34, 0x12),
|
||||||
@@ -134,7 +134,7 @@ class `Conversion Test` {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `UInt - toByteArray()`() {
|
fun `UInt toByteArray`() {
|
||||||
val expected = arrayOf(
|
val expected = arrayOf(
|
||||||
byteArrayOf(0x12, 0x34, 0x56, 0x78),
|
byteArrayOf(0x12, 0x34, 0x56, 0x78),
|
||||||
byteArrayOf(0x78, 0x56, 0x34, 0x12),
|
byteArrayOf(0x78, 0x56, 0x34, 0x12),
|
||||||
@@ -149,7 +149,7 @@ class `Conversion Test` {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `Int - toUByteArray()`() {
|
fun `Int toUByteArray`() {
|
||||||
val expected = arrayOf(
|
val expected = arrayOf(
|
||||||
ubyteArrayOf(0x12U, 0x34U, 0x56U, 0x78U),
|
ubyteArrayOf(0x12U, 0x34U, 0x56U, 0x78U),
|
||||||
ubyteArrayOf(0x78U, 0x56U, 0x34U, 0x12U),
|
ubyteArrayOf(0x78U, 0x56U, 0x34U, 0x12U),
|
||||||
@@ -164,7 +164,7 @@ class `Conversion Test` {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `UInt - toUByteArray()`() {
|
fun `UInt toUByteArray`() {
|
||||||
val expected = arrayOf(
|
val expected = arrayOf(
|
||||||
ubyteArrayOf(0x12U, 0x34U, 0x56U, 0x78U),
|
ubyteArrayOf(0x12U, 0x34U, 0x56U, 0x78U),
|
||||||
ubyteArrayOf(0x78U, 0x56U, 0x34U, 0x12U),
|
ubyteArrayOf(0x78U, 0x56U, 0x34U, 0x12U),
|
||||||
@@ -179,7 +179,7 @@ class `Conversion Test` {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `IntArray - toByteArray()`() {
|
fun `IntArray toByteArray`() {
|
||||||
val expected = arrayOf(
|
val expected = arrayOf(
|
||||||
byteArrayOf(
|
byteArrayOf(
|
||||||
0x12, 0x34, 0x56, 0x78,
|
0x12, 0x34, 0x56, 0x78,
|
||||||
@@ -206,7 +206,7 @@ class `Conversion Test` {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `UIntArray - toByteArray()`() {
|
fun `UIntArray toByteArray`() {
|
||||||
val expected = arrayOf(
|
val expected = arrayOf(
|
||||||
byteArrayOf(
|
byteArrayOf(
|
||||||
0x12, 0x34, 0x56, 0x78,
|
0x12, 0x34, 0x56, 0x78,
|
||||||
@@ -233,7 +233,7 @@ class `Conversion Test` {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `IntArray - toUByteArray()`() {
|
fun `IntArray toUByteArray`() {
|
||||||
val expected = arrayOf(
|
val expected = arrayOf(
|
||||||
ubyteArrayOf(
|
ubyteArrayOf(
|
||||||
0x12U, 0x34U, 0x56U, 0x78U,
|
0x12U, 0x34U, 0x56U, 0x78U,
|
||||||
@@ -260,7 +260,7 @@ class `Conversion Test` {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `UIntArray - toUByteArray()`() {
|
fun `UIntArray toUByteArray`() {
|
||||||
val expected = arrayOf(
|
val expected = arrayOf(
|
||||||
ubyteArrayOf(
|
ubyteArrayOf(
|
||||||
0x12U, 0x34U, 0x56U, 0x78U,
|
0x12U, 0x34U, 0x56U, 0x78U,
|
||||||
@@ -287,7 +287,7 @@ class `Conversion Test` {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `ByteArray - toLong()`() {
|
fun `ByteArray toLong`() {
|
||||||
val expected = 0x1234567812345678L
|
val expected = 0x1234567812345678L
|
||||||
val actual = arrayOf(
|
val actual = arrayOf(
|
||||||
byteArrayOf(0x12, 0x34, 0x56, 0x78, 0x12, 0x34, 0x56, 0x78).toLong(),
|
byteArrayOf(0x12, 0x34, 0x56, 0x78, 0x12, 0x34, 0x56, 0x78).toLong(),
|
||||||
@@ -298,7 +298,7 @@ class `Conversion Test` {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `UByteArray - toULong()`() {
|
fun `UByteArray toULong`() {
|
||||||
val expected = 0x1234567812345678UL
|
val expected = 0x1234567812345678UL
|
||||||
val actual = arrayOf(
|
val actual = arrayOf(
|
||||||
ubyteArrayOf(0x12U, 0x34U, 0x56U, 0x78U, 0x12U, 0x34U, 0x56U, 0x78U).toULong(),
|
ubyteArrayOf(0x12U, 0x34U, 0x56U, 0x78U, 0x12U, 0x34U, 0x56U, 0x78U).toULong(),
|
||||||
@@ -309,7 +309,7 @@ class `Conversion Test` {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `UByteArray - toLong()`() {
|
fun `UByteArray toLong`() {
|
||||||
val expected = 0x1234567812345678L
|
val expected = 0x1234567812345678L
|
||||||
val actual = arrayOf(
|
val actual = arrayOf(
|
||||||
ubyteArrayOf(0x12U, 0x34U, 0x56U, 0x78U, 0x12U, 0x34U, 0x56U, 0x78U).toLong(),
|
ubyteArrayOf(0x12U, 0x34U, 0x56U, 0x78U, 0x12U, 0x34U, 0x56U, 0x78U).toLong(),
|
||||||
@@ -320,7 +320,7 @@ class `Conversion Test` {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `ByteArray - toULong()`() {
|
fun `ByteArray toULong`() {
|
||||||
val expected = 0x1234567812345678UL
|
val expected = 0x1234567812345678UL
|
||||||
val actual = arrayOf(
|
val actual = arrayOf(
|
||||||
byteArrayOf(0x12, 0x34, 0x56, 0x78, 0x12, 0x34, 0x56, 0x78).toULong(),
|
byteArrayOf(0x12, 0x34, 0x56, 0x78, 0x12, 0x34, 0x56, 0x78).toULong(),
|
||||||
@@ -331,7 +331,7 @@ class `Conversion Test` {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `ByteArray - toLongArray()`() {
|
fun `ByteArray toLongArray`() {
|
||||||
val expected = longArrayOf(0x1234567812345678L, 0x1234567812345678L)
|
val expected = longArrayOf(0x1234567812345678L, 0x1234567812345678L)
|
||||||
val actual = arrayOf(
|
val actual = arrayOf(
|
||||||
byteArrayOf(
|
byteArrayOf(
|
||||||
@@ -348,7 +348,7 @@ class `Conversion Test` {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `UByteArray - toLongArray()`() {
|
fun `UByteArray toLongArray`() {
|
||||||
val expected = longArrayOf(0x1234567812345678L, 0x1234567812345678L)
|
val expected = longArrayOf(0x1234567812345678L, 0x1234567812345678L)
|
||||||
val actual = arrayOf(
|
val actual = arrayOf(
|
||||||
ubyteArrayOf(
|
ubyteArrayOf(
|
||||||
@@ -365,7 +365,7 @@ class `Conversion Test` {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `ByteArray - toULongArray()`() {
|
fun `ByteArray toULongArray`() {
|
||||||
val expected = ulongArrayOf(0x1234567812345678UL, 0x1234567812345678UL)
|
val expected = ulongArrayOf(0x1234567812345678UL, 0x1234567812345678UL)
|
||||||
val actual = arrayOf(
|
val actual = arrayOf(
|
||||||
byteArrayOf(
|
byteArrayOf(
|
||||||
@@ -382,7 +382,7 @@ class `Conversion Test` {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `UByteArray - toULongArray()`() {
|
fun `UByteArray toULongArray`() {
|
||||||
val expected = ulongArrayOf(0x1234567812345678UL, 0x1234567812345678UL)
|
val expected = ulongArrayOf(0x1234567812345678UL, 0x1234567812345678UL)
|
||||||
val actual = arrayOf(
|
val actual = arrayOf(
|
||||||
ubyteArrayOf(
|
ubyteArrayOf(
|
||||||
@@ -399,7 +399,7 @@ class `Conversion Test` {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `Long - toByteArray()`() {
|
fun `Long toByteArray`() {
|
||||||
val expected = arrayOf(
|
val expected = arrayOf(
|
||||||
byteArrayOf(0x12, 0x34, 0x56, 0x78, 0x12, 0x34, 0x56, 0x78),
|
byteArrayOf(0x12, 0x34, 0x56, 0x78, 0x12, 0x34, 0x56, 0x78),
|
||||||
byteArrayOf(0x78, 0x56, 0x34, 0x12, 0x78, 0x56, 0x34, 0x12),
|
byteArrayOf(0x78, 0x56, 0x34, 0x12, 0x78, 0x56, 0x34, 0x12),
|
||||||
@@ -414,7 +414,7 @@ class `Conversion Test` {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `ULong - toByteArray()`() {
|
fun `ULong toByteArray`() {
|
||||||
val expected = arrayOf(
|
val expected = arrayOf(
|
||||||
byteArrayOf(0x12, 0x34, 0x56, 0x78, 0x12, 0x34, 0x56, 0x78),
|
byteArrayOf(0x12, 0x34, 0x56, 0x78, 0x12, 0x34, 0x56, 0x78),
|
||||||
byteArrayOf(0x78, 0x56, 0x34, 0x12, 0x78, 0x56, 0x34, 0x12),
|
byteArrayOf(0x78, 0x56, 0x34, 0x12, 0x78, 0x56, 0x34, 0x12),
|
||||||
@@ -429,7 +429,7 @@ class `Conversion Test` {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `Long - toUByteArray()`() {
|
fun `Long toUByteArray`() {
|
||||||
val expected = arrayOf(
|
val expected = arrayOf(
|
||||||
ubyteArrayOf(0x12U, 0x34U, 0x56U, 0x78U, 0x12U, 0x34U, 0x56U, 0x78U),
|
ubyteArrayOf(0x12U, 0x34U, 0x56U, 0x78U, 0x12U, 0x34U, 0x56U, 0x78U),
|
||||||
ubyteArrayOf(0x78U, 0x56U, 0x34U, 0x12U, 0x78U, 0x56U, 0x34U, 0x12U),
|
ubyteArrayOf(0x78U, 0x56U, 0x34U, 0x12U, 0x78U, 0x56U, 0x34U, 0x12U),
|
||||||
@@ -444,7 +444,7 @@ class `Conversion Test` {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `ULong - toUByteArray()`() {
|
fun `ULong toUByteArray`() {
|
||||||
val expected = arrayOf(
|
val expected = arrayOf(
|
||||||
ubyteArrayOf(0x12U, 0x34U, 0x56U, 0x78U, 0x12U, 0x34U, 0x56U, 0x78U),
|
ubyteArrayOf(0x12U, 0x34U, 0x56U, 0x78U, 0x12U, 0x34U, 0x56U, 0x78U),
|
||||||
ubyteArrayOf(0x78U, 0x56U, 0x34U, 0x12U, 0x78U, 0x56U, 0x34U, 0x12U),
|
ubyteArrayOf(0x78U, 0x56U, 0x34U, 0x12U, 0x78U, 0x56U, 0x34U, 0x12U),
|
||||||
@@ -459,7 +459,7 @@ class `Conversion Test` {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `LongArray - toByteArray()`() {
|
fun `LongArray toByteArray`() {
|
||||||
val expected = arrayOf(
|
val expected = arrayOf(
|
||||||
byteArrayOf(
|
byteArrayOf(
|
||||||
0x12, 0x34, 0x56, 0x78, 0x12, 0x34, 0x56, 0x78,
|
0x12, 0x34, 0x56, 0x78, 0x12, 0x34, 0x56, 0x78,
|
||||||
@@ -486,7 +486,7 @@ class `Conversion Test` {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `ULongArray - toByteArray()`() {
|
fun `ULongArray toByteArray`() {
|
||||||
val expected = arrayOf(
|
val expected = arrayOf(
|
||||||
byteArrayOf(
|
byteArrayOf(
|
||||||
0x12, 0x34, 0x56, 0x78, 0x12, 0x34, 0x56, 0x78,
|
0x12, 0x34, 0x56, 0x78, 0x12, 0x34, 0x56, 0x78,
|
||||||
@@ -513,7 +513,7 @@ class `Conversion Test` {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `LongArray - toUByteArray()`() {
|
fun `LongArray toUByteArray`() {
|
||||||
val expected = arrayOf(
|
val expected = arrayOf(
|
||||||
ubyteArrayOf(
|
ubyteArrayOf(
|
||||||
0x12U, 0x34U, 0x56U, 0x78U, 0x12U, 0x34U, 0x56U, 0x78U,
|
0x12U, 0x34U, 0x56U, 0x78U, 0x12U, 0x34U, 0x56U, 0x78U,
|
||||||
@@ -540,7 +540,7 @@ class `Conversion Test` {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `ULongArray - toUByteArray()`() {
|
fun `ULongArray toUByteArray`() {
|
||||||
val expected = arrayOf(
|
val expected = arrayOf(
|
||||||
ubyteArrayOf(
|
ubyteArrayOf(
|
||||||
0x12U, 0x34U, 0x56U, 0x78U, 0x12U, 0x34U, 0x56U, 0x78U,
|
0x12U, 0x34U, 0x56U, 0x78U, 0x12U, 0x34U, 0x56U, 0x78U,
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import kotlin.test.assertEquals
|
|||||||
|
|
||||||
class `Modification Test` {
|
class `Modification Test` {
|
||||||
@Test
|
@Test
|
||||||
fun `ByteArray - padStart()`() {
|
fun `ByteArray padStart`() {
|
||||||
val expected = byteArrayOf(0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02)
|
val expected = byteArrayOf(0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02)
|
||||||
val actual = byteArrayOf(0x02, 0x02).padStart(8, 0x01)
|
val actual = byteArrayOf(0x02, 0x02).padStart(8, 0x01)
|
||||||
assertEquals(8, actual.size)
|
assertEquals(8, actual.size)
|
||||||
@@ -14,7 +14,7 @@ class `Modification Test` {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `ByteArray - padStart() - unchanged`() {
|
fun `ByteArray padStart - unchanged`() {
|
||||||
val expected = byteArrayOf(0x02, 0x02)
|
val expected = byteArrayOf(0x02, 0x02)
|
||||||
val actual = byteArrayOf(0x02, 0x02).padStart(2, 0x01)
|
val actual = byteArrayOf(0x02, 0x02).padStart(2, 0x01)
|
||||||
assertEquals(2, actual.size)
|
assertEquals(2, actual.size)
|
||||||
@@ -22,7 +22,7 @@ class `Modification Test` {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `UByteArray - padStart()`() {
|
fun `UByteArray padStart`() {
|
||||||
val expected = ubyteArrayOf(0x01U, 0x01U, 0x01U, 0x01U, 0x01U, 0x01U, 0x02U, 0x02U)
|
val expected = ubyteArrayOf(0x01U, 0x01U, 0x01U, 0x01U, 0x01U, 0x01U, 0x02U, 0x02U)
|
||||||
val actual = ubyteArrayOf(0x02U, 0x02U).padStart(8, 0x01U)
|
val actual = ubyteArrayOf(0x02U, 0x02U).padStart(8, 0x01U)
|
||||||
assertEquals(8, actual.size)
|
assertEquals(8, actual.size)
|
||||||
@@ -30,7 +30,7 @@ class `Modification Test` {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `UByteArray - padStart() - unchanged`() {
|
fun `UByteArray padStart - unchanged`() {
|
||||||
val expected = ubyteArrayOf(0x02U, 0x02U)
|
val expected = ubyteArrayOf(0x02U, 0x02U)
|
||||||
val actual = ubyteArrayOf(0x02U, 0x02U).padStart(2, 0x01U)
|
val actual = ubyteArrayOf(0x02U, 0x02U).padStart(2, 0x01U)
|
||||||
assertEquals(2, actual.size)
|
assertEquals(2, actual.size)
|
||||||
@@ -38,7 +38,7 @@ class `Modification Test` {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `ByteArray - padEnd()`() {
|
fun `ByteArray padEnd`() {
|
||||||
val expected = byteArrayOf(0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01)
|
val expected = byteArrayOf(0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01)
|
||||||
val actual = byteArrayOf(0x02, 0x02).padEnd(8, 0x01)
|
val actual = byteArrayOf(0x02, 0x02).padEnd(8, 0x01)
|
||||||
assertEquals(8, actual.size)
|
assertEquals(8, actual.size)
|
||||||
@@ -46,7 +46,7 @@ class `Modification Test` {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `ByteArray - padEnd() - unchanged`() {
|
fun `ByteArray padEnd - unchanged`() {
|
||||||
val expected = byteArrayOf(0x02, 0x02)
|
val expected = byteArrayOf(0x02, 0x02)
|
||||||
val actual = byteArrayOf(0x02, 0x02).padEnd(2, 0x01)
|
val actual = byteArrayOf(0x02, 0x02).padEnd(2, 0x01)
|
||||||
assertEquals(2, actual.size)
|
assertEquals(2, actual.size)
|
||||||
@@ -54,7 +54,7 @@ class `Modification Test` {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `UByteArray - padEnd()`() {
|
fun `UByteArray padEnd`() {
|
||||||
val expected = ubyteArrayOf(0x02U, 0x02U, 0x01U, 0x01U, 0x01U, 0x01U, 0x01U, 0x01U)
|
val expected = ubyteArrayOf(0x02U, 0x02U, 0x01U, 0x01U, 0x01U, 0x01U, 0x01U, 0x01U)
|
||||||
val actual = ubyteArrayOf(0x02U, 0x02U).padEnd(8, 0x01U)
|
val actual = ubyteArrayOf(0x02U, 0x02U).padEnd(8, 0x01U)
|
||||||
assertEquals(8, actual.size)
|
assertEquals(8, actual.size)
|
||||||
@@ -62,7 +62,7 @@ class `Modification Test` {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `UByteArray - padEnd() - unchanged`() {
|
fun `UByteArray padEnd - unchanged`() {
|
||||||
val expected = ubyteArrayOf(0x02U, 0x02U)
|
val expected = ubyteArrayOf(0x02U, 0x02U)
|
||||||
val actual = ubyteArrayOf(0x02U, 0x02U).padEnd(2, 0x01U)
|
val actual = ubyteArrayOf(0x02U, 0x02U).padEnd(2, 0x01U)
|
||||||
assertEquals(2, actual.size)
|
assertEquals(2, actual.size)
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import kotlin.test.assertFails
|
|||||||
|
|
||||||
class `Operators Test` {
|
class `Operators Test` {
|
||||||
@Test
|
@Test
|
||||||
fun `ByteArray - and() - size`() {
|
fun `ByteArray and - size`() {
|
||||||
assertFails {
|
assertFails {
|
||||||
byteArrayOf() and byteArrayOf(0x00)
|
byteArrayOf() and byteArrayOf(0x00)
|
||||||
}
|
}
|
||||||
@@ -16,14 +16,14 @@ class `Operators Test` {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `ByteArray - and()`() {
|
fun `ByteArray and`() {
|
||||||
val expected = byteArrayOf(0x18, 0x00)
|
val expected = byteArrayOf(0x18, 0x00)
|
||||||
val actual = byteArrayOf(0x5C, 0x70) and byteArrayOf(0x3A, 0x0F)
|
val actual = byteArrayOf(0x5C, 0x70) and byteArrayOf(0x3A, 0x0F)
|
||||||
assertContentEquals(expected, actual)
|
assertContentEquals(expected, actual)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `UByteArray - and() - size`() {
|
fun `UByteArray and - size`() {
|
||||||
assertFails {
|
assertFails {
|
||||||
ubyteArrayOf() and ubyteArrayOf(0x00U)
|
ubyteArrayOf() and ubyteArrayOf(0x00U)
|
||||||
}
|
}
|
||||||
@@ -33,14 +33,14 @@ class `Operators Test` {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `UByteArray - and()`() {
|
fun `UByteArray and`() {
|
||||||
val expected = ubyteArrayOf(0x18U, 0x00U)
|
val expected = ubyteArrayOf(0x18U, 0x00U)
|
||||||
val actual = ubyteArrayOf(0x5CU, 0x70U) and ubyteArrayOf(0x3AU, 0x0FU)
|
val actual = ubyteArrayOf(0x5CU, 0x70U) and ubyteArrayOf(0x3AU, 0x0FU)
|
||||||
assertContentEquals(expected, actual)
|
assertContentEquals(expected, actual)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `ByteArray - or() - size`() {
|
fun `ByteArray or - size`() {
|
||||||
assertFails {
|
assertFails {
|
||||||
byteArrayOf() or byteArrayOf(0x00)
|
byteArrayOf() or byteArrayOf(0x00)
|
||||||
}
|
}
|
||||||
@@ -50,14 +50,14 @@ class `Operators Test` {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `ByteArray - or()`() {
|
fun `ByteArray or`() {
|
||||||
val expected = byteArrayOf(0x7E, 0x7F)
|
val expected = byteArrayOf(0x7E, 0x7F)
|
||||||
val actual = byteArrayOf(0x5C, 0x70) or byteArrayOf(0x3A, 0x0F)
|
val actual = byteArrayOf(0x5C, 0x70) or byteArrayOf(0x3A, 0x0F)
|
||||||
assertContentEquals(expected, actual)
|
assertContentEquals(expected, actual)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `UByteArray - or() - size`() {
|
fun `UByteArray or - size`() {
|
||||||
assertFails {
|
assertFails {
|
||||||
ubyteArrayOf() or ubyteArrayOf(0x00U)
|
ubyteArrayOf() or ubyteArrayOf(0x00U)
|
||||||
}
|
}
|
||||||
@@ -67,14 +67,14 @@ class `Operators Test` {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `UByteArray - or()`() {
|
fun `UByteArray or`() {
|
||||||
val expected = ubyteArrayOf(0x7EU, 0x7FU)
|
val expected = ubyteArrayOf(0x7EU, 0x7FU)
|
||||||
val actual = ubyteArrayOf(0x5CU, 0x70U) or ubyteArrayOf(0x3AU, 0x0FU)
|
val actual = ubyteArrayOf(0x5CU, 0x70U) or ubyteArrayOf(0x3AU, 0x0FU)
|
||||||
assertContentEquals(expected, actual)
|
assertContentEquals(expected, actual)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `ByteArray - xor() - size`() {
|
fun `ByteArray xor - size`() {
|
||||||
assertFails {
|
assertFails {
|
||||||
byteArrayOf() xor byteArrayOf(0x00)
|
byteArrayOf() xor byteArrayOf(0x00)
|
||||||
}
|
}
|
||||||
@@ -84,14 +84,14 @@ class `Operators Test` {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `ByteArray - xor()`() {
|
fun `ByteArray xor`() {
|
||||||
val expected = byteArrayOf(0x66, 0x7F)
|
val expected = byteArrayOf(0x66, 0x7F)
|
||||||
val actual = byteArrayOf(0x5C, 0x70) xor byteArrayOf(0x3A, 0x0F)
|
val actual = byteArrayOf(0x5C, 0x70) xor byteArrayOf(0x3A, 0x0F)
|
||||||
assertContentEquals(expected, actual)
|
assertContentEquals(expected, actual)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `UByteArray - xor() - size`() {
|
fun `UByteArray xor - size`() {
|
||||||
assertFails {
|
assertFails {
|
||||||
ubyteArrayOf() xor ubyteArrayOf(0x00U)
|
ubyteArrayOf() xor ubyteArrayOf(0x00U)
|
||||||
}
|
}
|
||||||
@@ -101,7 +101,7 @@ class `Operators Test` {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `UByteArray - xor()`() {
|
fun `UByteArray xor`() {
|
||||||
val expected = ubyteArrayOf(0x66U, 0x7FU)
|
val expected = ubyteArrayOf(0x66U, 0x7FU)
|
||||||
val actual = ubyteArrayOf(0x5CU, 0x70U) xor ubyteArrayOf(0x3AU, 0x0FU)
|
val actual = ubyteArrayOf(0x5CU, 0x70U) xor ubyteArrayOf(0x3AU, 0x0FU)
|
||||||
assertContentEquals(expected, actual)
|
assertContentEquals(expected, actual)
|
||||||
|
|||||||
@@ -6,14 +6,14 @@ import kotlin.test.assertEquals
|
|||||||
|
|
||||||
class `String Test` {
|
class `String Test` {
|
||||||
@Test
|
@Test
|
||||||
fun `encodeToUByteArray()`() {
|
fun `UByteArray encodeToUByteArray`() {
|
||||||
val expected = ubyteArrayOf(0x50U, 0x41U, 0x53U, 0x53U, 0x57U, 0x4FU, 0x52U, 0x44U)
|
val expected = ubyteArrayOf(0x50U, 0x41U, 0x53U, 0x53U, 0x57U, 0x4FU, 0x52U, 0x44U)
|
||||||
val actual = "PASSWORD".encodeToUByteArray()
|
val actual = "PASSWORD".encodeToUByteArray()
|
||||||
assertContentEquals(expected, actual)
|
assertContentEquals(expected, actual)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `decodeToString()`() {
|
fun `UByteArray decodeToString`() {
|
||||||
val expected = "PASSWORD"
|
val expected = "PASSWORD"
|
||||||
val actual = ubyteArrayOf(0x50U, 0x41U, 0x53U, 0x53U, 0x57U, 0x4FU, 0x52U, 0x44U).decodeToString()
|
val actual = ubyteArrayOf(0x50U, 0x41U, 0x53U, 0x53U, 0x57U, 0x4FU, 0x52U, 0x44U).decodeToString()
|
||||||
assertEquals(expected, actual)
|
assertEquals(expected, actual)
|
||||||
|
|||||||
Reference in New Issue
Block a user