Skip to content
This repository
Browse code

fixes issue #65...caused the tests to fail. Fixed the tests

  • Loading branch information...
commit 7fa31fc49ea00f1fd5c96547aecc905e32d9ca01 1 parent ff85b7a
Timothy Baldridge authored March 19, 2012
12  clojure/core.clj
@@ -2817,10 +2817,14 @@
2817 2817
         need-ns (or as use)
2818 2818
         filter-opts (select-keys opts '(:exclude :only :rename))]
2819 2819
        (load-all lib)
2820  
-       (if as
2821  
-           (alias (:as opts) lib to-ns))
2822  
-           (map-ns-vals lib to-ns opts)))
2823  
-
  2820
+       (cond (not options)
  2821
+              (py/setattr (the-ns (name to-ns)) 
  2822
+                          (name lib) 
  2823
+                          (load-all lib))
  2824
+             as
  2825
+              (alias (:as opts) lib to-ns)
  2826
+             :else 
  2827
+              (map-ns-vals lib to-ns opts))))
2824 2828
 
2825 2829
 (defmacro require
2826 2830
     [& options]
3  examples/rpython/rpythontest.clj
@@ -33,9 +33,8 @@
33 33
 ;; clojure pypy : 48 sec
34 34
 ;; clojure on rpython: 6sec
35 35
 
36  
-(defn main [x]
  36
+(defn main {:static true} [x]
37 37
      (py.bytecode/PRINT_ITEM (test 19999999)))
38  
-;(time (test 19999999))
39 38
 
40 39
 
41 40
 
430  tests/core-tests.clj
@@ -21,8 +21,8 @@
21 21
          (assertions/assert-true (identical? tmp tmp))))
22 22
 
23 23
 (deftest compare-tests
24  
-    (assert-lesser (compare 0 1) 0)
25  
-    (assert-lesser (compare -1 0) 0))
  24
+    (assertions/assert-lesser (compare 0 1) 0)
  25
+    (assertions/assert-lesser (compare -1 0) 0))
26 26
 
27 27
 (deftest or-tests
28 28
     (assertions/assert-true (or true false false))
@@ -34,12 +34,12 @@
34 34
     (assertions/assert-false (zero? 1)))
35 35
 
