mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2026-12-06 12:18:26 +00:00
Add performance test for HTMLEntityDecoder.
This commit is contained in:
1 parent
ce73d38037
commit
be7dd28b6f
1 file changed
+17
@@ -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)
|
||||
}
|
||||
Reference in new issue
Block a user