Skip to content

Commit b618282

Browse files
committed
test(decoder): add sample test
1 parent 70a9a7d commit b618282

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package space.iseki.bencoding
2+
3+
import kotlinx.serialization.decodeFromByteArray
4+
import kotlin.test.Test
5+
import kotlin.test.assertEquals
6+
7+
class SampleTest {
8+
9+
val data = "d2:abli-33ee3:abcli20eee"
10+
val dataMapped = mapOf(
11+
"abc" to listOf(20),
12+
"ab" to listOf(-33),
13+
)
14+
15+
@Test
16+
fun testDecode() {
17+
val decoded = Bencode.decodeFromByteArray<Map<String, List<Int>>>(data.encodeToByteArray())
18+
assertEquals(dataMapped, decoded)
19+
}
20+
21+
}

0 commit comments

Comments
 (0)