Skip to content

Commit b3161cf

Browse files
committed
test: encode UInt8 array test
1 parent 38fe1f7 commit b3161cf

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

Tests/SwiftEncodingTests/Base64Tests.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ final class Base64Tests: XCTestCase {
1414
XCTAssertNotEqual(encodeBase64(data: "wuriyanto"), expected)
1515
}
1616

17+
func testBase64EncodeUInt8ArrayShouldEqualToExpected() throws {
18+
let expected: String = "c3dpZnQgZm9yIGlvcw=="
19+
20+
XCTAssertEqual(encodeBase64(data: [115, 119, 105, 102, 116, 32, 102, 111, 114, 32, 105, 111, 115]), expected)
21+
}
22+
1723
func testBase64DecodeShouldEqualToExpected() throws {
1824
let expected: String = "wuriyanto"
1925

Tests/SwiftEncodingTests/HexTests.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ final class HexTests: XCTestCase {
1414
XCTAssertNotEqual(encodeHex(data: "Dog‼🐶"), expected)
1515
}
1616

17+
func testHexEncodeUInt8ArrayShouldEqualToExpected() throws {
18+
let expected: String = "737769667420666f7220696f73"
19+
20+
XCTAssertEqual(encodeHex(data: [115, 119, 105, 102, 116, 32, 102, 111, 114, 32, 105, 111, 115]), expected)
21+
}
22+
1723
func testHexDecodeShouldEqualToExpected() throws {
1824
let expected: String = "Dog‼🐶"
1925

0 commit comments

Comments
 (0)