diff options
| author | Rose Hogenson <rhogenson@posteo.net> | 2022-07-03 14:37:10 -0700 |
|---|---|---|
| committer | Rose Hogenson <rhogenson@posteo.net> | 2022-07-03 14:37:10 -0700 |
| commit | bcb098e8eb18637b6999789585a38ff9168de9d5 (patch) | |
| tree | fe2bee9fcc5cac8c2f8362c836901f7a3643cb03 /csc/testing.csc | |
| parent | 37e086d27d478246e72b8f5c1b75ed5d092495fa (diff) | |
| download | chromatopelma-bcb098e8eb18637b6999789585a38ff9168de9d5.tar.zst | |
Add a diff library.
I was hesitant to add a diff library, but it was surprisingly easy. A
straightforward application of dynamic programming.
Diffstat (limited to 'csc/testing.csc')
| -rw-r--r-- | csc/testing.csc | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/csc/testing.csc b/csc/testing.csc index ecf5547..e46d300 100644 --- a/csc/testing.csc +++ b/csc/testing.csc @@ -6,6 +6,7 @@ test test-main) (import (scheme base) + (only (csc compare) diff) (only (csc format) printf sprintf)) @@ -59,11 +60,12 @@ (define-syntax assert-equal (syntax-rules () - ((assert-equal cmp left right) - (let ((x left) - (y right)) - (unless (cmp x y) - (fatalf "Fatal:\n {}\nis not equal to\n {}.\nleft is\n {}\nright is\n {}" 'left 'right x y)))) + ((assert-equal left right transformers ...) + (let* ((x left) + (y right) + (d (diff x y transformers ...))) + (unless (string=? "" d) + (fatalf "Fatal:\n {}\nis not equal to\n {}.\nleft is\n {}\nright is\n {}\ndiff (-left +right):\n{}" 'left 'right x y d)))) ((assert-equal left right) (assert-equal equal? left right)))) |
