Skip to content

Commit e699ada

Browse files
committed
Adds performance test for toHexString() from [UInt8] extension
1 parent 90e5b7a commit e699ada

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

Tests/CryptoSwiftTests/ExtensionsTest.swift

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,19 @@ final class ExtensionsTest: XCTestCase {
8282
let hex = array.toHexString()
8383
XCTAssertEqual(str, hex)
8484
}
85+
86+
func testToHexStringPerformance() {
87+
let len = 100000
88+
let a = [UInt8](unsafeUninitializedCapacity: len) { buf, count in
89+
for i in 0..<len {
90+
buf[i] = UInt8.random(in: 0...UInt8.max)
91+
}
92+
count = len
93+
}
94+
self.measure {
95+
_ = a.toHexString()
96+
}
97+
}
8598
}
8699

87100
extension ExtensionsTest {

0 commit comments

Comments
 (0)