Skip to content

Commit

Permalink
Temporarily disable performance testing
Browse files Browse the repository at this point in the history
  • Loading branch information
marmelroy committed Nov 28, 2016
1 parent cc2ba2f commit 16738d7
Showing 1 changed file with 31 additions and 31 deletions.
62 changes: 31 additions & 31 deletions PhoneNumberKitTests/PhoneNumberKitParsingTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -328,38 +328,38 @@ class PhoneNumberKitParsingTests: XCTestCase {
}
XCTAssertEqual(number.type, PhoneNumberType.mobile)
}
//
// func testPerformanceSimple() {
// let numberOfParses = 1000
// let startTime = Date()
// var endTime = Date()
// var numberArray: [String] = []
// for _ in 0 ..< numberOfParses {
// numberArray.append("+5491187654321")
// }
// _ = phoneNumberKit.parse(numberArray, withRegion: "AR")
// endTime = Date()
// let timeInterval = endTime.timeIntervalSince(startTime)
// print("time to parse \(numberOfParses) phone numbers, \(timeInterval) seconds")
// XCTAssertTrue(timeInterval < 5)
// }

func testPerformanceSimple() {
let numberOfParses = 1000
let startTime = Date()
var endTime = Date()
var numberArray: [String] = []
for _ in 0 ..< numberOfParses {
numberArray.append("+5491187654321")
}
_ = phoneNumberKit.parse(numberArray, withRegion: "AR")
endTime = Date()
let timeInterval = endTime.timeIntervalSince(startTime)
print("time to parse \(numberOfParses) phone numbers, \(timeInterval) seconds")
XCTAssertTrue(timeInterval < 5)
}

func testMultipleMutated() {
let numberOfParses = 500
let startTime = Date()
var endTime = Date()
var numberArray: [String] = []
for _ in 0 ..< numberOfParses {
numberArray.append("+5491187654321")
}
let phoneNumbers = phoneNumberKit.parseManager.parseMultiple(numberArray, withRegion: "AR") {
numberArray.remove(at: 100)
}
XCTAssertTrue(phoneNumbers.count == numberOfParses)
endTime = Date()
let timeInterval = endTime.timeIntervalSince(startTime)
print("time to parse \(numberOfParses) phone numbers, \(timeInterval) seconds")
}
// func testMultipleMutated() {
// let numberOfParses = 500
// let startTime = Date()
// var endTime = Date()
// var numberArray: [String] = []
// for _ in 0 ..< numberOfParses {
// numberArray.append("+5491187654321")
// }
// let phoneNumbers = phoneNumberKit.parseManager.parseMultiple(numberArray, withRegion: "AR") {
// numberArray.remove(at: 100)
// }
// XCTAssertTrue(phoneNumbers.count == numberOfParses)
// endTime = Date()
// let timeInterval = endTime.timeIntervalSince(startTime)
// print("time to parse \(numberOfParses) phone numbers, \(timeInterval) seconds")
// }


}

0 comments on commit 16738d7

Please sign in to comment.