Skip to content
Browse files

Adding tests for multiple arity on p* and *c

  • Loading branch information...
1 parent 25de90d commit f4dfbeb7ebc3d6785cce510dd983860ce31c1e9d @roman committed
Showing with 16 additions and 13 deletions.
  1. +16 −13 test/river/test/core.clj
View
29 test/river/test/core.clj
@@ -4,16 +4,19 @@
(:require [river.seq :as rs])
(:use river.core))
-;(deftest test-gen-producer
-; (let [producer (gen-producer #(rs/produce-seq (range 1 5) %)
-; #(rs/produce-seq (range 5 10) %)
-; #(rs/filter* even? %))
-; result (run (producer rs/consume))]
-; (is (= [6 8 2 4] (:result result)))))
-;
-;(deftest test-gen-producer>
-; (let [producer (gen-producer> (rs/produce-seq (range 1 5))
-; (rs/produce-seq (range 5 10))
-; (rs/filter* even?))
-; result (run (producer rs/consume))]
-; (is (= [6 8 2 4] (:result result)))))
+(deftest p*-multiple-arity-test
+ (let [result (run (p* (rs/produce-seq (range 1 1000))
+ (rs/filter* #(odd? %))
+ (rs/isolate* 10))
+ rs/consume)]
+ (is (= [1 3 5 7 9 11 13 15 17 19] (:result result)))
+ (is eof (:remainder result))))
+
+(deftest *c-multiple-arity-test
+ (let [result (run (rs/produce-seq (range 1 1000))
+ (*c (rs/filter* #(odd? %))
+ (rs/isolate* 10)
+ rs/consume))]
+ (is (= [1 3 5 7 9 11 13 15 17 19] (:result result)))
+ (is eof (:remainder result))))
+

0 comments on commit f4dfbeb

Please sign in to comment.
Something went wrong with that request. Please try again.