fix Base32

This commit is contained in:
Looly
2022-03-20 14:21:10 +08:00
parent a1df46f4bd
commit ca5732e6df
4 changed files with 27 additions and 8 deletions

View File

@@ -1,5 +1,6 @@
package cn.hutool.core.codec;
import cn.hutool.core.util.RandomUtil;
import org.junit.Assert;
import org.junit.Test;
@@ -13,8 +14,20 @@ public class Base32Test {
String decodeStr = Base32.decodeStr(encode);
Assert.assertEquals(a, decodeStr);
}
decodeStr = Base32.decodeStr("4S6KNZNOW3TJRL7EXCAOJOFK5GOZ5ZNYXDUZLP7HTKCOLLMX46WKNZFYWI");
@Test
public void encodeAndDecodeRandomTest(){
String a = RandomUtil.randomString(RandomUtil.randomInt(1000));
String encode = Base32.encode(a);
String decodeStr = Base32.decodeStr(encode);
Assert.assertEquals(a, decodeStr);
}
@Test
public void decodeTest(){
String a = "伦家是一个非常长的字符串";
String decodeStr = Base32.decodeStr("4S6KNZNOW3TJRL7EXCAOJOFK5GOZ5ZNYXDUZLP7HTKCOLLMX46WKNZFYWI");
Assert.assertEquals(a, decodeStr);
}
}