(ns unheard.time-object-test (:require [unheard.time-object :as sut] [missionary.core :as m] [hyperfiddle.rcf :refer [tests] :as rcf])) (tests "behavioral test" (let [to1-start (atom 5) >to1-start (m/watch to1-start) to1-end (atom 10) >to1-end (m/watch to1-end) to1-value (atom :to1-a) >to1-value (m/watch to1-value) to1 (sut/time-object >to1-start >to1-end >to1-value) to2-start (atom 7) >to2-start (m/watch to2-start) to2-end (atom 15) >to2-end (m/watch to2-end) to2-value (atom :to1-b) >to2-value (m/watch to2-value) to2 (sut/time-object >to2-start >to2-end >to2-value) toc1 (sut/time-object-collection to1 to2) to3-start (atom 2) >to3-start (m/watch to3-start) to3-end (atom 3) >to3-end (m/watch to3-end) to3-value (atom :to3-a) >to3-value (m/watch to3-value) to3 (sut/time-object >to3-start >to3-end >to3-value) to4-start (atom 8) >to4-start (m/watch to4-start) to4-end (atom 12) >to4-end (m/watch to4-end) to4-value (atom :to3-b) >to4-value (m/watch to4-value) to4 (sut/time-object >to4-start >to4-end >to4-value) toc2 (sut/time-object-collection to3 to4) combined (sut/time-object-collection toc1 toc2) timeline (sut/timeline combined) point-query-at (atom 0) >point-query-at (m/watch point-query-at) point-query-result (sut/point-query timeline >point-query-at) #_#_#_#_#_#_ range-query-range (atom [0 10]) >range-query-range (m/watch range-query-range) range-query-result (sut/range-query timeline >range-query-range) ] (def cancel ((m/reduce rcf/tap nil point-query-result) #() #(throw %))) (cancel) ))