Skip to content

Instantly share code, notes, and snippets.

@elliotchance
Created October 9, 2016 21:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elliotchance/de6e17d2a435ae2d255eae77a15bce1d to your computer and use it in GitHub Desktop.
Save elliotchance/de6e17d2a435ae2d255eae77a15bce1d to your computer and use it in GitHub Desktop.
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