Sha256: c3b7517bba85ace48f6855582ddd28cdefc0d7d988b1480261406b302422de5d

Contents?: true

Size: 768 Bytes

Versions: 45

Compression:

Stored size: 768 Bytes

Contents

(ns collatz-conjecture-test
  (require [clojure.test :refer [deftest is testing]]
           [collatz-conjecture :refer [collatz]]))

(deftest steps-for-1
  (testing "zero steps for one"
    (is (= 0 (collatz 1)))))

(deftest steps-for-16
  (testing "divide if even"
    (is (= 4 (collatz 16)))))

(deftest steps-for-12
  (testing "even and odd steps"
    (is (= 9 (collatz 12)))))

(deftest steps-for-1000000
  (testing "Large number of even and odd steps"
    (is (= 152 (collatz 1000000)))))

(deftest steps-for-0
  (testing "zero is an error"
    (is (thrown? IllegalArgumentException
                 (collatz 0)))))

(deftest steps-for-negative
  (testing "negative value is an error"
    (is (thrown? IllegalArgumentException
                 (collatz -15)))))

Version data entries

45 entries across 45 versions & 1 rubygems

Version Path
trackler-2.2.1.78 tracks/clojure/exercises/collatz-conjecture/test/collatz_conjecture_test.clj
trackler-2.2.1.77 tracks/clojure/exercises/collatz-conjecture/test/collatz_conjecture_test.clj
trackler-2.2.1.76 tracks/clojure/exercises/collatz-conjecture/test/collatz_conjecture_test.clj
trackler-2.2.1.75 tracks/clojure/exercises/collatz-conjecture/test/collatz_conjecture_test.clj
trackler-2.2.1.74 tracks/clojure/exercises/collatz-conjecture/test/collatz_conjecture_test.clj
trackler-2.2.1.73 tracks/clojure/exercises/collatz-conjecture/test/collatz_conjecture_test.clj
trackler-2.2.1.72 tracks/clojure/exercises/collatz-conjecture/test/collatz_conjecture_test.clj
trackler-2.2.1.71 tracks/clojure/exercises/collatz-conjecture/test/collatz_conjecture_test.clj
trackler-2.2.1.70 tracks/clojure/exercises/collatz-conjecture/test/collatz_conjecture_test.clj
trackler-2.2.1.69 tracks/clojure/exercises/collatz-conjecture/test/collatz_conjecture_test.clj
trackler-2.2.1.68 tracks/clojure/exercises/collatz-conjecture/test/collatz_conjecture_test.clj
trackler-2.2.1.67 tracks/clojure/exercises/collatz-conjecture/test/collatz_conjecture_test.clj
trackler-2.2.1.66 tracks/clojure/exercises/collatz-conjecture/test/collatz_conjecture_test.clj
trackler-2.2.1.65 tracks/clojure/exercises/collatz-conjecture/test/collatz_conjecture_test.clj
trackler-2.2.1.64 tracks/clojure/exercises/collatz-conjecture/test/collatz_conjecture_test.clj
trackler-2.2.1.63 tracks/clojure/exercises/collatz-conjecture/test/collatz_conjecture_test.clj
trackler-2.2.1.62 tracks/clojure/exercises/collatz-conjecture/test/collatz_conjecture_test.clj
trackler-2.2.1.61 tracks/clojure/exercises/collatz-conjecture/test/collatz_conjecture_test.clj
trackler-2.2.1.60 tracks/clojure/exercises/collatz-conjecture/test/collatz_conjecture_test.clj
trackler-2.2.1.59 tracks/clojure/exercises/collatz-conjecture/test/collatz_conjecture_test.clj