Created
October 9, 2016 21:26
-
-
Save elliotchance/de6e17d2a435ae2d255eae77a15bce1d 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
import XCTest | |
import HealthKit | |
@testable import Stepology | |
class StepUnitFormatterTests: XCTestCase { | |
//> (0, "0 steps") | |
//> (1, "1 step") | |
//> (2, "2 steps") | |
//> (999, "999 steps") | |
//> (1000, "1,000 steps") | |
//> (1000000, "1,000,000 steps") | |
//> (3.3, "3 steps") | |
//> (-5, "0 steps") | |
func testFormat(_ numberOfSteps: Double, _ expected: String) { | |
XCTAssertEqual(StepUnitFormatter().format(numberOfSteps), expected) | |
} | |
} | |
// DO NOT EDIT BELOW THIS LINE | |
extension StepUnitFormatterTests { | |
func testFormat0() { | |
testFormat(0, "0 steps") | |
} | |
func testFormat1() { | |
testFormat(1, "1 step") | |
} | |
func testFormat2() { | |
testFormat(2, "2 steps") | |
} | |
func testFormat3() { | |
testFormat(999, "999 steps") | |
} | |
func testFormat4() { | |
testFormat(1000, "1,000 steps") | |
} | |
func testFormat5() { | |
testFormat(1000000, "1,000,000 steps") | |
} | |
func testFormat6() { | |
testFormat(3.3, "3 steps") | |
} | |
func testFormat7() { | |
testFormat(-5, "0 steps") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment