-
Notifications
You must be signed in to change notification settings - Fork 21
/
testErrors.rkt
128 lines (93 loc) · 3.39 KB
/
testErrors.rkt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
;Testing Examples
(check-expect 2 2 2 2 2)
(define (f x) (+ x 2)) (f 1 2 3 4 5 6)
(2 4 5)
(2)
(star 1 2 3 4 5 6)
(/ 5 0)
(/ 5 (- 2 2))
(/ 4 3 2 0 1 2)
(/ 4 3 2 0)
(substring "hello" 6)
(substring "hello" 12 0)
(substring "hello" 2 12)
(list-ref (list 1 2 3 4) 4)
(list-ref (list 1 2 3 4) 7)
(list-ref (list 1 2 3 4) -2)
(explode 2)
(string-length 45)
(* 2 "hello")
(+ 2 2 2 2 "hello" 2 2 2)
(/ "hello" 4)
(star 1 1 1 1 1)
(square 50 9 "red")
(check-expect 3 2)
(define (f x)
(cond
[else 6]
[(= 2 1) 4]))
(define (label-near? name label word1 word2 word3)
(cond [(string=? word1 name)
(cond [(string=? word2 label) true] [(string=? word3 label) true])
[(string=? word2 name)
(cond [(string=? word1 label) true]
[(string=? word2 label) true])
[(string=? word3 name)
(cond [(string=? word2 label) true]
[(string=? word3 label) true])
[else false]]]]))
(define (f x)
(cond
[(= x 1) 1]
[(= x 2) 1 2 3 4]
[(= x 3) 3]
[else 4]))
(define (f x)
(cond
[(= x 1) 1]
[(= x 2)]
[(= x 3) 3]
[else 4]))
(define )
(define () )
(define () 3)
(define () 3 4 5)
(define (x) )
(define (x) 3)
(define (x y) 3 4)
(define ("x") )
(define ("x") )
(define ("x" y ) 2)
(define (x y 7) 4)
(define x)
(define x 1 2 3 4)
(define x y 1 2 3)
(define "x" 1)
;Changed error messages
;procedure application: expected procedure ... TO function application: expected function
;[5,3] to 5 or 3
;deleted some instances of first person in error message text
;compile-time errors
;if
;;make-moby-error-type:if-too-few-elements
;;make-moby-error-type:if-too-many-elements
;cond
;;conditional-clause-too-many-elements
;;conditional-clause-too-few-elements
;;conditional-malformed-clause
;;conditional-missing-question-answer
;;else clause should be last but there is another clause after it
;quote
;;make-moby-error-type:quote-too-few-elements
;;make-moby-error-type:quote-too-many-elements
(define (label-near? name label word1 word2 word3)
(cond [(string=? word1 name)
(cond [(string=? word2 label) true] [(string=? word3 label) true])
[(string=? word2 name)
(cond [(string=? word1 label) true]
[(string=? word2 label) true])
[(string=? word3 name)
(cond [(string=? word2 label) true]
[(string=? word3 label) true])
[else false]]]]))
;;big-bang, make-struct-field-accessor, bitmap/url