@@ -224,6 +224,10 @@ public void testSingletons() {
224224 assertEquals ("Zg==" ,new String (Base64 .encodeBase64 (new byte [] { (byte )102 })));
225225 assertEquals ("Zw==" ,new String (Base64 .encodeBase64 (new byte [] { (byte )103 })));
226226 assertEquals ("aA==" ,new String (Base64 .encodeBase64 (new byte [] { (byte )104 })));
227+ for (int i = -128 ; i <=127 ; i ++){
228+ byte test []= {(byte )i };
229+ assertTrue (Arrays .equals (test ,Base64 .decodeBase64 (Base64 .encodeBase64 (test ))));
230+ }
227231 }
228232
229233 public void testSingletonsChunked () {
@@ -334,6 +338,14 @@ public void testSingletonsChunked() {
334338 assertEquals ("aA==\r \n " ,new String (Base64 .encodeBase64Chunked (new byte [] { (byte )104 })));
335339 }
336340
341+ public void testPairs (){
342+ assertEquals ("AAA=" ,new String (Base64 .encodeBase64 (new byte [] { 0 , 0 })));
343+ for (int i = -128 ; i <=127 ; i ++){
344+ byte test []= {(byte )i , (byte )i };
345+ assertTrue (Arrays .equals (test ,Base64 .decodeBase64 (Base64 .encodeBase64 (test ))));
346+ }
347+ }
348+
337349 public void testTriplets () {
338350 assertEquals ("AAAA" ,new String (Base64 .encodeBase64 (new byte [] { (byte )0 , (byte )0 , (byte )0 })));
339351 assertEquals ("AAAB" ,new String (Base64 .encodeBase64 (new byte [] { (byte )0 , (byte )0 , (byte )1 })));
0 commit comments