diff options
| author | Jake Zerrer <him@jakezerrer.com> | 2025-12-01 15:34:12 -0500 |
|---|---|---|
| committer | Jake Zerrer <him@jakezerrer.com> | 2025-12-01 15:34:19 -0500 |
| commit | daa831b0a44d344fb4256b004139c58f661f746d (patch) | |
| tree | d4182d8caeb65c21b2c5dc0af29723672a56d0cd /test/unheard/cycles_test.clj | |
| parent | b2347cb2766e2da2a725e3c2228ef2480dfaa207 (diff) | |
Add elongation
Diffstat (limited to 'test/unheard/cycles_test.clj')
| -rw-r--r-- | test/unheard/cycles_test.clj | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/test/unheard/cycles_test.clj b/test/unheard/cycles_test.clj index 0f55a2c..242b6fc 100644 --- a/test/unheard/cycles_test.clj +++ b/test/unheard/cycles_test.clj @@ -1,6 +1,6 @@ (ns unheard.cycles-test (:require [clojure.test :refer [deftest is testing]] - [unheard.cycles :refer [l f p rate unfold]])) + [unheard.cycles :refer [l f p rate elongate unfold]])) (deftest unfold-tests (testing "single scalar" @@ -128,4 +128,33 @@ (testing "nested rates" (is (= [[0 1/4 :a] [1/4 1/2 :a] [1/2 3/4 :a] [3/4 1 :a]] - (unfold 1 (rate 2 (rate 2 :a))))))) + (unfold 1 (rate 2 (rate 2 :a)))))) + + (testing "elongate 2 - element takes twice as long" + (is (= [[0 1/2 :a] [1/2 3/4 :b] [3/4 1 :c]] + (unfold 1 (l (elongate 2 :a) :b :c))))) + + (testing "elongate 3 - element takes three times as long" + (is (= [[0 3/5 :a] [3/5 4/5 :b] [4/5 1 :c]] + (unfold 1 (l (elongate 3 :a) :b :c))))) + + (testing "multiple elongations" + (is (= [[0 2/5 :a] [2/5 4/5 :b] [4/5 1 :c]] + (unfold 1 (l (elongate 2 :a) (elongate 2 :b) :c))))) + + (testing "elongate with fork" + (is (= [[0 1 :a] [1 2 :b]] + (unfold 1 (f (elongate 2 :a) :b))))) + + (testing "elongate inside parallel" + (is (= [[0 1 :a] [0 1 :b]] + (unfold 1 (p (elongate 2 :a) :b))))) + + (testing "elongate with rate" + (is (= [[0 1/2 :a] [1/2 1 :a]] + (unfold 1 (elongate 2 (rate 2 :a)))))) + + (testing "rate with elongate inside list" + (is (= [[0 1/4 :a] [1/4 3/8 :b] [3/8 1/2 :c] + [1/2 3/4 :a] [3/4 7/8 :b] [7/8 1 :c]] + (unfold 1 (rate 2 (l (elongate 2 :a) :b :c))))))) |
