PageRenderTime 5ms CodeModel.GetById 1ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/trunk/Examples/test-suite/schemerunme/list_vector.scm

#
Lisp | 26 lines | 22 code | 4 blank | 0 comment | 0 complexity | ec78df46b96fda6314e958d423af3ed9 MD5 | raw file
 1(define-macro (check-equality form1 form2)
 2  `(let ((result1 ,form1)
 3	 (result2 ,form2))
 4     (if (not (equal? result1 result2))
 5	 (error "Check failed:"
 6		(list 'equal? ',form1 ',form2)
 7		result1 result2))))
 8
 9(check-equality (sum-list '(1 3 4 6 7)) 21.0)
10(check-equality (sum-vector #(2 4 6 7 9)) 28.0)
11(check-equality (one-to-seven-list) '(1 2 3 4 5 6 7))
12(check-equality (one-to-seven-vector) #(1 2 3 4 5 6 7))
13
14(check-equality (sum-list2 '(1 3 4 6 7)) 21.0)
15(check-equality (sum-vector2 #(2 4 6 7 9)) 28.0)
16(check-equality (one-to-seven-list2) '(1 2 3 4 5 6 7))
17(check-equality (one-to-seven-vector2) #(1 2 3 4 5 6 7))
18
19(check-equality (sum-lists '(1 2 3) '(4 5 6) '(7 8 9)) 45.0)
20(check-equality (sum-lists2 '(1 2 3) '(4 5 6) '(7 8 9)) 45.0)
21(check-equality (call-with-values produce-lists list)
22	       '(#(0 1 2 3 4)
23		 #(0 1 4 9 16)
24		 #(0.0 1.5 3.0 4.5 6.0)))
25
26(exit 0)