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.98 tracks/clojure/exercises/accumulate/test/accumulate_test.clj
trackler-2.2.1.97 tracks/clojure/exercises/accumulate/test/accumulate_test.clj
trackler-2.2.1.96 tracks/clojure/exercises/accumulate/test/accumulate_test.clj
trackler-2.2.1.95 tracks/clojure/exercises/accumulate/test/accumulate_test.clj
trackler-2.2.1.94 tracks/clojure/exercises/accumulate/test/accumulate_test.clj
trackler-2.2.1.93 tracks/clojure/exercises/accumulate/test/accumulate_test.clj
trackler-2.2.1.92 tracks/clojure/exercises/accumulate/test/accumulate_test.clj
trackler-2.2.1.91 tracks/clojure/exercises/accumulate/test/accumulate_test.clj
trackler-2.2.1.90 tracks/clojure/exercises/accumulate/test/accumulate_test.clj
trackler-2.2.1.89 tracks/clojure/exercises/accumulate/test/accumulate_test.clj
trackler-2.2.1.88 tracks/clojure/exercises/accumulate/test/accumulate_test.clj
trackler-2.2.1.87 tracks/clojure/exercises/accumulate/test/accumulate_test.clj
trackler-2.2.1.86 tracks/clojure/exercises/accumulate/test/accumulate_test.clj
trackler-2.2.1.85 tracks/clojure/exercises/accumulate/test/accumulate_test.clj
trackler-2.2.1.84 tracks/clojure/exercises/accumulate/test/accumulate_test.clj
trackler-2.2.1.83 tracks/clojure/exercises/accumulate/test/accumulate_test.clj
trackler-2.2.1.82 tracks/clojure/exercises/accumulate/test/accumulate_test.clj
trackler-2.2.1.81 tracks/clojure/exercises/accumulate/test/accumulate_test.clj
trackler-2.2.1.80 tracks/clojure/exercises/accumulate/test/accumulate_test.clj
trackler-2.2.1.79 tracks/clojure/exercises/accumulate/test/accumulate_test.clj