aboutsummaryrefslogtreecommitdiffstats
path: root/test/pattern/producer.scm
diff options
context:
space:
mode:
authorGravatar Peter McGoron 2025-06-19 21:44:58 -0400
committerGravatar Peter McGoron 2025-06-19 21:44:58 -0400
commit80abc5a0c8550fc38d3df626d58d81f4da1eab1a (patch)
treec253642fda9193da2c7e127f3aae9c752abcf678 /test/pattern/producer.scm
parentpattern testing (diff)
Rework PNL calculations in pattern producer, fix producer test
Previous PNL calculations calculated the PNL against the entire pattern. This is not useful, because the PNL at each ellipsis pattern is what is useful. This is also nice because it does not require a parameter: the PNL can always be calculated locally.
Diffstat (limited to '')
-rw-r--r--test/pattern/producer.scm22
1 files changed, 17 insertions, 5 deletions
diff --git a/test/pattern/producer.scm b/test/pattern/producer.scm
index eb1744e..86de709 100644
--- a/test/pattern/producer.scm
+++ b/test/pattern/producer.scm
@@ -14,14 +14,26 @@
|#
(define (test-producers)
+ #;(let ((producer
+ (compile-producer '()
+ (list (empty-wrap 'x) (empty-wrap '...))
+ (hashmap bound-identifier-comparator
+ (empty-wrap 'x)
+ 1))))
+ (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)))))
(let ((producer
(compile-producer '()
- (list (empty-wrap 'x) (empty-wrap '...))
+ (list (list (empty-wrap 'x) (empty-wrap '...))
+ (empty-wrap '...))
(hashmap bound-identifier-comparator
(empty-wrap 'x)
- 1))))
- (test-equal "produces x = '(5 4 3 2 1)"
- '(1 2 3 4 5)
+ 2))))
+ (test-equal "double ellipsis"
+ '((1 2) (3 4) (5 6) (7 8))
(producer (hashmap bound-identifier-comparator
(empty-wrap 'x)
- '(5 4 3 2 1))))))
+ '((8 7) (6 5) (4 3) (2 1)))))))