Sha256: 888406fa03f9b9f886747ddbeeab2cfefb80b8f4e2ab43f0a2f3ae011c3ce853

Contents?: true

Size: 1.45 KB

Versions: 71

Compression:

Stored size: 1.45 KB

Contents

#if swift(>=3.0)
    import XCTest
#endif

class SpaceAgeTest: XCTestCase {

    func testAgeInSeconds() {
        let age = SpaceAge(1_000_000)
        XCTAssertEqual(1_000_000, age.seconds)
    }

    func testAgeInEarthYears() {
        let age = SpaceAge(1_000_000_000)
        XCTAssertEqual(31.69, age.onEarth)
    }

    func testAgeInMercuryYears() {
        let age = SpaceAge(2_134_835_688)
        XCTAssertEqual(67.65, age.onEarth)
        XCTAssertEqual(280.88, age.onMercury)
    }

    func testAgeInVenusYears() {
        let age = SpaceAge(189_839_836)
        XCTAssertEqual(6.02, age.onEarth)
        XCTAssertEqual(9.78, age.onVenus)
    }

    func testAgeOnMars() {
        let age = SpaceAge(2_329_871_239)
        XCTAssertEqual(73.83, age.onEarth)
        XCTAssertEqual(39.25, age.onMars)
    }

    func testAgeOnJupiter() {
        let age = SpaceAge(901_876_382)
        XCTAssertEqual(28.58, age.onEarth)
        XCTAssertEqual(2.41, age.onJupiter)
    }

    func testAgeOnSaturn() {
        let age = SpaceAge(3_000_000_000)
        XCTAssertEqual(95.06, age.onEarth)
        XCTAssertEqual(3.23, age.onSaturn)
    }

    func testAgeOnUranus() {
        let age = SpaceAge(3_210_123_456)
        XCTAssertEqual(101.72, age.onEarth)
        XCTAssertEqual(1.21, age.onUranus)
    }

    func testAgeOnNeptune() {
        let age = SpaceAge(8_210_123_456)
        XCTAssertEqual(260.16, age.onEarth)
        XCTAssertEqual(1.58, age.onNeptune)
    }
}

Version data entries

71 entries across 71 versions & 1 rubygems

Version Path
trackler-2.0.6.15 tracks/swift/exercises/space-age/SpaceAgeTest.swift
trackler-2.0.6.14 tracks/swift/exercises/space-age/SpaceAgeTest.swift
trackler-2.0.6.13 tracks/swift/exercises/space-age/SpaceAgeTest.swift
trackler-2.0.6.12 tracks/swift/exercises/space-age/SpaceAgeTest.swift
trackler-2.0.6.11 tracks/swift/exercises/space-age/SpaceAgeTest.swift
trackler-2.0.6.10 tracks/swift/exercises/space-age/SpaceAgeTest.swift
trackler-2.0.6.9 tracks/swift/exercises/space-age/SpaceAgeTest.swift
trackler-2.0.6.8 tracks/swift/exercises/space-age/SpaceAgeTest.swift
trackler-2.0.6.7 tracks/swift/exercises/space-age/SpaceAgeTest.swift
trackler-2.0.6.6 tracks/swift/exercises/space-age/SpaceAgeTest.swift
trackler-2.0.6.5 tracks/swift/exercises/space-age/SpaceAgeTest.swift
trackler-2.0.6.4 tracks/swift/exercises/space-age/SpaceAgeTest.swift
trackler-2.0.6.3 tracks/swift/exercises/space-age/SpaceAgeTest.swift
trackler-2.0.6.2 tracks/swift/exercises/space-age/SpaceAgeTest.swift
trackler-2.0.6.1 tracks/swift/exercises/space-age/SpaceAgeTest.swift
trackler-2.0.6.0 tracks/swift/exercises/space-age/SpaceAgeTest.swift
trackler-2.0.5.18 tracks/swift/exercises/space-age/SpaceAgeTest.swift
trackler-2.0.5.17 tracks/swift/exercises/space-age/SpaceAgeTest.swift
trackler-2.0.5.16 tracks/swift/exercises/space-age/SpaceAgeTest.swift
trackler-2.0.5.15 tracks/swift/exercises/space-age/SpaceAgeTest.swift