Debian Codegraph @

minidns-core/src/test/java/org/minidns/util/Base32Test.java

raw
1 /*
2 * Copyright 2015-2020 the original author or authors
3 *
4 * This software is licensed under the Apache License, Version 2.0,
5 * the GNU Lesser General Public License version 2 or later ("LGPL")
6 * and the WTFPL.
7 * You may choose either license to govern your use of this software only
8 * upon the condition that you accept all of the terms of either
9 * the Apache License 2.0, the LGPL 2.1+ or the WTFPL.
10 */
11 package org.minidns.util;
12
13 import org.junit.jupiter.api.Test;
14
15 import static org.junit.jupiter.api.Assertions.assertEquals;
16
17 public class Base32Test {
18 @Test
19 public void testEncodeToString() {
20 assertEquals("", Base32.encodeToString(new byte[] {}));
21 assertEquals("0410====", Base32.encodeToString(new byte[] {1, 2}));
22 assertEquals("891K8HA6", Base32.encodeToString(new byte[] {0x42, 0x43, 0x44, 0x45, 0x46}));
23 assertEquals("VS0FU07V03VG0===", Base32.encodeToString(new byte[] {-1, 0, -1, 0, -1, 0, -1, 0}));
24 }
25 }