Skip to content

Commit

Permalink
failing fizzbuzz test
Browse files Browse the repository at this point in the history
  • Loading branch information
xificurC committed Jan 25, 2024
1 parent c39cc0a commit 000a0f4
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions test/hyperfiddle/electric/impl/runtime_test.cljc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
(ns hyperfiddle.electric.impl.runtime-test
(:require [missionary.core :as m]
[hyperfiddle.incseq :as i]
[hyperfiddle.electric :as-alias e]
[hyperfiddle.electric-de :as e]
#?(:clj [hyperfiddle.electric.impl.lang-de2 :as l])
[hyperfiddle.electric.impl.runtime-de :as r]
[hyperfiddle.rcf :as rcf :refer [tests %]]))
Expand All @@ -27,4 +27,20 @@
(on-diff! rcf/tap (root-frame (::l/join (i/fixed (m/watch !x)))))
% := {:degree 1, :permutation {}, :grow 1, :shrink 0, :change {0 :foo}, :freeze #{}}
(reset! !x :bar)
% := {:degree 1, :permutation {}, :grow 0, :shrink 0, :change {0 :bar}, :freeze #{}})
% := {:degree 1, :permutation {}, :grow 0, :shrink 0, :change {0 :bar}, :freeze #{}})

(tests
(def !n (atom 10))
(def !fizz (atom "Fizz"))
(def !buzz (atom "Buzz"))
(on-diff! rcf/tap (root-frame (e/server (let [fizz (e/watch !fizz) ; i/fixed + m/watch + e/join
buzz (e/watch !buzz)
is (e/diff-by identity (range 1 (inc (e/watch !n)))) ; variable in time and space
results (e/cursor [i is]
(cond
(zero? (mod i (* 3 5))) (str fizz buzz)
(zero? (mod i 3)) fizz
(zero? (mod i 5)) buzz
:else i))]
(println results)))))
% := {})

0 comments on commit 000a0f4

Please sign in to comment.