aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorGravatar Peter McGoron 2025-06-19 22:02:30 -0400
committerGravatar Peter McGoron 2025-06-19 22:02:30 -0400
commit311debc76d7655fb560d4aa261d70535cc32c0c4 (patch)
tree02233226878f9c07c74867b7c54fff73b8277d09 /test
parentRework PNL calculations in pattern producer, fix producer test (diff)
add support for multiple ellipses in a sequence in producers
Adopts behavior such that x ... ... => {append ((x ...) ...} x ... ... ... => {append {append (((x ...) ...) ...)}} where `{append ...}` occurs at the meta-level after expanding the patterns. (In the code this is done with an accumulator.)
Diffstat (limited to 'test')
-rw-r--r--test/pattern/producer.scm25
1 files changed, 18 insertions, 7 deletions
diff --git a/test/pattern/producer.scm b/test/pattern/producer.scm
index 86de709..14c130d 100644
--- a/test/pattern/producer.scm
+++ b/test/pattern/producer.scm
@@ -14,7 +14,7 @@
|#
(define (test-producers)
- #;(let ((producer
+ (let ((producer
(compile-producer '()
(list (empty-wrap 'x) (empty-wrap '...))
(hashmap bound-identifier-comparator
@@ -23,17 +23,28 @@
(test-equal "produces x = '(5 4 3 2 1)"
'(1 2 3 4 5)
(producer (hashmap bound-identifier-comparator
- (empty-wrap 'x)
- '(5 4 3 2 1)))))
+ (empty-wrap 'x)
+ '(5 4 3 2 1)))))
+ (let ((producer
+ (compile-producer '()
+ (list (list (empty-wrap 'x) (empty-wrap '...))
+ (empty-wrap '...))
+ (hashmap bound-identifier-comparator
+ (empty-wrap 'x)
+ 2))))
+ (test-equal "double ellipsis"
+ '((1 2) (3 4) (5 6) (7 8))
+ (producer (hashmap bound-identifier-comparator
+ (empty-wrap 'x)
+ '((8 7) (6 5) (4 3) (2 1))))))
(let ((producer
(compile-producer '()
- (list (list (empty-wrap 'x) (empty-wrap '...))
- (empty-wrap '...))
+ (list (empty-wrap 'x) (empty-wrap '...) (empty-wrap '...))
(hashmap bound-identifier-comparator
(empty-wrap 'x)
2))))
- (test-equal "double ellipsis"
- '((1 2) (3 4) (5 6) (7 8))
+ (test-equal "appended double ellipsis"
+ '(1 2 3 4 5 6 7 8)
(producer (hashmap bound-identifier-comparator
(empty-wrap 'x)
'((8 7) (6 5) (4 3) (2 1)))))))