set svn:eol-style

svn: r8875
This commit is contained in:
Eli Barzilay 2008-03-04 17:28:15 +00:00
parent 1f5a7bf90a
commit db62afaadc
6 changed files with 19 additions and 20 deletions

View File

@ -14,4 +14,4 @@
(idraw:installer plthome) (idraw:installer plthome)
(graph:installer plthome)) (graph:installer plthome))
) )

View File

@ -16,4 +16,3 @@
(test-true "active?" (active? 'mf)) (test-true "active?" (active? 'mf))
(test-false "active? 2" (active? 'kk)) (test-false "active? 2" (active? 'kk))
(test-true "set name" (void? (set-name 'mf "matt"))))) (test-true "set name" (void? (set-name 'mf "matt")))))

View File

@ -2,12 +2,12 @@
(require "1.ss") ;; the module just above (require "1.ss") ;; the module just above
;; implementation ;; implementation
;; [listof (list basic-customer? secret-info)] ;; [listof (list basic-customer? secret-info)]
(define all '()) (define all '())
(define (find c) (define (find c)
(define (has-c-as-key p) (define (has-c-as-key p)
(id-equal? (basic-customer-id (car p)) c)) (id-equal? (basic-customer-id (car p)) c))
(define x (filter has-c-as-key all)) (define x (filter has-c-as-key all))
(if (pair? x) (car x) x)) (if (pair? x) (car x) x))
@ -33,27 +33,27 @@
(set-basic-customer-name! (car bc-with-id) name)) (set-basic-customer-name! (car bc-with-id) name))
(define c0 0) (define c0 0)
;; end of implementation ;; end of implementation
(provide/contract (provide/contract
;; how many customers are in the db? ;; how many customers are in the db?
[count natural-number/c] [count natural-number/c]
;; is the customer with this id active? ;; is the customer with this id active?
[active? (-> id? boolean?)] [active? (-> id? boolean?)]
;; what is the name of the customer with this id? ;; what is the name of the customer with this id?
[name (-> (and/c id? active?) string?)] [name (-> (and/c id? active?) string?)]
;; change the name of the customer with this id ;; change the name of the customer with this id
[set-name (->d ([id id?] [nn string?]) [set-name (->d ([id id?] [nn string?])
() ()
[result any/c] ;; result contract [result any/c] ;; result contract
#:post-cond #:post-cond
(string=? (name id) nn))] (string=? (name id) nn))]
[add (->d ([bc (and/c basic-customer? not-active?)]) [add (->d ([bc (and/c basic-customer? not-active?)])
() ()
;; A pre-post condition contract must use ;; A pre-post condition contract must use
;; a side-effect to express this contract ;; a side-effect to express this contract
;; via post-conditions ;; via post-conditions
#:pre-cond (set! c0 count) #:pre-cond (set! c0 count)
[result any/c] ;; result contract [result any/c] ;; result contract
#:post-cond (> count c0))]) #:post-cond (> count c0))])

View File

@ -7,10 +7,10 @@
(define s2 (push (push s0 2) 1)) (define s2 (push (push s0 2) 1))
(test/text-ui (test/text-ui
(test-suite (test-suite
"stack" "stack"
(test-true (test-true
"empty" "empty"
(is-empty? (initialize (flat-contract integer?) =))) (is-empty? (initialize (flat-contract integer?) =)))
(test-true "push" (stack? s2)) (test-true "push" (stack? s2))
(test-true (test-true

View File

@ -7,7 +7,7 @@
(define d (put (put (put d0 'a 2) 'b 2) 'c 1)) (define d (put (put (put d0 'a 2) 'b 2) 'c 1))
(test/text-ui (test/text-ui
(test-suite (test-suite
"dictionaries" "dictionaries"
(test-equal? "value for" 2 (value-for d 'b)) (test-equal? "value for" 2 (value-for d 'b))
(test-false "has?" (has? (rem d 'b) 'b)) (test-false "has?" (has? (rem d 'b) 'b))

View File

@ -6,9 +6,9 @@
(define s (put (put (initialize (flat-contract integer?) =) 2) 1)) (define s (put (put (initialize (flat-contract integer?) =) 2) 1))
(test/text-ui (test/text-ui
(test-suite (test-suite
"queue" "queue"
(test-true (test-true
"empty" "empty"
(is-empty? (initialize (flat-contract integer?) =))) (is-empty? (initialize (flat-contract integer?) =)))
(test-true "put" (queue? s)) (test-true "put" (queue? s))