add some extra test cases on equal? and chaperones

The compiler defeated my original attempt to check arguments in
both orders, but now I see the obvious way to (probably) check
both orders.
This commit is contained in:
Matthew Flatt 2014-04-29 06:58:53 -06:00
parent f2335ae4dc
commit f6cff4b52c

View File

@ -167,8 +167,11 @@
(test "bad get" exn-message exn)))
(err/rt-test (equal-hash-code b2) (lambda (exn)
(test "bad get" exn-message exn)))
(err/rt-test (equal? b2 (vector 1 'bad 3)) (lambda (exn)
(test "bad get" exn-message exn)))
(define b3 (vector 1 'bad 3))
(err/rt-test (equal? b2 b3) (lambda (exn)
(test "bad get" exn-message exn)))
(err/rt-test (equal? b3 b2) (lambda (exn)
(test "bad get" exn-message exn)))
(test (void) vector-set! b 1 'ok)
(test 'ok vector-ref b2 1)
(test (void) vector-set! b2 1 'fine)
@ -587,8 +590,12 @@
(set! got? #f)
(void (equal-secondary-hash-code c1))
(test #t values got?)
(define c3 (c 1))
(set! got? #f)
(void (equal? c1 (c 1)))
(void (equal? c1 c3))
(test #t values got?)
(set! got? #f)
(void (equal? c3 c1))
(test #t values got?))
;; Hashing with `prop:equal+hash`:
@ -610,9 +617,14 @@
(set! mine? #f)
(void (equal-secondary-hash-code d1))
(test '(#t #t) list got? mine?)
(define d3 (d 1))
(set! got? #f)
(set! mine? #f)
(test #t values (equal? d1 (d 1)))
(test #t values (equal? d1 d3))
(test '(#t #f) list got? mine?)
(set! got? #f)
(set! mine? #f)
(test #t values (equal? d3 d1))
(test '(#t #f) list got? mine?))
;; Hashing without `prop:equal+hash`:
@ -626,8 +638,12 @@
(set! got? #f)
(void (equal-secondary-hash-code d1))
(test '(#t) list got?)
(define d3 (d 1))
(set! got? #f)
(test #t values (equal? d1 (d 1)))
(test #t values (equal? d1 d3))
(test '(#t) list got?)
(set! got? #f)
(test #t values (equal? d3 d1))
(test '(#t) list got?)))
;; ----------------------------------------