check-values-tests.ss
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; check-values-tests.ss
;;
;; Copyright (c) 2007 Richard Cobbe.  All rights reserved.
;;
;; Testcases for check-values.ss
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(module check-values-tests mzscheme

  (require (planet "test.ss" ("schematics" "schemeunit.plt" 2))
           (planet "util.ss" ("schematics" "schemeunit.plt" 2))
           "check-values.ss")

  (provide check-values-tests)

  (define q/r quotient/remainder)

  (define check-values-tests
    (test-suite "check-values.plt tests"
      (test-suite "check-values tests"
        (test-case "check-values test"
          (check-values (q/r 5 2) ([= 2] [= 1]) "foo"))
        (test-case "check-values arity mismatch"
          (check-values (q/r 5 2) ([= 2]) "bar"))
        (test-case "check-values arity mismatch 2"
          (check-values (q/r 5 2) ([= 2] [= 3] [= 4]) "baz"))
        (test-case "check-values value mismatch"
          (check-values (q/r 5 2) ([= 1] [= 1]) "quux"))
        (test-case "check-values w/o msg"
          (check-values (q/r 5 2) ([= 2] [= 1])))
        (test-case "check-values w/o msg fail arity"
          (check-values (q/r 5 2) ([= 2])))
        (test-case "check-values w/o msg fail arity 2"
          (check-values (q/r 5 2) ([= 2] [= 3] [= 4])))
        (test-case "check-values w/o msg fail mismatch"
          (check-values (q/r 5 2) ([= 2] [= 2]))))

      (test-suite "check-values* tests"
        (test-case "check-values* test"
          (check-values* = (q/r 5 2) (2 1) "foo"))
        (test-case "check-values* arity mismatch"
          (check-values* = (q/r 5 2) (2) "bar"))
        (test-case "check-values* arity mismatch 2"
          (check-values* = (q/r 5 2) (2 3 4) "baz"))
        (test-case "check-values* value mismatch"
          (check-values* = (q/r 5 2) (1 1) "quux"))
        (test-case "check-values* w/o msg"
          (check-values* = (q/r 5 2) (2 1)))
        (test-case "check-values* w/o msg fail arity"
          (check-values* = (q/r 5 2) (2)))
        (test-case "check-values* w/o msg fail arity 2"
          (check-values* = (q/r 5 2) (2 3 4)))
        (test-case "check-values* w/o msg fail mismatch"
          (check-values* = (q/r 5 2) (2 2)))))))