| 1 |
;; |
| 2 |
;; Testing data.random here, for it depends on math.mt-random. |
| 3 |
;; |
| 4 |
|
| 5 |
(use gauche.test) |
| 6 |
(test-start "data.random") |
| 7 |
(test-section "data.random") |
| 8 |
(use data.random) |
| 9 |
(test-module 'data.random) |
| 10 |
|
| 11 |
(use gauche.generator) |
| 12 |
|
| 13 |
(define (test-regular-strings regexp) |
| 14 |
(let1 g (regular-strings$ regexp) |
| 15 |
(test* #"regular-string$ ~regexp" |
| 16 |
regexp |
| 17 |
(generator->list g 10) |
| 18 |
(^[rx ss] (every (^s (equal? (rxmatch->string rx s) s)) ss))))) |
| 19 |
|
| 20 |
(test-regular-strings #/a/) |
| 21 |
(test-regular-strings #/[a-z]/) |
| 22 |
(test-regular-strings #/[^a-z]/) |
| 23 |
(test-regular-strings #/abc|def/) |
| 24 |
(test-regular-strings #/ab*/) |
| 25 |
(test-regular-strings #/(ab|cd)+/) |
| 26 |
(test-regular-strings #/(abc){3}/) |
| 27 |
(test-regular-strings #/(abc){3,5}/) |
| 28 |
(test-regular-strings #/(abc){,3}/) |
| 29 |
(test-regular-strings #/(?i:abc)/) |
| 30 |
(test-regular-strings #/abc/i) |
| 31 |
|
| 32 |
(test-end) |