PlatformUtilsTest.kt 973 B

1234567891011121314151617181920212223242526272829303132
  1. /*
  2. * Copyright 2019-2022 Mamoe Technologies and contributors.
  3. *
  4. * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
  5. * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
  6. *
  7. * https://github.com/mamoe/mirai/blob/dev/LICENSE
  8. */
  9. package net.mamoe.mirai.internal
  10. import io.ktor.utils.io.core.*
  11. import net.mamoe.mirai.internal.test.AbstractTest
  12. import net.mamoe.mirai.utils.gzip
  13. import net.mamoe.mirai.utils.ungzip
  14. import net.mamoe.mirai.utils.unzip
  15. import net.mamoe.mirai.utils.zip
  16. import kotlin.test.Test
  17. import kotlin.test.assertEquals
  18. internal class PlatformUtilsTest : AbstractTest() {
  19. @Test
  20. fun testZip() {
  21. assertEquals("test", "test".toByteArray().zip().unzip().decodeToString())
  22. }
  23. @Test
  24. fun testGZip() {
  25. assertEquals("test", "test".toByteArray().gzip().ungzip().decodeToString())
  26. }
  27. }