PageRenderTime 20ms CodeModel.GetById 13ms app.highlight 4ms RepoModel.GetById 2ms app.codeStats 0ms

/trunk/Examples/test-suite/chicken/member_pointer_runme.ss

#
Scheme | 28 lines | 18 code | 9 blank | 1 comment | 0 complexity | 74b12d6adf6f609b8f9be25217b6dd9b MD5 | raw file
 1(require 'member_pointer)
 2
 3(define (check-eq? msg expected actual)
 4  (if (not (= expected actual))
 5    (error "Error " msg ": expected " expected " got " actual)))
 6
 7(define area-pt (areapt))
 8(define perim-pt (perimeterpt))
 9
10(define s (new-Square 10))
11
12(check-eq? "Square area" 100.0 (do-op s area-pt))
13(check-eq? "Square perim" 40.0 (do-op s perim-pt))
14
15(check-eq? "Square area" 100.0 (do-op s (areavar)))
16(check-eq? "Square perim" 40.0 (do-op s (perimetervar)))
17
18;; Set areavar to return value of function
19(areavar perim-pt)
20(check-eq? "Square perim" 40 (do-op s (areavar)))
21
22(check-eq? "Square area" 100.0 (do-op s (AREAPT)))
23(check-eq? "Square perim" 40.0 (do-op s (PERIMPT)))
24
25(define test (NULLPT))
26
27(perimetervar (AREAPT))
28(check-eq? "Square area" 100.0 (do-op s (perimetervar)))