Line | |
---|

1 | (import simple-tests) |
---|

2 | |
---|

3 | ;;; old interface |
---|

4 | |
---|

5 | (define-test (bar n) |
---|

6 | (positive? n) |
---|

7 | (even? n)) |
---|

8 | |
---|

9 | (define-test (foo x y) |
---|

10 | (< x y) |
---|

11 | "COMMENT" |
---|

12 | (bar 4) |
---|

13 | (odd? 3) |
---|

14 | (positive? 3)) |
---|

15 | |
---|

16 | (define-test (++) |
---|

17 | (= (+ 1 2) 3) |
---|

18 | (= (+ 1 2 3) 6)) |
---|

19 | |
---|

20 | (define-test (**) |
---|

21 | (= (* 1 2) 2) |
---|

22 | (= (* 1 2 3) 6)) |
---|

23 | |
---|

24 | (define-test (arithmetic) |
---|

25 | (++) |
---|

26 | (**)) |
---|

27 | |
---|

28 | (define-test (baz) |
---|

29 | (and? #t #t #t) |
---|

30 | (and?) |
---|

31 | (not (and? #t #f #t))) |
---|

32 | |
---|

33 | |
---|

34 | ;(compound-test (simple-tests) |
---|

35 | ; (baz) |
---|

36 | ; (arithmetic?) |
---|

37 | ; (foo 1 2) |
---|

38 | ; ) |
---|

39 | |
---|

40 | ;;; new interface |
---|

41 | |
---|

42 | (newline) |
---|

43 | (print "check") |
---|

44 | (print "=====") |
---|

45 | (check ((lst '(0 1 2 3))) |
---|

46 | lst |
---|

47 | '(0 1 2 3) |
---|

48 | (car lst) |
---|

49 | 0 |
---|

50 | (cadr lst) |
---|

51 | 1 |
---|

52 | (cddr lst) |
---|

53 | '(2 3) |
---|

54 | ) |
---|

55 | |
---|

56 | ;;; define-checks is an alias to do-checks |
---|

57 | (do-checks (bar? verbose? n 5) |
---|

58 | (positive? n) #t |
---|

59 | (even? n) #f) |
---|

60 | |
---|

61 | (define-checks (+? verbose?) |
---|

62 | (+ 1 2) 3 |
---|

63 | (+ 1 2 3) 6) |
---|

64 | |
---|

65 | (define-checks (*? verbose?) |
---|

66 | (* 1 2) 2 |
---|

67 | (* 1 2 3) 6) |
---|

68 | |
---|

69 | (define-checks (arithmetic? verbose?) |
---|

70 | (+? #f) #t |
---|

71 | (*? #f) #t) |
---|

72 | |
---|

73 | (do-checks (baz? verbose?) |
---|

74 | (and? #t #t #t) #t |
---|

75 | (and?) #t |
---|

76 | (and? #t #f #t) #f) |
---|

77 | |
---|

78 | (define-checks (qux? verbose?) |
---|

79 | ((== "x") "y") #f |
---|

80 | ((== "x") "x") #t |
---|

81 | ((== baz?) baz?) #t |
---|

82 | ((== baz?) bar) #f |
---|

83 | ((== '()) '()) #t |
---|

84 | ((== 'x) 'y) #f |
---|

85 | ((== 'x) 'x) #t |
---|

86 | ((== #(0 1 2)) #(0 1 2)) #t |
---|

87 | ((== #(0 1 2)) '(0 1 2)) #f |
---|

88 | ) |
---|

89 | |
---|

90 | (define counter |
---|

91 | (let ((n 0)) |
---|

92 | (lambda () |
---|

93 | (set! n (add1 n)) |
---|

94 | n))) |
---|

95 | |
---|

96 | (define-checks (counter? verbose?) |
---|

97 | (counter) 1 |
---|

98 | (counter) 2 |
---|

99 | (counter) 3 |
---|

100 | (counter) 4 |
---|

101 | ) |
---|

102 | |
---|

103 | |
---|

104 | (check-all SIMPLE (bar?) (*?) (+?) (arithmetic?) (baz?) (qux?) |
---|

105 | (counter?)) |
---|

**Note:** See

TracBrowser
for help on using the repository browser.