Sha256: 6230e6a5b0355ddb4662b09f8cc64cad697a8f30b41c8eb3821594db671bdf42

Contents?: true

Size: 1.74 KB

Versions: 396

Compression:

Stored size: 1.74 KB

Contents

(defmodule etl-tests
  (behaviour ltest-unit)
  (export all))

(include-lib "ltest/include/ltest-macros.lfe")

(deftest transform-one-value
  (erl-transform '(#("a" [1])) '(#(1 "a"))))

(deftest transform-one-word
  (erl-transform '(#("hello" ["WORLD"])) '(#("world" "hello"))))

(deftest transform-more-values
  (erl-transform
    '(#("hello" ["WORLD" "GSCHOOLERS"]))
    '(#("gschoolers" "hello") #("world" "hello"))))

(deftest transform-multiple-keys-from-one-value
  (erl-transform '(#("a" [1]) #("b" [1])) '(#(1 "ab"))))

(deftest transform-multiple-keys-from-multiple-values
  (erl-transform '(#("a" [1]) #("b" [4])) '(#(1 "a") #(4 "b"))))

(deftest transform-more-keys
  (let ((old      '(#("a" ["APPLE" "ARTICHOKE"])
                    #("b" ["BOAT" "BALLERINA"])))
        (expected '(#("apple"     "a")
                    #("artichoke" "a")
                    #("ballerina" "b")
                    #("boat"      "b"))))
    (erl-transform old expected)))

(deftest transform-full-dataset
  (let ((old      '(#(1  ["A" "E" "I" "O" "U" "L" "N" "R" "S" "T"])
                    #(2  ["D" "G"])
                    #(3  ["B" "C" "M" "P"])
                    #(4  ["F" "H" "V" "W" "Y"])
                    #(5  ["K"])
                    #(8  ["J" "X"])
                    #(10 ["Q" "Z"])))
        (expected '(#("a"  1) #("b"  3) #("c" 3) #("d" 2) #("e" 1)
                    #("f"  4) #("g"  2) #("h" 4) #("i" 1) #("j" 8)
                    #("k"  5) #("l"  1) #("m" 3) #("n" 1) #("o" 1)
                    #("p"  3) #("q" 10) #("r" 1) #("s" 1) #("t" 1)
                    #("u"  1) #("v"  4) #("w" 4) #("x" 8) #("y" 4)
                    #("z" 10))))
    (erl-transform old expected)))

(defun erl-transform (old expected) (is-equal expected (etl:transform old)))

Version data entries

396 entries across 396 versions & 1 rubygems

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