@@ -86,6 +86,30 @@ class ChromiumTests: XCTestCase {
8686 }
8787 }
8888
89+ func testBase64DecodingOneTwoThreeFour( ) {
90+ let base64 = " AQIDBA== "
91+ let bytes : [ UInt8 ] = [ 1 , 2 , 3 , 4 ]
92+
93+ XCTAssertEqual ( Base64 . encodeString ( bytes: bytes) , base64)
94+ XCTAssertEqual ( try Base64 . decode ( string: base64) , bytes)
95+ }
96+
97+ func testBase64DecodingOneTwoThreeFourFive( ) {
98+ let base64 = " AQIDBAU= "
99+ let bytes : [ UInt8 ] = [ 1 , 2 , 3 , 4 , 5 ]
100+
101+ XCTAssertEqual ( Base64 . encodeString ( bytes: bytes) , base64)
102+ XCTAssertEqual ( try Base64 . decode ( string: base64) , bytes)
103+ }
104+
105+ func testBase64DecodingOneTwoThreeFourFiveSix( ) {
106+ let base64 = " AQIDBAUG "
107+ let bytes : [ UInt8 ] = [ 1 , 2 , 3 , 4 , 5 , 6 ]
108+
109+ XCTAssertEqual ( Base64 . encodeString ( bytes: bytes) , base64)
110+ XCTAssertEqual ( try Base64 . decode ( string: base64) , bytes)
111+ }
112+
89113 func testBase64DecodingWithInvalidLength( ) {
90114 XCTAssertThrowsError ( _ = try Base64 . decode ( bytes: " AAAAA " . utf8) ) { error in
91115 XCTAssertEqual ( error as? DecodingError , . invalidLength)
0 commit comments