Commits

Anonymous committed f6b8fd7

added vector including

Comments (0)

Files changed (2)

               (test "list-including negative (no list)"
                     #t
                     (verification-failure? (verify 2 is (list-including 2))))
+
+              (test "vector-including"
+                    #t
+                    (verification-success? (verify (vector 1 2) is (vector-including 2))))
+              (test "vector-including negative"
+                    #t
+                    (verification-failure? (verify (vector 1 2) is (vector-including 0))))
+              (test "vector-including negative (no vector)"
+                    #t
+                    (verification-failure? (verify 2 is (vector-including 2))))
               (test "none-of"
                     #t
                     (verification-success? (verify 1 is (none-of 4 5 6))))

veritas-verifiers.scm

   (and (list? subject)
        (every (cut member <> subject) (cons item more-items))))
 
-(define ((vector-including item . more-items) subject) #t)
+(define ((vector-including . args) subject)
+  (and (vector? subject)
+       (let ((subject (vector->list subject)))
+         (every (cut member <> subject) args))))
+
 (define ((hash-table-including item . more-items) subject) #t)
 
 )