From 5087e500b71e099d38301510280548bb8ad48822 Mon Sep 17 00:00:00 2001 From: Nathan Marz Date: Tue, 7 Jun 2016 13:16:00 -0400 Subject: [PATCH] finish select-any tests --- test/com/rpl/specter/core_test.cljx | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/test/com/rpl/specter/core_test.cljx b/test/com/rpl/specter/core_test.cljx index 774e78e..261a5b3 100644 --- a/test/com/rpl/specter/core_test.cljx +++ b/test/com/rpl/specter/core_test.cljx @@ -1133,7 +1133,19 @@ ) ))) -;; select-any tests: -;; - if-path (both then and else branches) -;; - continuous-subseqs -;; - multi-path +(deftest multi-path-select-any-test + (is (= s/NONE (select-any (s/multi-path s/STOP s/STOP) 1))) + (is (= 1 (select-any (s/multi-path s/STAY s/STOP) 1) + (select-any (s/multi-path s/STOP s/STAY) 1) + (select-any (s/multi-path s/STOP s/STAY s/STOP) 1) + )) + (is (= s/NONE (select-any [(s/multi-path s/STOP s/STAY) even?] 1))) + ) + +(deftest if-path-select-any-test + (is (= s/NONE (select-any (s/if-path even? s/STAY) 1))) + (is (= 2 (select-any (s/if-path even? s/STAY s/STAY) 2))) + (is (= s/NONE (select-any [(s/if-path even? s/STAY s/STAY) odd?] 2))) + (is (= 2 (select-any (s/if-path odd? s/STOP s/STAY) 2))) + (is (= s/NONE (select-any [(s/if-path odd? s/STOP s/STAY) odd?] 2))) + )