@@ -75,9 +75,9 @@ public class Base32Test {
7575 };
7676
7777 @ Test
78- public void testBase32Samples () throws Exception {
79- final Base32 codec = new Base32 ();
80- for (final String [] element : BASE32_TEST_CASES ) {
78+ public void testBase32Chunked () throws Exception {
79+ final Base32 codec = new Base32 (20 );
80+ for (final String [] element : BASE32_TEST_CASES_CHUNKED ) {
8181 assertEquals (element [1 ], codec .encodeAsString (element [0 ].getBytes (CHARSET_UTF8 )));
8282 }
8383 }
@@ -91,33 +91,28 @@ public void testBase32HexSamples() throws Exception {
9191 }
9292
9393 @ Test
94- public void testBase32Chunked () throws Exception {
95- final Base32 codec = new Base32 (20 );
96- for (final String [] element : BASE32_TEST_CASES_CHUNKED ) {
94+ public void testBase32Samples () throws Exception {
95+ final Base32 codec = new Base32 ();
96+ for (final String [] element : BASE32_TEST_CASES ) {
9797 assertEquals (element [1 ], codec .encodeAsString (element [0 ].getBytes (CHARSET_UTF8 )));
9898 }
9999 }
100100
101101 @ Test
102- public void testSingleCharEncoding () {
103- for (int i = 0 ; i < 20 ; i ++) {
104- Base32 codec = new Base32 ();
105- final BaseNCodec .Context context = new BaseNCodec .Context ();
106- final byte unencoded [] = new byte [i ];
107- final byte allInOne [] = codec .encode (unencoded );
108- codec = new Base32 ();
109- for (int j =0 ; j < unencoded .length ; j ++) {
110- codec .encode (unencoded , j , 1 , context );
111- }
112- codec .encode (unencoded , 0 , -1 , context );
113- final byte singly [] = new byte [allInOne .length ];
114- codec .readResults (singly , 0 , 100 , context );
115- if (!Arrays .equals (allInOne , singly )){
116- fail ();
117- }
102+ public void testBase32SamplesNonDefaultPadding () throws Exception {
103+ final Base32 codec = new Base32 ((byte )0x25 ); // '%' <=> 0x25
104+
105+ for (final String [] element : BASE32_PAD_TEST_CASES ) {
106+ assertEquals (element [1 ], codec .encodeAsString (element [0 ].getBytes (CHARSET_UTF8 )));
118107 }
119108 }
120109
110+ @ Test
111+ public void testCodec200 () {
112+ final Base32 codec = new Base32 (true , (byte )'W' ); // should be allowed
113+ assertNotNull (codec );
114+ }
115+
121116 @ Test
122117 public void testRandomBytes () {
123118 for (int i = 0 ; i < 20 ; i ++) {
@@ -149,18 +144,23 @@ public void testRandomBytesHex() {
149144 }
150145
151146 @ Test
152- public void testBase32SamplesNonDefaultPadding () throws Exception {
153- final Base32 codec = new Base32 ((byte )0x25 ); // '%' <=> 0x25
154-
155- for (final String [] element : BASE32_PAD_TEST_CASES ) {
156- assertEquals (element [1 ], codec .encodeAsString (element [0 ].getBytes (CHARSET_UTF8 )));
147+ public void testSingleCharEncoding () {
148+ for (int i = 0 ; i < 20 ; i ++) {
149+ Base32 codec = new Base32 ();
150+ final BaseNCodec .Context context = new BaseNCodec .Context ();
151+ final byte unencoded [] = new byte [i ];
152+ final byte allInOne [] = codec .encode (unencoded );
153+ codec = new Base32 ();
154+ for (int j =0 ; j < unencoded .length ; j ++) {
155+ codec .encode (unencoded , j , 1 , context );
156+ }
157+ codec .encode (unencoded , 0 , -1 , context );
158+ final byte singly [] = new byte [allInOne .length ];
159+ codec .readResults (singly , 0 , 100 , context );
160+ if (!Arrays .equals (allInOne , singly )){
161+ fail ();
162+ }
157163 }
158164 }
159165
160- @ Test
161- public void testCodec200 () {
162- final Base32 codec = new Base32 (true , (byte )'W' ); // should be allowed
163- assertNotNull (codec );
164- }
165-
166166}
0 commit comments