36 36
 (deftest count-tests
37  
-    (assert-equal (count '()) 0)
38  
-    (assert-equal (count '(1)) 1))
  37
+    (assertions/assert-equal (count '()) 0)
  38
+    (assertions/assert-equal (count '(1)) 1))
39 39
 
40 40
 (deftest int-tests
41  
-    (assert-equal (int "1") 1)
42  
-    (assert-equal (int "-1") -1))
  41
+    (assertions/assert-equal (int "1") 1)
  42
+    (assertions/assert-equal (int "-1") -1))
43 43
 
44 44
 (deftest <-tests
45 45
     (assertions/assert-true (< 1))
@@ -49,12 +49,12 @@
49 49
     (assertions/assert-false (< 1 3 2 4)))
50 50
 
51 51
 (deftest reduce1-tests
52  
-    (assert-equal (reduce1 (fn [x y] (py.bytecode/BINARY_ADD x y))
  52
+    (assertions/assert-equal (reduce1 (fn [x y] (py.bytecode/BINARY_ADD x y))
53 53
                             '(1 2 3 4)) 10)
54  
-    (assert-equal (reduce1 (fn [x y] (py.bytecode/BINARY_ADD x y))
  54
+    (assertions/assert-equal (reduce1 (fn [x y] (py.bytecode/BINARY_ADD x y))
55 55
                             5 '(1 2 3 4)) 15))
56 56
 (deftest reverse-tests
57  
-    (assert-equal (reverse [1 2 3 4 5]) [5 4 3 2 1]))
  57
+    (assertions/assert-equal (reverse [1 2 3 4 5]) [5 4 3 2 1]))
58 58
 
59 59
 (deftest >1?-tests
60 60
     (assertions/assert-true (>1? 3))
@@ -66,26 +66,26 @@
66 66
 
67 67
 
68 68
 (deftest +-tests
69  
-    (assert-equal (+) 0)
70  
-    (assert-equal (+ 1) 1)
71  
-    (assert-equal (+ 1 2) 3)
72  
-    (assert-equal (+ 1 2 3 4) 10))
  69
+    (assertions/assert-equal (+) 0)
  70
+    (assertions/assert-equal (+ 1) 1)
  71
+    (assertions/assert-equal (+ 1 2) 3)
  72
+    (assertions/assert-equal (+ 1 2 3 4) 10))
73 73
 
74 74
 (deftest *-tests
75  
-    (assert-equal (*) 1)
76  
-    (assert-equal (* 1) 1)
77  
-    (assert-equal (* 1 2) 2)
78  
-    (assert-equal (* 1 2 3 4) 24))
  75
+    (assertions/assert-equal (*) 1)
  76
+    (assertions/assert-equal (* 1) 1)
  77
+    (assertions/assert-equal (* 1 2) 2)
  78
+    (assertions/assert-equal (* 1 2 3 4) 24))
79 79
 
80 80
 (deftest /-tests
81  
-    (assert-equal (/ 1) 1)
82  
-    (assert-equal (/ 2 2) 1)
83  
-    (assert-equal (/ 20 5 2) 2))
  81
+    (assertions/assert-equal (/ 1) 1)
  82
+    (assertions/assert-equal (/ 2 2) 1)
  83
+    (assertions/assert-equal (/ 20 5 2) 2))
84 84
 
85 85
 (deftest /-tests
86  
-    (assert-equal (- 1) -1)
87  
-    (assert-equal (- 2 2) 0)
88  
-    (assert-equal (- 20 5 2) 13))
  86
+    (assertions/assert-equal (- 1) -1)
  87
+    (assertions/assert-equal (- 2 2) 0)
  88
+    (assertions/assert-equal (- 20 5 2) 13))
89 89
 
90 90
 (deftest <=-tests
91 91
     (assertions/assert-true (<= 1))
@@ -112,14 +112,14 @@
112 112
     (assertions/assert-false (== 1 2 1 1 1)))
113 113
 
114 114
 (deftest max-tests
115  
-    (assert-equal (max 1) 1)
116  
-    (assert-equal (max 1 2) 2)
117  
-    (assert-equal (max 3 2 1) 3))
  115
+    (assertions/assert-equal (max 1) 1)
  116
+    (assertions/assert-equal (max 1 2) 2)
  117
+    (assertions/assert-equal (max 3 2 1) 3))
118 118
 
119 119
 (deftest min-tests
120  
-    (assert-equal (min 1) 1)
121  
-    (assert-equal (min 1 2) 1)
122  
-    (assert-equal (min 3 2 1) 1))
  120
+    (assertions/assert-equal (min 1) 1)
  121
+    (assertions/assert-equal (min 1 2) 1)
  122
+    (assertions/assert-equal (min 3 2 1) 1))
123 123
 
124 124
 (deftest pos?-tests
125 125
     (assertions/assert-true (pos? 1))
@@ -132,140 +132,140 @@
132 132
     (assertions/assert-false (neg? 0)))
133 133
 
134 134
 (deftest quot-tests
135  
-    (assert-equal (quot 23 7) 3)
136  
-    (assert-equal (quot 4 2) 2)
137  
-    (assert-equal (quot 3 2) 1)
138  
-    (assert-equal (quot 6 4) 1)
139  
-    (assert-equal (quot 0 5) 0)
  135
+    (assertions/assert-equal (quot 23 7) 3)
  136
+    (assertions/assert-equal (quot 4 2) 2)
  137
+    (assertions/assert-equal (quot 3 2) 1)
  138
+    (assertions/assert-equal (quot 6 4) 1)
  139
+    (assertions/assert-equal (quot 0 5) 0)
140 140
     
141  
-    ;(assert-equal (quot 2 1/2) 4)
142  
-    ;(assert-equal (quot 2/3 1/2) 1)
143  
-    ;(assert-equal (quot 1 2/3) 1)
  141
+    ;(assertions/assert-equal (quot 2 1/2) 4)
  142
+    ;(assertions/assert-equal (quot 2/3 1/2) 1)
  143
+    ;(assertions/assert-equal (quot 1 2/3) 1)
144 144
     
145  
-    (assert-equal (quot 4.0 2.0) 2.0)
146  
-    (assert-equal (quot 4.5 2.0) 2.0)
  145
+    (assertions/assert-equal (quot 4.0 2.0) 2.0)
  146
+    (assertions/assert-equal (quot 4.5 2.0) 2.0)
147 147
     ; |num| > |div|, num != k * div
148  
-    (assert-equal (quot 42 5) 8)     ; (8 * 5) + 2 == 42
149  
-    (assert-equal (quot 42 -5) -8)   ; (-8 * -5) + 2 == 42
150  
-    (assert-equal (quot -42 5) -8)   ; (-8 * 5) + -2 == -42
151  
-    (assert-equal (quot -42 -5) 8)   ; (8 * -5) + -2 == -42
  148
+    (assertions/assert-equal (quot 42 5) 8)     ; (8 * 5) + 2 == 42
  149
+    (assertions/assert-equal (quot 42 -5) -8)   ; (-8 * -5) + 2 == 42
  150
+    (assertions/assert-equal (quot -42 5) -8)   ; (-8 * 5) + -2 == -42
  151
+    (assertions/assert-equal (quot -42 -5) 8)   ; (8 * -5) + -2 == -42
152 152
     ; |num| > |div|, num = k * div
153  
-    (assert-equal (quot 9 3) 3)
154  
-    (assert-equal (quot 9 -3) -3)
155  
-    (assert-equal (quot -9 3) -3)
156  
-    (assert-equal (quot -9 -3) 3)
  153
+    (assertions/assert-equal (quot 9 3) 3)
  154
+    (assertions/assert-equal (quot 9 -3) -3)
  155
+    (assertions/assert-equal (quot -9 3) -3)
  156
+    (assertions/assert-equal (quot -9 -3) 3)
157 157
     ; |num| < |div|
158  
-    (assert-equal (quot 2 5) 0)
159  
-    (assert-equal (quot 2 -5) 0)
160  
-    (assert-equal (quot -2 5) 0)
161  
-    (assert-equal (quot -2 -5) 0)
  158
+    (assertions/assert-equal (quot 2 5) 0)
  159
+    (assertions/assert-equal (quot 2 -5) 0)
  160
+    (assertions/assert-equal (quot -2 5) 0)
  161
+    (assertions/assert-equal (quot -2 -5) 0)
162 162
 
163 163
     ; num = 0, div != 0
164  
-    (assert-equal (quot 0 3) 0)
165  
-    (assert-equal (quot 0 -3) 0)
  164
+    (assertions/assert-equal (quot 0 3) 0)
  165
+    (assertions/assert-equal (quot 0 -3) 0)
166 166
     )
167 167
     
168 168
 
169 169
 (deftest rem-tests
170  
-    (assert-equal (rem 23 7) 2)
171  
-    (assert-equal (rem 4 2) 0)
172  
-    (assert-equal (rem 3 2) 1)
173  
-    (assert-equal (rem 6 4) 2)
174  
-    (assert-equal (rem 0 5) 0)
  170
+    (assertions/assert-equal (rem 23 7) 2)
  171
+    (assertions/assert-equal (rem 4 2) 0)
  172
+    (assertions/assert-equal (rem 3 2) 1)
  173
+    (assertions/assert-equal (rem 6 4) 2)
  174
+    (assertions/assert-equal (rem 0 5) 0)
175 175
 
176  
-    ;(assert-equal (rem 2 1/2) 0)
177  
-    ;(assert-equal (rem 2/3 1/2) 1/6)
178  
-    ;(assert-equal (rem 1 2/3) 1/3)
  176
+    ;(assertions/assert-equal (rem 2 1/2) 0)
  177
+    ;(assertions/assert-equal (rem 2/3 1/2) 1/6)
  178
+    ;(assertions/assert-equal (rem 1 2/3) 1/3)
179 179
 
180  
-    (assert-equal (rem 4.0 2.0) 0.0)
181  
-    (assert-equal (rem 4.5 2.0) 0.5)
  180
+    (assertions/assert-equal (rem 4.0 2.0) 0.0)
  181
+    (assertions/assert-equal (rem 4.5 2.0) 0.5)
182 182
 
183 183
     ; |num| > |div|, num != k * div
184  
-    (assert-equal (rem 42 5) 2)      ; (8 * 5) + 2 == 42
185  
-    (assert-equal (rem 42 -5) 2)     ; (-8 * -5) + 2 == 42
186  
-    (assert-equal (rem -42 5) -2)    ; (-8 * 5) + -2 == -42
187  
-    (assert-equal (rem -42 -5) -2)   ; (8 * -5) + -2 == -42
  184
+    (assertions/assert-equal (rem 42 5) 2)      ; (8 * 5) + 2 == 42
  185
+    (assertions/assert-equal (rem 42 -5) 2)     ; (-8 * -5) + 2 == 42
  186
+    (assertions/assert-equal (rem -42 5) -2)    ; (-8 * 5) + -2 == -42
  187
+    (assertions/assert-equal (rem -42 -5) -2)   ; (8 * -5) + -2 == -42
188 188
 
189 189
     ; |num| > |div|, num = k * div
190  
-    (assert-equal (rem 9 3) 0)
191  
-    (assert-equal (rem 9 -3) 0)
192  
-    (assert-equal (rem -9 3) 0)
193  
-    (assert-equal (rem -9 -3) 0)
  190
+    (assertions/assert-equal (rem 9 3) 0)
  191
+    (assertions/assert-equal (rem 9 -3) 0)
  192
+    (assertions/assert-equal (rem -9 3) 0)
  193
+    (assertions/assert-equal (rem -9 -3) 0)
194 194
 
195 195
     )
196 196
 
197 197
 (deftest mod-tests
198  
-    (assert-equal (rem 23 7) 2)
199  
-    (assert-equal (mod 4 2) 0)
200  
-    (assert-equal (mod 3 2) 1)
201  
-    (assert-equal (mod 6 4) 2)
202  
-    (assert-equal (mod 0 5) 0)
  198
+    (assertions/assert-equal (rem 23 7) 2)
  199
+    (assertions/assert-equal (mod 4 2) 0)
  200
+    (assertions/assert-equal (mod 3 2) 1)
  201
+    (assertions/assert-equal (mod 6 4) 2)
  202
+    (assertions/assert-equal (mod 0 5) 0)
203 203
 
204  
-    ;(assert-equal (mod 2 1/2) 0)
205  
-    ;(assert-equal (mod 2/3 1/2) 1/6)
206  
-    ;(assert-equal (mod 1 2/3) 1/3)
  204
+    ;(assertions/assert-equal (mod 2 1/2) 0)
  205
+    ;(assertions/assert-equal (mod 2/3 1/2) 1/6)
  206
+    ;(assertions/assert-equal (mod 1 2/3) 1/3)
207 207
 
208  
-    (assert-equal (mod 4.0 2.0) 0.0)
209  
-    (assert-equal (mod 4.5 2.0) 0.5)
  208
+    (assertions/assert-equal (mod 4.0 2.0) 0.0)
  209
+    (assertions/assert-equal (mod 4.5 2.0) 0.5)
210 210
 
211 211
     ; |num| > |div|, num != k * div
212  
-    (assert-equal (mod 42 5) 2)      ; (42 / 5) * 5 + (42 mod 5)        = 8 * 5 + 2        = 42
213  
-    (assert-equal (mod 42 -5) -3)    ; (42 / -5) * (-5) + (42 mod -5)   = -9 * (-5) + (-3) = 42
214  
-    (assert-equal (mod -42 5) 3)     ; (-42 / 5) * 5 + (-42 mod 5)      = -9 * 5 + 3       = -42
215  
-    (assert-equal (mod -42 -5) -2)  ; (-42 / -5) * (-5) + (-42 mod -5) = 8 * (-5) + (-2)  = -42
  212
+    (assertions/assert-equal (mod 42 5) 2)      ; (42 / 5) * 5 + (42 mod 5)        = 8 * 5 + 2        = 42
  213
+    (assertions/assert-equal (mod 42 -5) -3)    ; (42 / -5) * (-5) + (42 mod -5)   = -9 * (-5) + (-3) = 42
  214
+    (assertions/assert-equal (mod -42 5) 3)     ; (-42 / 5) * 5 + (-42 mod 5)      = -9 * 5 + 3       = -42
  215
+    (assertions/assert-equal (mod -42 -5) -2)  ; (-42 / -5) * (-5) + (-42 mod -5) = 8 * (-5) + (-2)  = -42
216 216
 
217 217
     ; |num| > |div|, num = k * div
218  
-    (assert-equal (mod 9 3) 0)      ; (9 / 3) * 3 + (9 mod 3) = 3 * 3 + 0 = 9
219  
-    (assert-equal (mod 9 -3) 0)
220  
-    (assert-equal (mod -9 3) 0)
221  
-    (assert-equal (mod -9 -3) 0)
  218
+    (assertions/assert-equal (mod 9 3) 0)      ; (9 / 3) * 3 + (9 mod 3) = 3 * 3 + 0 = 9
  219
+    (assertions/assert-equal (mod 9 -3) 0)
  220
+    (assertions/assert-equal (mod -9 3) 0)
  221
+    (assertions/assert-equal (mod -9 -3) 0)
222 222
 
223 223
     ; |num| < |div|
224  
-    (assert-equal (mod 2 5) 2)       ; (2 / 5) * 5 + (2 mod 5)        = 0 * 5 + 2          = 2
225  
-    (assert-equal (mod 2 -5) -3)     ; (2 / -5) * (-5) + (2 mod -5)   = (-1) * (-5) + (-3) = 2
226  
-    (assert-equal (mod -2 5) 3)      ; (-2 / 5) * 5 + (-2 mod 5)      = (-1) * 5 + 3       = -2
227  
-    (assert-equal (mod -2 -5) -2)    ; (-2 / -5) * (-5) + (-2 mod -5) = 0 * (-5) + (-2)    = -2
  224
+    (assertions/assert-equal (mod 2 5) 2)       ; (2 / 5) * 5 + (2 mod 5)        = 0 * 5 + 2          = 2
  225
+    (assertions/assert-equal (mod 2 -5) -3)     ; (2 / -5) * (-5) + (2 mod -5)   = (-1) * (-5) + (-3) = 2
  226
+    (assertions/assert-equal (mod -2 5) 3)      ; (-2 / 5) * 5 + (-2 mod 5)      = (-1) * 5 + 3       = -2
  227
+    (assertions/assert-equal (mod -2 -5) -2)    ; (-2 / -5) * (-5) + (-2 mod -5) = 0 * (-5) + (-2)    = -2
228 228
 
229 229
     ; num = 0, div != 0
230  
-    (assert-equal (mod 0 3) 0)       ; (0 / 3) * 3 + (0 mod 3) = 0 * 3 + 0 = 0
231  
-    (assert-equal (mod 0 -3) 0)
  230
+    (assertions/assert-equal (mod 0 3) 0)       ; (0 / 3) * 3 + (0 mod 3) = 0 * 3 + 0 = 0
  231
+    (assertions/assert-equal (mod 0 -3) 0)
232 232
 
233 233
     ; large args
234  
-    (assert-equal (mod 3216478362187432 432143214) 120355456)
  234
+    (assertions/assert-equal (mod 3216478362187432 432143214) 120355456)
235 235
 )
236 236
 
237 237
 
238 238
 (deftest bit-not-tests
239  
-    (assert-equal (bit-not 5) -6))
  239
+    (assertions/assert-equal (bit-not 5) -6))
240 240
 
241 241
 (deftest bit-and-tests
242  
-    (assert-equal (bit-and 5 4) 4)
243  
-    (assert-equal (bit-and 5 4 1) 0))
  242
+    (assertions/assert-equal (bit-and 5 4) 4)
  243
+    (assertions/assert-equal (bit-and 5 4 1) 0))
244 244
 
245 245
 (deftest bit-or-tests
246  
-    (assert-equal (bit-or 6 5 4 2) 7))
  246
+    (assertions/assert-equal (bit-or 6 5 4 2) 7))
247 247
 
248 248
 (deftest bit-xor-tests
249  
-    (assert-equal (bit-xor 2 3 4) 5))
  249
+    (assertions/assert-equal (bit-xor 2 3 4) 5))
250 250
 
251 251
 (deftest bit-and-not-tests
252  
-    (assert-equal (bit-and-not 3 1 2) 0))
  252
+    (assertions/assert-equal (bit-and-not 3 1 2) 0))
253 253
 
254 254
 (deftest bit-shift-left-tests
255  
-    (assert-equal (bit-shift-left 1 3) 8))
  255
+    (assertions/assert-equal (bit-shift-left 1 3) 8))
256 256
 
257 257
 (deftest bit-shift-right-tests
258  
-    (assert-equal (bit-shift-right 8 3) 1))
  258
+    (assertions/assert-equal (bit-shift-right 8 3) 1))
259 259
 
260 260
 (deftest bit-clear-tests
261  
-    (assert-equal (bit-clear 3 1) 1))
  261
+    (assertions/assert-equal (bit-clear 3 1) 1))
262 262
 
263 263
 (deftest bit-set-tests
264  
-    (assert-equal (bit-set 0 1) 2))
  264
+    (assertions/assert-equal (bit-set 0 1) 2))
265 265
 
266 266
 (deftest bit-flip-tests
267  
-    (assert-equal (bit-flip 0 1) 2)
268  
-    (assert-equal (bit-flip 2 1) 0))
  267
+    (assertions/assert-equal (bit-flip 0 1) 2)
  268
+    (assertions/assert-equal (bit-flip 2 1) 0))
269 269
 
270 270
 (deftest bit-flip-tests
271 271
     (assertions/assert-true (bit-test 3 1))
@@ -290,19 +290,19 @@
290 290
     (assertions/assert-true ((complement (fn [x y z] false)) 1 2 3)))
291 291
 
292 292
 (deftest constantly-tests
293  
-    (assert-equal ((constantly 1) 1 2 3 4 5) 1))
  293
+    (assertions/assert-equal ((constantly 1) 1 2 3 4 5) 1))
294 294
 
