mirror of
https://github.com/Ranchero-Software/NetNewsWire.git
synced 2025-02-03 20:37:34 +01:00
Add performance test for HTMLEntityDecoder.
This commit is contained in:
parent
ce73d38037
commit
be7dd28b6f
@ -75,4 +75,21 @@ final class EntityDecodingTests: XCTestCase {
|
||||
decoded = HTMLEntityDecoder.decodedString(s)
|
||||
XCTAssertEqual(decoded, "£")
|
||||
}
|
||||
|
||||
func testPerformance() {
|
||||
|
||||
// 0.009 sec on my 2012 iMac.
|
||||
let s = stringForResource("DaringFireball", "html")
|
||||
self.measure {
|
||||
_ = HTMLEntityDecoder.decodedString(s)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func stringForResource(_ filename: String, _ fileExtension: String) -> String {
|
||||
|
||||
let filename = "Resources/\(filename)"
|
||||
let path = Bundle.module.path(forResource: filename, ofType: fileExtension)!
|
||||
return try! String(contentsOfFile: path)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user