Sha256: 24c0797e981947814ac64609f9efdf5c5143bf64035b180922ed3164390ca4b7

Contents?: true

Size: 1.37 KB

Versions: 396

Compression:

Stored size: 1.37 KB

Contents

(ns space-age-test
  (:require [clojure.test :refer [deftest is]]
            space-age))

(defn- rounds-to
  [expected actual]
  (is (= (Math/round (* 100.0 expected))
         (Math/round (* 100.0 actual)))))

(deftest age-in-earth-years
  (rounds-to 31.69 (space-age/on-earth 1000000000)))

(deftest age-in-mercury-years
  (let [seconds 2134835688]
    (rounds-to 67.65 (space-age/on-earth seconds))
    (rounds-to 280.88 (space-age/on-mercury seconds))))

(deftest age-in-venus-years
  (let [seconds 189839836]
    (rounds-to 6.02 (space-age/on-earth seconds))
    (rounds-to 9.78 (space-age/on-venus seconds))))

(deftest age-on-mars
  (let [seconds 2329871239]
    (rounds-to 73.83 (space-age/on-earth seconds))
    (rounds-to 39.25 (space-age/on-mars seconds))))

(deftest age-on-jupiter
  (let [seconds 901876382]
    (rounds-to 28.58 (space-age/on-earth seconds))
    (rounds-to 2.41 (space-age/on-jupiter seconds))))

(deftest age-on-saturn
  (let [seconds 3000000000]
    (rounds-to 95.06 (space-age/on-earth seconds))
    (rounds-to 3.23 (space-age/on-saturn seconds))))

(deftest age-on-uranus
  (let [seconds 3210123456]
    (rounds-to 101.72 (space-age/on-earth seconds))
    (rounds-to 1.21 (space-age/on-uranus seconds))))

(deftest age-on-neptune
  (let [seconds 8210123456]
    (rounds-to 260.16 (space-age/on-earth seconds))
    (rounds-to 1.58 (space-age/on-neptune seconds))))

Version data entries

396 entries across 396 versions & 1 rubygems

Version Path
trackler-2.2.1.180 tracks/clojure/exercises/space-age/test/space_age_test.clj
trackler-2.2.1.179 tracks/clojure/exercises/space-age/test/space_age_test.clj
trackler-2.2.1.178 tracks/clojure/exercises/space-age/test/space_age_test.clj
trackler-2.2.1.177 tracks/clojure/exercises/space-age/test/space_age_test.clj
trackler-2.2.1.176 tracks/clojure/exercises/space-age/test/space_age_test.clj
trackler-2.2.1.175 tracks/clojure/exercises/space-age/test/space_age_test.clj
trackler-2.2.1.174 tracks/clojure/exercises/space-age/test/space_age_test.clj
trackler-2.2.1.173 tracks/clojure/exercises/space-age/test/space_age_test.clj
trackler-2.2.1.172 tracks/clojure/exercises/space-age/test/space_age_test.clj
trackler-2.2.1.171 tracks/clojure/exercises/space-age/test/space_age_test.clj
trackler-2.2.1.170 tracks/clojure/exercises/space-age/test/space_age_test.clj
trackler-2.2.1.169 tracks/clojure/exercises/space-age/test/space_age_test.clj
trackler-2.2.1.167 tracks/clojure/exercises/space-age/test/space_age_test.clj
trackler-2.2.1.166 tracks/clojure/exercises/space-age/test/space_age_test.clj
trackler-2.2.1.165 tracks/clojure/exercises/space-age/test/space_age_test.clj
trackler-2.2.1.164 tracks/clojure/exercises/space-age/test/space_age_test.clj
trackler-2.2.1.163 tracks/clojure/exercises/space-age/test/space_age_test.clj
trackler-2.2.1.162 tracks/clojure/exercises/space-age/test/space_age_test.clj
trackler-2.2.1.161 tracks/clojure/exercises/space-age/test/space_age_test.clj
trackler-2.2.1.160 tracks/clojure/exercises/space-age/test/space_age_test.clj