Created
October 8, 2016 04:07
-
-
Save davbeck/0a9be64c2d77de3122da538283669d90 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func testFormatterKit() { | |
let timeFormatter = TTTTimeIntervalFormatter() | |
timeFormatter.presentTimeIntervalMargin = 60 | |
timeFormatter.usesIdiomaticDeicticExpressions = true | |
self.measure { | |
let timeFormatter = TTTTimeIntervalFormatter() | |
timeFormatter.presentTimeIntervalMargin = 60 | |
timeFormatter.usesIdiomaticDeicticExpressions = true | |
var timeInterval: TimeInterval = 1 | |
for i in 1..<iterations { | |
timeInterval *= TimeInterval(i) | |
timeFormatter.string(forTimeInterval: -timeInterval) | |
} | |
} | |
XCTAssertEqual(timeFormatter.string(forTimeInterval: -60), "1 minute ago") | |
} | |
func testMoments() { | |
self.measure { | |
var timeInterval: TimeInterval = 1 | |
for i in 1..<iterations { | |
timeInterval *= TimeInterval(i) | |
_ = Moment(Date(timeIntervalSinceNow: -timeInterval))?.fromNow() | |
} | |
} | |
XCTAssertEqual(Moment(Date(timeIntervalSinceNow: -60))?.fromNow(), "a minute ago") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment