Improve padding tests a bit, add readme note for browser tests
This commit is contained in:
2 files changed
+5
No files matched your search
@@ -138,6 +138,7 @@ Currently supported native platforms:
|
|||||||
- Complete the bindings list
|
- Complete the bindings list
|
||||||
- Samples
|
- Samples
|
||||||
- Android testing
|
- Android testing
|
||||||
|
- Fix browser testing, both locally and in CI/CD
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+4
@@ -78,7 +78,9 @@ class LibsodiumUtilTest {
|
|||||||
val input = ubyteArrayOf(1U, 2U)
|
val input = ubyteArrayOf(1U, 2U)
|
||||||
val blocksize = 2
|
val blocksize = 2
|
||||||
val padded = LibsodiumUtil.pad(input, blocksize)
|
val padded = LibsodiumUtil.pad(input, blocksize)
|
||||||
|
val expected = ubyteArrayOf(1U, 2U, 0x80U, 0x00U)
|
||||||
println(padded.hexColumsPrint())
|
println(padded.hexColumsPrint())
|
||||||
|
assertTrue { padded.contentEquals(expected) }
|
||||||
val unpadded = LibsodiumUtil.unpad(padded, blocksize)
|
val unpadded = LibsodiumUtil.unpad(padded, blocksize)
|
||||||
println(unpadded.hexColumsPrint())
|
println(unpadded.hexColumsPrint())
|
||||||
|
|
||||||
@@ -94,7 +96,9 @@ class LibsodiumUtilTest {
|
|||||||
val input = ubyteArrayOf(1U, 2U, 3U, 4U, 5U, 6U)
|
val input = ubyteArrayOf(1U, 2U, 3U, 4U, 5U, 6U)
|
||||||
val blocksize = 4
|
val blocksize = 4
|
||||||
val padded = LibsodiumUtil.pad(input, blocksize)
|
val padded = LibsodiumUtil.pad(input, blocksize)
|
||||||
|
val expected = ubyteArrayOf(1U, 2U, 3U, 4U, 5U, 6U, 0x80U, 0x00U)
|
||||||
println(padded.hexColumsPrint())
|
println(padded.hexColumsPrint())
|
||||||
|
assertTrue { padded.contentEquals(expected) }
|
||||||
val unpadded = LibsodiumUtil.unpad(padded, blocksize)
|
val unpadded = LibsodiumUtil.unpad(padded, blocksize)
|
||||||
println(unpadded.hexColumsPrint())
|
println(unpadded.hexColumsPrint())
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user