| @@ -1305,6 +1305,14 @@ · 1304 unmodified lines |
| 1305 | 1305 | (assert (equal? (map 'list identity "hello йцукен") (foldr cons NIL "hello йцукен"))) |
| 1306 | 1306 | |
| 1307 | 1307 | ;; random |
| 1308 | +(assert-fail (random-state?) arity-error) |
| 1309 | +(assert-fail (random-state? NIL NIL) arity-error) |
| 1310 | +(assert (not (random-state? (list 'pcg32x2 0 1 2 3)))) |
| 1311 | +(assert (not (random-state? (cons 'pcg32x2 #arr(u64 0 1 2))))) |
| 1312 | +(assert (not (random-state? (cons 'pcg32x2 #arr(u32 0 1 2 3))))) |
| 1313 | +(assert (not (random-state? (cons 'blah #arr(u64 0 1 2 3))))) |
| 1314 | +(assert-fail (make-random-state 0) type-error) |
| 1315 | +(assert-fail (make-random-state T 1) arity-error) |
| 1308 | 1316 | (assert (not *random-state*)) |
| 1309 | 1317 | (assert (not (random-state? *random-state*))) |
| 1310 | 1318 | (def x (make-random-state T)) |
| @@ -1353,28 +1361,41 @@ · 42 unmodified lines |
| 1353 | 1361 | (f (random 10.0)) |
| 1354 | 1362 | (f2 (random 10.0f)) |
| 1355 | 1363 | (b (random 10000000000000000000000000000)) |
| 1364 | + (fix (random +most-positive-fixnum+)) |
| 1356 | 1365 | (s8 (random (s8 5))) |
| 1357 | 1366 | (f32 (random 1.0f)) |
| 1367 | + (s64 (random (s64 9223372036854775807))) |
| 1368 | + (sfix (random (s64 +most-positive-fixnum+))) |
| 1358 | 1369 | (z (+ (random (bignum 1)) (random (u64 1)) (random (f32 1)) (random (s32 1)))) |
| 1359 | 1370 | (f64 (random 1.0))) |
| 1360 | 1371 | (assert (and (not (int? f32)) (>= f32 0.0) (<= f32 1.0))) |
| 1361 | 1372 | (assert (and (not (int? f64)) (>= f64 0.0) (<= f64 1.0))) |
| 1362 | 1373 | (assert (and (>= b 0) (or (fixnum? b) (and (bignum? b) (> b +most-positive-fixnum+) (<= b 10000000000000000000000000000))))) |
| 1374 | + (assert (and (>= fix 0) (<= fix +most-positive-fixnum+))) |
| 1363 | 1375 | (assert (and (int? s8) (>= s8 0) (<= s8 5))) |
| 1364 | 1376 | (assert (and (int? i) (>= i 0) (<= i 10))) |
| 1365 | 1377 | (assert (and (not (int? f)) (>= f 0.0) (<= f 10.0))) |
| 1366 | | − (assert (<= z 4)) |
| 1378 | + (assert (and (>= s64 0) (or (fixnum? s64) (and (bignum? s64) (> s64 +most-positive-fixnum+))) (<= s64 9223372036854775807))) |
| 1379 | + (assert (and (>= sfix 0) (or (fixnum? sfix) (and (bignum? sfix) (> sfix +most-positive-fixnum+))) (<= sfix +most-positive-fixnum+))) |
| 1380 | + (assert (and (>= z 0) (<= z 4))) |
| 1367 | 1381 | (assert (and (not (int? f2)) (>= f2 0.0) (<= f2 10.0)))))) |
| 1368 | 1382 | (assert-fail (random) arity-error) |
| 1383 | +(assert-fail (random 1 *random-state* 2) arity-error) |
| 1384 | +(assert-fail (random NIL) type-error) |
| 1385 | +(assert-fail (random 'a) type-error) |
| 1386 | +(assert-fail (random "blah") type-error) |
| 1369 | 1387 | (assert-fail (random 1 2) type-error) |
| 1370 | 1388 | (assert-fail (random 1 NIL) type-error) |
| 1371 | 1389 | (assert-fail (random 1 T) type-error) |
| 1372 | 1390 | (assert-fail (random 0) arg-error) |
| 1373 | 1391 | (assert-fail (random 0.0) arg-error) |
| 1392 | +(assert-fail (random 0.0f) arg-error) |
| 1374 | 1393 | (assert-fail (random -0.1) arg-error) |
| 1394 | +(assert-fail (random -0.1f) arg-error) |
| 1375 | 1395 | (assert-fail (random -1) arg-error) |
| 1376 | 1396 | (assert-fail (random (bignum -1)) arg-error) |
| 1377 | 1397 | (assert-fail (random (s8 -1)) arg-error) |
| 1398 | +(assert-fail (random (s64 -9223372036854775808)) arg-error) |
| 1378 | 1399 | |
| 1379 | 1400 | (assert (and (bound? T) (bound? NIL))) |
| 1380 | 1401 | |