From fc3586a331fe0e0ed5130d262e258aba347c213c Mon Sep 17 00:00:00 2001 From: Robby Findler Date: Wed, 22 Mar 2006 21:12:53 +0000 Subject: [PATCH] defeats the inlining optimization by making procedure bodies big in order to do lazy contract checking svn: r2486 original commit: 8617ca8fcdb1ede4c6ede7e63073cfc36fa5f447 --- collects/tests/mzscheme/contract-test.ss | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/collects/tests/mzscheme/contract-test.ss b/collects/tests/mzscheme/contract-test.ss index 6bf98ef..e87a30f 100644 --- a/collects/tests/mzscheme/contract-test.ss +++ b/collects/tests/mzscheme/contract-test.ss @@ -3521,6 +3521,19 @@ (couple-hd (contract c1 y 'pos 'neg)))) 1) + ;; make sure that define-contract-struct contracts can go at the top level + (test/spec-passed + 'd-c-s37 + '(parameterize ([current-namespace (make-namespace)]) + (eval '(require (lib "contract.ss"))) + (eval '(define-contract-struct couple (hd tl))) + (eval '(contract-stronger? + (couple/dc [hd any/c] + [tl (hd) any/c]) + (couple/dc [hd any/c] + [tl (hd) any/c]))))) + + ;; test the predicate (let () (define-contract-struct couple (hd tl)) @@ -3926,6 +3939,10 @@ (test #f contract-stronger? (couple/c (>=/c 2) (>=/c 3)) (couple/c (>=/c 4) (>=/c 5))) (test #t contract-stronger? (couple/c (>=/c 4) (>=/c 5)) (couple/c (>=/c 2) (>=/c 3))) (test #f contract-stronger? (couple/c (>=/c 1) (>=/c 5)) (couple/c (>=/c 5) (>=/c 1))) + (let ([ctc (couple/dc [hd any/c] [tl (hd) any/c])]) + (test #t contract-stronger? ctc ctc)) + (let ([ctc (couple/dc [hd any/c] [tl (hd) (<=/c hd)])]) + (test #t contract-stronger? ctc ctc)) (test #t contract-stronger? list-of-numbers list-of-numbers) (test #t contract-stronger? (short-list/less-than 4) (short-list/less-than 5)) (test #f contract-stronger? (short-list/less-than 5) (short-list/less-than 4))