295 295
 (deftest identityi-tests
296  
-    (assert-equal (identity 3) 3)
297  
-    (assert-equal (identity 4) 4))
  296
+    (assertions/assert-equal (identity 3) 3)
  297
+    (assertions/assert-equal (identity 4) 4))
298 298
 
299 299
 (deftest peek-tests
300  
-    (assert-equal (peek '(1 2)) 1)
301  
-    (assert-equal (peek nil) nil))
  300
+    (assertions/assert-equal (peek '(1 2)) 1)
  301
+    (assertions/assert-equal (peek nil) nil))
302 302
 
303 303
 (deftest pop-tests
304  
-    (assert-equal (pop '(1 2)) '(2))
305  
-    (assert-equal (pop nil) nil))
  304
+    (assertions/assert-equal (pop '(1 2)) '(2))
  305
+    (assertions/assert-equal (pop nil) nil))
306 306
 
307 307
 ;;map stuff
308 308
 
@@ -313,67 +313,67 @@
313 313
     (assertions/assert-false (contains? {:a 4} :b)))
314 314
 
315 315
 (deftest get-tests
316  
-    (assert-equal (get {:a 1} :a) 1)
317  
-    (assert-equal (get "abc" 1) "b"))
  316
+    (assertions/assert-equal (get {:a 1} :a) 1)
  317
+    (assertions/assert-equal (get "abc" 1) "b"))
318 318
 
319 319
 (deftest dissoc-tests
320  
-    (assert-equal (dissoc {:a 1 :b 2} :b) {:a 1})
321  
-    (assert-equal (dissoc {:a 1 :b 2} :a :b) {}))
  320
+    (assertions/assert-equal (dissoc {:a 1 :b 2} :b) {:a 1})
  321
+    (assertions/assert-equal (dissoc {:a 1 :b 2} :a :b) {}))
322 322
 
323 323
 (deftest disj-tests
324  
-    (assert-equal (disj #{:a :b :c} :a) #{:b :c}))
  324
+    (assertions/assert-equal (disj #{:a :b :c} :a) #{:b :c}))
325 325
 
326 326
 (deftest set-tests
327  
-    (assert-true (= #{} (set [])))
328  
-    (assert-true (= #{"foo"} (set ["foo"])))
329  
-    (assert-true (= #{1 2 3} #{1 3 2}))
330  
-    ; FIXME vector/map find (assert-true (= #{#{1 2 3} [4 5 6] {7 8} 9 10} #{10 9 [4 5 6] {7 8} #{1 2 3}}))
331  
-    (assert-true (= #{#{1 2 3} 9 10} #{10 9 #{1 2 3}}))
332  
-    (assert-true (not (= #{nil [] {} 0 #{}} #{})))
333  
-    (assert-true (= (count #{nil [] {} 0 #{}}) 5))
334  
-    (assert-true (= (conj #{1} 1) #{1}))
335  
-    (assert-true (= (conj #{1} 2) #{2 1}))
336  
-    ;FIXME (assert-true (= #{} (-empty #{1 2 3 4})))
337  
-    (assert-true (= (reduce + #{1 2 3 4 5}) 15))
338  
-    (assert-true (= 4 (get #{1 2 3 4} 4)))
339  
-    (assert-true (contains? #{1 2 3 4} 4))
340  
-    (assert-true (contains? #{[] nil 0 {} #{}} {}))
341  
-    ;FIXME vectorfind (assert-true (contains? #{[1 2 3]} [1 2 3]))
  327
+    (assertions/assert-true (= #{} (set [])))
  328
+    (assertions/assert-true (= #{"foo"} (set ["foo"])))
  329
+    (assertions/assert-true (= #{1 2 3} #{1 3 2}))
  330
+    ; FIXME vector/map find (assertions/assert-true (= #{#{1 2 3} [4 5 6] {7 8} 9 10} #{10 9 [4 5 6] {7 8} #{1 2 3}}))
  331
+    (assertions/assert-true (= #{#{1 2 3} 9 10} #{10 9 #{1 2 3}}))
  332
+    (assertions/assert-true (not (= #{nil [] {} 0 #{}} #{})))
  333
+    (assertions/assert-true (= (count #{nil [] {} 0 #{}}) 5))
  334
+    (assertions/assert-true (= (conj #{1} 1) #{1}))
  335
+    (assertions/assert-true (= (conj #{1} 2) #{2 1}))
  336
+    ;FIXME (assertions/assert-true (= #{} (-empty #{1 2 3 4})))
  337
+    (assertions/assert-true (= (reduce + #{1 2 3 4 5}) 15))
  338
+    (assertions/assert-true (= 4 (get #{1 2 3 4} 4)))
  339
+    (assertions/assert-true (contains? #{1 2 3 4} 4))
  340
+    (assertions/assert-true (contains? #{[] nil 0 {} #{}} {}))
  341
+    ;FIXME vectorfind (assertions/assert-true (contains? #{[1 2 3]} [1 2 3]))
342 342
 )
343 343
 
344 344
 (deftest find-tests
345  
-    (assert-equal (.getKey (find {:a 1} :a)) :a)
346  
-    (assert-equal (.getValue (find {:a 1} :a)) 1))
  345
+    (assertions/assert-equal (.getKey (find {:a 1} :a)) :a)
  346
+    (assertions/assert-equal (.getValue (find {:a 1} :a)) 1))
347 347
 
348 348
 (deftest select-keys-tests
349  
-    (assert-equal (select-keys {:a 1 :b 2 :c 3} [:a]) {:a 1}))
  349
+    (assertions/assert-equal (select-keys {:a 1 :b 2 :c 3} [:a]) {:a 1}))
350 350
 
351 351
 (deftest keys-tests
352  
-    (assert-equal (keys {:a 1}) [:a]))
  352
+    (assertions/assert-equal (keys {:a 1}) [:a]))
353 353
 
354 354
 (deftest vals-tests
355  
-    (assert-equal (vals {:a 1}) [1]))
  355
+    (assertions/assert-equal (vals {:a 1}) [1]))
356 356
 
357 357
 (deftest key-tests
358  
-    (assert-equal (key (find {:a 1 :b 2} :b)) :b))
  358
+    (assertions/assert-equal (key (find {:a 1 :b 2} :b)) :b))
359 359
 
360 360
 (deftest val-tests
361  
-    (assert-equal (val (find {:a 1 :b 2} :b)) 2))
  361
+    (assertions/assert-equal (val (find {:a 1 :b 2} :b)) 2))
362 362
 
363 363
 (deftest name-tests
364  
-    (assert-equal (name 'Foo) "Foo")
365  
-    (assert-equal (name "Foo") "Foo"))
  364
+    (assertions/assert-equal (name 'Foo) "Foo")
  365
+    (assertions/assert-equal (name "Foo") "Foo"))
366 366
 
367 367
 (deftest namespace-tests
368  
-    (assert-equal (namespace 'baz/Foo) "baz")
369  
-    (assert-equal (namespace 'Foo) nil))
  368
+    (assertions/assert-equal (namespace 'baz/Foo) "baz")
  369
+    (assertions/assert-equal (namespace 'Foo) nil))
370 370
 
371 371
 ; broken need to fix
372 372
 ;(deftest dot-dot-tests
373  
-;    (assert-equal (.. :foo (.-sym) (.-name)) ":foo"))
  373
+;    (assertions/assert-equal (.. :foo (.-sym) (.-name)) ":foo"))
374 374
 
375 375
 (deftest ->-tests
376  
-    (assert-equal (-> " baz " (.rstrip) (.lstrip)) "baz"))
  376
+    (assertions/assert-equal (-> " baz " (.rstrip) (.lstrip)) "baz"))
377 377
 
378 378
 ;(deftest ->>-tests ; haven't a clue how to test this
379 379
 ;    )
@@ -386,29 +386,29 @@
386 386
 ;;; http://blog.jayfields.com/2011/03/clojure-if-let-and-when-let.html
387 387
 
388 388
 (deftest if-let-tests
389  
-	(assert-equal (if-let [a 4] (+ a 4) (+ 10 10)) 8)
390  
-	(assert-equal (if-let [a nil] (+ a 4) (+ 10 10)) 20))
  389
+	(assertions/assert-equal (if-let [a 4] (+ a 4) (+ 10 10)) 8)
  390
+	(assertions/assert-equal (if-let [a nil] (+ a 4) (+ 10 10)) 20))
391 391
 
392 392
 
393 393
 (deftest when-let
394  
-    (assert-equal (when-let [a 9] (+ a 4))  13)
395  
-    (assert-equal (when-let [a nil] (+ a 4)) nil))
  394
+    (assertions/assert-equal (when-let [a 9] (+ a 4))  13)
  395
+    (assertions/assert-equal (when-let [a nil] (+ a 4)) nil))
396 396
 
397 397
 ;;; functional stuff
398 398
 
399 399
 (deftest comp-tests
400  
-    (assert-equal ((comp str +) 8 8 8) "24"))
  400
+    (assertions/assert-equal ((comp str +) 8 8 8) "24"))
401 401
 
402 402
 (deftest juxt-tests
403  
-    (assert-equal ((juxt :a :b :c :d) {:a 1 :b 2 :c 3 :d 4}) [1 2 3 4]))
  403
+    (assertions/assert-equal ((juxt :a :b :c :d) {:a 1 :b 2 :c 3 :d 4}) [1 2 3 4]))
404 404
 
405 405
 (deftest partial-tests
406  
-    (assert-equal ((partial + 1) 1) 2))
  406
+    (assertions/assert-equal ((partial + 1) 1) 2))
407 407
 
408 408
 ;;; sequence stuff
409 409
 
410 410
 (deftest sequence-tests
411  
-    (assert-equal (sequence [1 2 3]) '(1 2 3)))
  411
+    (assertions/assert-equal (sequence [1 2 3]) '(1 2 3)))
412 412
 
413 413
 (deftest every?-tests
414 414
     (assertions/assert-true (every? even? '(2 4 6)))
@@ -420,7 +420,7 @@
420 420
 
421 421
 (deftest some-tests
422 422
     (assertions/assert-true (some even? '(1 2 3 4)))
423  
-    (assert-equal (some even? '(1 3 5 7)) nil))
  423
+    (assertions/assert-equal (some even? '(1 3 5 7)) nil))
424 424
 
425 425
 (deftest not-any?-tests
426 426
     (assertions/assert-true (not-any? odd? '(2 4 6)))
@@ -430,74 +430,74 @@
430 430
 ;    (dotimes [n 5] (assertions/assert-true (and (>= n 0) (< n 5)))))
431 431
 
432 432
 (deftest map-tests
433  
-    (assert-equal (map inc [1 2 3 4 5]) (seq [2 3 4 5 6])))
  433
+    (assertions/assert-equal (map inc [1 2 3 4 5]) (seq [2 3 4 5 6])))
434 434
 
435 435
 (deftest mapcat-tests
436  
-    (assert-equal (mapcat reverse [[3 2 1 0] [6 5 4] [9 8 7]]) [0 1 2 3 4 5 6 7 8 9]))
  436
+    (assertions/assert-equal (mapcat reverse [[3 2 1 0] [6 5 4] [9 8 7]]) [0 1 2 3 4 5 6 7 8 9]))
437 437
  
438 438
 (deftest filter-tests
439  
-    (assert-equal (filter even? [1 2 3 4 5]) [2 4]))
  439
+    (assertions/assert-equal (filter even? [1 2 3 4 5]) [2 4]))
440 440
 
441 441
 (deftest remove-tests
442  
-    (assert-equal (remove even? [1 2 3 4 5]) [1 3 5]))
  442
+    (assertions/assert-equal (remove even? [1 2 3 4 5]) [1 3 5]))
443 443
 
444 444
 (deftest take-tests
445  
-    (assert-equal (take 2 [1 2 3 4]) [1 2]))
  445
+    (assertions/assert-equal (take 2 [1 2 3 4]) [1 2]))
446 446
 
447 447
 (deftest take-while-tests
448  
-    (assert-equal (take-while even? [2 2 1 1]) [2 2]))
  448
+    (assertions/assert-equal (take-while even? [2 2 1 1]) [2 2]))
449 449
 
450 450
 (deftest drop-tests
451  
-    (assert-equal (drop 1 [1 2 3]) [2 3]))
  451
+    (assertions/assert-equal (drop 1 [1 2 3]) [2 3]))
452 452
 
453 453
 (deftest drop-last-tests
454  
-    (assert-equal (drop-last 2 [1 2 3 4]) [1 2]))
  454
+    (assertions/assert-equal (drop-last 2 [1 2 3 4]) [1 2]))
455 455
 
456 456
 (deftest take-last-tests
457  
-    (assert-equal (take-last 3 [1 2 3 4]) [2 3 4]))
  457
+    (assertions/assert-equal (take-last 3 [1 2 3 4]) [2 3 4]))
458 458
 
459 459
 (deftest drop-while-tests
460  
-    (assert-equal (drop-while even? [2 4 6 1 2 3]) [1 2 3]))
  460
+    (assertions/assert-equal (drop-while even? [2 4 6 1 2 3]) [1 2 3]))
461 461
 
462 462
 (deftest cycle-tests
463  
-    (assert-equal (take 6 (cycle [1 2 3])) [1 2 3 1 2 3]))
  463
+    (assertions/assert-equal (take 6 (cycle [1 2 3])) [1 2 3 1 2 3]))
464 464
 
465 465
 (deftest split-at-tests
466  
-    (assert-equal (split-at 3 [1 2 3 4 5]) [[1 2 3] [4 5]]))
  466
+    (assertions/assert-equal (split-at 3 [1 2 3 4 5]) [[1 2 3] [4 5]]))
467 467
 
468 468
 (deftest split-with-tests
469  
-    (assert-equal (split-with odd? [1 1 1 1 2 2 2 2]) [[1 1 1 1] [2 2 2 2]]))
  469
+    (assertions/assert-equal (split-with odd? [1 1 1 1 2 2 2 2]) [[1 1 1 1] [2 2 2 2]]))
470 470
 
471 471
 (deftest repeat-tests
472  
-    (assert-equal (repeat 3 1) [1 1 1]))
  472
+    (assertions/assert-equal (repeat 3 1) [1 1 1]))
473 473
 
474 474
 (deftest interate-tests
475  
-    (assert-equal (take 3 (iterate inc 0)) [0 1 2]))
  475
+    (assertions/assert-equal (take 3 (iterate inc 0)) [0 1 2]))
476 476
 
477 477
 (deftest range-tests
478  
-    (assert-equal (range 0 8 2) [0 2 4 6]))
  478
+    (assertions/assert-equal (range 0 8 2) [0 2 4 6]))
479 479
 
480 480
 (deftest merge-tests
481  
-    (assert-equal (merge {:a 1 :b 2} {:a 3 :c 4}) {:a 3 :b 2 :c 4}))
  481
+    (assertions/assert-equal (merge {:a 1 :b 2} {:a 3 :c 4}) {:a 3 :b 2 :c 4}))
482 482
 
483 483
 (deftest merge-with-tests
484  
-    (assert-equal (merge-with + 
  484
+    (assertions/assert-equal (merge-with + 
485 485
                    {:a 1  :b 2}
486 486
                    {:a 9  :b 98 :c 0})
487 487
                   {:c 0, :a 10, :b 100}))
488 488
 
489 489
 
490 490
 (deftest zipmap-tests
491  
-    (assert-equal (zipmap [:a :b :c :d :e] [1 2 3 4 5])
  491
+    (assertions/assert-equal (zipmap [:a :b :c :d :e] [1 2 3 4 5])
492 492
                     {:e 5, :d 4, :c 3, :b 2, :a 1}))
493 493
 
494 494
 
495 495
 (deftest sort-tests
496  
-    (assert-equal (sort [3 1 2 4]) [1 2 3 4])
497  
-    (assert-equal (sort > (vals {:foo 5, :bar 2, :baz 10})) [10 5 2]))
  496
+    (assertions/assert-equal (sort [3 1 2 4]) [1 2 3 4])
  497
+    (assertions/assert-equal (sort > (vals {:foo 5, :bar 2, :baz 10})) [10 5 2]))
498 498
 
499 499
 (deftest sort-by-tests
500  
-    (assert-equal (sort-by first > [[1 2] [2 2] [2 3]]) [[2 2] [2 3] [1 2]]))
  500
+    (assertions/assert-equal (sort-by first > [[1 2] [2 2] [2 3]]) [[2 2] [2 3] [1 2]]))
501 501
 
502 502
 (deftype Accum [i]
503 503
     (inc [self] (py/setattr self "i" (inc i))))
@@ -507,23 +507,23 @@
507 507
     (let [accum (Accum 0)]
508 508
          (dorun (map (fn [x] (.inc accum))
509 509
                      (range 10)))
510  
-         (assert-equal (.-i accum) 10)))
  510
+         (assertions/assert-equal (.-i accum) 10)))
511 511
 
512 512
 (deftest nthnext-tests
513  
-    (assert-equal (nthnext (range 10) 3) '(3 4 5 6 7 8 9)))
  513
+    (assertions/assert-equal (nthnext (range 10) 3) '(3 4 5 6 7 8 9)))
514 514
 
515 515
 (deftest nth-tests
516  
-    (assert-equal (nth (list 1 2 3) 1) 2)
517  
-    (assert-equal (nth [1 2 3] 1) 2))
  516
+    (assertions/assert-equal (nth (list 1 2 3) 1) 2)
  517
+    (assertions/assert-equal (nth [1 2 3] 1) 2))
518 518
 
519 519
 (deftest partition-tests
520  
-    (assert-equal (partition 4 (range 20)) 
  520
+    (assertions/assert-equal (partition 4 (range 20)) 
521 521
                   '((0 1 2 3) (4 5 6 7) (8 9 10 11) (12 13 14 15) (16 17 18 19)))
522  
-    (assert-equal (partition 4 6 ["a" "b" "c" "d"] (range 20))
  522
+    (assertions/assert-equal (partition 4 6 ["a" "b" "c" "d"] (range 20))
523 523
                   '((0 1 2 3) (6 7 8 9) (12 13 14 15) (18 19 "a" "b"))))
524 524
 
525 525
 (deftest eval-tests
526  
-    (assert-equal (eval '(+ 1 2)) 3))
  526
+    (assertions/assert-equal (eval '(+ 1 2)) 3))
527 527
 
528 528
 (deftest doseq-tests
529 529
     (doseq [x [1 2 3]
@@ -535,14 +535,14 @@
535 535
 (deftest do-times
536 536
     (let [accum (Accum 0)]
537 537
          (dotimes [i 5]
538  
-             (assert-equal (.-i accum) i)
  538
+             (assertions/assert-equal (.-i accum) i)
539 539
              (.inc accum))))
540 540
 
541 541
 (deftest class-tests
542  
-    (assert-equal (class "f") py/str))
  542
+    (assertions/assert-equal (class "f") py/str))
543 543
 
544 544
 (deftest num-tests
545  
-    (assert-equal (num "1") 1))
  545
+    (assertions/assert-equal (num "1") 1))
546 546
 
547 547
 (deftest num-tests
548 548
     (assertions/assert-true (float? (num "inf"))))
@@ -551,16 +551,16 @@
551 551
     (assertions/assert-true (number? 1)))
552 552
 
553 553
 (deftest read-string-tests
554  
-    (assert-equal (read-string "12") 12))
  554
+    (assertions/assert-equal (read-string "12") 12))
555 555
 
556 556
 (deftest subvec-tests
557  
-    (assert-equal (subvec [1 2 3 4] 1 3) [2 3]))
  557
+    (assertions/assert-equal (subvec [1 2 3 4] 1 3) [2 3]))
558 558
 
559 559
 (deftest doto-tests
560  
-    (assert-equal (doto (py/list) (.append "foo") (.append "bar")) ["foo" "bar"]))
  560
+    (assertions/assert-equal (doto (py/list) (.append "foo") (.append "bar")) ["foo" "bar"]))
561 561
 
562 562
 (deftest memfn-tests
563  
-    (assert-equal (let [f (memfn join ch)]
  563
+    (assertions/assert-equal (let [f (memfn join ch)]
564 564
                        (f "," ["1" "2"])) 
565 565
                   "1,2"))
566 566
 (deftest set-tests
@@ -574,46 +574,46 @@
574 574
     (assertions/assert-true (not (nil? (create-ns 'foo.bar)))))
575 575
 
576 576
 (deftest ns-name-tests
577  
-    (assert-equal (ns-name 'clojure.core) 'clojure.core))
  577
+    (assertions/assert-equal (ns-name 'clojure.core) 'clojure.core))
578 578
 
579 579
 (deftest let-tests
580 580
     (let [[x & y] [1 2 3]]
581  
-         (assert-equal x 1)
582  
-         (assert-equal y [2 3])))
  581
+         (assertions/assert-equal x 1)
  582
+         (assertions/assert-equal y [2 3])))
583 583
 
584 584
 (deftest let-tests
585 585
     ((fn td [[x & y]]
586  
-         (assert-equal x 1)
587  
-         (assert-equal y [2 3])) [ 1 2 3]))
  586
+         (assertions/assert-equal x 1)
  587
+         (assertions/assert-equal y [2 3])) [ 1 2 3]))
588 588
 
589 589
 (deftest loop-tests
590 590
     (loop [[x & y] [1 2 3]]
591  
-         (assert-equal x 1)
592  
-         (assert-equal y [2 3])))
  591
+         (assertions/assert-equal x 1)
  592
+         (assertions/assert-equal y [2 3])))
593 593
 
594 594
 (deftest when-first-tests
595  
-    (assert-equal (when-first [a [1 2 3]] a) 1)
596  
-    (assert-equal (when-first [a []] a) nil)
597  
-    (assert-equal (when-first [a nil] a) nil))
  595
+    (assertions/assert-equal (when-first [a [1 2 3]] a) 1)
  596
+    (assertions/assert-equal (when-first [a []] a) nil)
  597
+    (assertions/assert-equal (when-first [a nil] a) nil))
598 598
 
599 599
 (deftest lazy-cat-tests
600  
-    (assert-equal (lazy-cat [1 2 3] [4 5 6]) [1 2 3 4 5 6]))
  600
+    (assertions/assert-equal (lazy-cat [1 2 3] [4 5 6]) [1 2 3 4 5 6]))
601 601
 
602 602
 (deftest for-tests
603  
-    (assert-equal (for [x [1 2 3]] x) [1 2 3]))
  603
+    (assertions/assert-equal (for [x [1 2 3]] x) [1 2 3]))
604 604
 
605 605
 (deftest destructure-tests
606  
-    (assert-equal (map (fn [[k v]] k) {:1 1 :2 2}) [:1 :2])
607  
-    (assert-equal (map (fn [[k v]] v) {:1 1 :2 2}) [1 2]))
  606
+    (assertions/assert-equal (map (fn [[k v]] k) {:1 1 :2 2}) [:1 :2])
  607
+    (assertions/assert-equal (map (fn [[k v]] v) {:1 1 :2 2}) [1 2]))
608 608
 
609 609
 (deftest map-entry-tests
610  
-    (assert-equal (-> {:1 :2} first first) :1)
611  
-    (assert-equal (-> {:1 :2} first second) :2))
  610
+    (assertions/assert-equal (-> {:1 :2} first first) :1)
  611
+    (assertions/assert-equal (-> {:1 :2} first second) :2))
612 612
     
613 613
 
614 614
 (deftest reduce-tests
615  
-    (assert-equal (reduce + '(1 2 3 4)) 10)
616  
-    (assert-equal (reduce + 5 '(1 2 3 4)) 15))
  615
+    (assertions/assert-equal (reduce + '(1 2 3 4)) 10)
  616
+    (assertions/assert-equal (reduce + 5 '(1 2 3 4)) 15))
617 617
 
618 618
 (deftest empty?-tests
619 619
     (assertions/assert-true (empty? []))
@@ -622,14 +622,14 @@
622 622
 
623 623
 
624 624
 (deftest do-tests
625  
-    (assert-equal (do) nil)
626  
-    (assert-equal (do 1) 1)
627  
-    (assert-equal (do 1 2) 2))
  625
+    (assertions/assert-equal (do) nil)
  626
+    (assertions/assert-equal (do 1) 1)
  627
+    (assertions/assert-equal (do 1 2) 2))
628 628
 
629 629
 (deftest lazy-seq-tests
630 630
     (.more (range 1))) ; would throw an error before fix to Issue #45
631 631
 
632 632
 (deftest comment-tests
633  
-    (comment (assert-true false)))
  633
+    (comment (assertions/assert-true false)))
634 634
 
635 635
 (py/print "all tests passed")

0 notes on commit 7fa31fc

Please sign in to comment.
Something went wrong with that request. Please try again.