@@ -41,6 +41,14 @@ public void testEncodeBytes() throws IOException {
4141 Assert .assertEquals ("" , Base64 .encodeBytes (new byte [0 ]));
4242 Assert .assertEquals ("QHE=" ,
4343 Base64 .encodeBytes (new byte [] {49 , 121 , 64 , 113 , -63 , 43 , -24 , 62 , 4 , 48 }, 2 , 2 , 0 ));
44+ Assert .assertEquals ("H4sIAAAAAAAAADMEALfv3IMBAAAA" ,
45+ Base64 .encodeBytes (new byte [] {49 , 121 , 64 , 113 , -63 , 43 , -24 , 62 , 4 , 48 }, 0 , 1 , 6 ));
46+ Assert .assertEquals ("H4sIAAAAAAAAAHMoBABQHKKWAgAAAA==" ,
47+ Base64 .encodeBytes (new byte [] {49 , 121 , 64 , 113 , -63 , 43 , -24 , 62 , 4 , 48 }, 2 , 2 , 18 ));
48+ Assert .assertEquals ("F63=" ,
49+ Base64 .encodeBytes (new byte [] {49 , 121 , 64 , 113 , 63 , 43 , -24 , 62 , 4 , 48 }, 2 , 2 , 32 ));
50+ Assert .assertEquals ("6sg7---------6Bc0-0F699L-V----==" ,
51+ Base64 .encodeBytes (new byte [] {49 , 121 , 64 , 113 , 63 , 43 , -24 , 62 , 4 , 48 }, 2 , 2 , 34 ));
4452 }
4553
4654 @ Test
@@ -90,4 +98,30 @@ public void testEncodeBytesToBytes2() throws IOException {
9098 thrown .expect (IllegalArgumentException .class );
9199 Base64 .encodeBytesToBytes (new byte [] {83 , 10 , 91 , 67 , 42 , -1 , 107 , 62 , 91 , 67 }, 8 , 6 , 26 );
92100 }
101+
102+ @ Test
103+ public void testEncodeBytesToBytes3 () throws IOException {
104+ byte [] src = new byte [] {
105+ 113 , 42 , 123 , 99 , 10 , -33 , 75 , 30 , 88 , 99 ,
106+ 113 , 42 , 123 , 99 , 10 , -33 , 75 , 31 , 88 , 99 ,
107+ 113 , 42 , 123 , 99 , 10 , -33 , 75 , 32 , 88 , 99 ,
108+ 113 , 42 , 123 , 99 , 10 , -33 , 75 , 33 , 88 , 99 ,
109+ 113 , 42 , 123 , 99 , 10 , -33 , 75 , 34 , 88 , 99 ,
110+ 113 , 42 , 123 , 99 , 10 , -33 , 75 , 35 , 88 , 99 ,
111+ 55 , 60
112+ };
113+ byte [] excepted = new byte [] {
114+ 99 , 83 , 112 , 55 , 89 , 119 , 114 , 102 , 83 , 120 ,
115+ 53 , 89 , 89 , 51 , 69 , 113 , 101 , 50 , 77 , 75 , 51 ,
116+ 48 , 115 , 102 , 87 , 71 , 78 , 120 , 75 , 110 , 116 , 106 ,
117+ 67 , 116 , 57 , 76 , 73 , 70 , 104 , 106 , 99 , 83 , 112 ,
118+ 55 , 89 , 119 , 114 , 102 , 83 , 121 , 70 , 89 , 89 ,
119+ 51 , 69 , 113 , 101 , 50 , 77 , 75 , 51 , 48 , 115 ,
120+ 105 , 87 , 71 , 78 , 120 , 75 , 110 , 116 , 106 , 67 ,
121+ 116 , 57 , 76 , 10 , 73 , 49 , 104 , 106 , 78 , 122 ,
122+ 119 , 61
123+ };
124+
125+ Assert .assertArrayEquals (excepted , Base64 .encodeBytesToBytes (src , 0 , 62 , 8 ));
126+ }
93127}
0 commit comments