Sha256: c9393f62edad1e200cb081c9029387e3dec48914aed3580bd68594a660df697b

Contents?: true

Size: 917 Bytes

Versions: 396

Compression:

Stored size: 917 Bytes

Contents

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

(defn- square [n] (* n n))

(defn- to-s [xs] (apply str xs))

(deftest empty-accumulation
  (is (= [] (accumulate/accumulate square []))))

(deftest accumulate-squares
  (is (= [1 4 9] (accumulate/accumulate square [1 2 3]))))

(deftest accumulate-upcases
  (is (= ["HELLO", "WORLD"]
         (->> ["hello" "world"]
              (accumulate/accumulate clojure.string/upper-case)
              (map to-s)))))

(deftest accumulate-reversed-strings
  (is (= ["eht" "kciuq" "nworb" "xof" "cte"]
         (->> ["the" "quick" "brown" "fox" "etc"]
              (accumulate/accumulate reverse)
              (map to-s)))))

(deftest accumulate-recursively
  (is (= [["a1" "a2" "a3"] ["b1" "b2" "b3"] ["c1" "c2" "c3"]]
         (-> #(accumulate/accumulate (fn [n] (str % n)) [1 2 3])
             (accumulate/accumulate "abc")))))

Version data entries

396 entries across 396 versions & 1 rubygems

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