diff options
| author | Rose Hogenson <rhogenson@posteo.net> | 2022-08-01 19:35:19 -0700 |
|---|---|---|
| committer | Rose Hogenson <rhogenson@posteo.net> | 2022-08-01 19:35:19 -0700 |
| commit | acc561366f3fe6ec0377103f52ef0f7e923711c9 (patch) | |
| tree | d7a19cfbad78a69ebea71b27302e708c0655863d /lib/csc/compare-test.csc | |
| parent | Rename the compiler in bytecode.rs. (diff) | |
| download | chromatopelma-acc561366f3fe6ec0377103f52ef0f7e923711c9.tar.zst | |
Modify the project structure.
Now the lib directory contains what will eventually end up on the
user's /usr/lib/csc. When I write make install, it will copy all of
the .csc files from lib into the destination lib directory. This means I
can start working on the standard library in lib/scheme.
Diffstat (limited to 'lib/csc/compare-test.csc')
| -rw-r--r-- | lib/csc/compare-test.csc | 98 |
1 files changed, 98 insertions, 0 deletions
diff --git a/lib/csc/compare-test.csc b/lib/csc/compare-test.csc new file mode 100644 index 0000000..b710115 --- /dev/null +++ b/lib/csc/compare-test.csc @@ -0,0 +1,98 @@ +(define-library (csc compare-test) + (import (scheme base) + (only (csc match) + define-match-record-type) + (only (csc testing) + assert + test) + (csc compare)) + (begin + + + (test diff-list + (assert + (string=? + " ( + 1 + - 2 + 3 + + 3.5 + 4 + ) +" + (diff '(1 2 3 4) '(1 3 3.5 4))))) + + + (define-match-record-type <test-type> + (make-test-type a b) + test-type? + %test-type + (a test-type-a) + (b test-type-b)) + + + (test diff-record + (assert + (string=? + " ( + (!type . + <test-type> + ) + (a . + 5 + ) + (b . + - 5 + + 6 + ) + ) +" + (diff (make-test-type 5 5) (make-test-type 5 6) (cons test-type? %test-type))))) + + + (test diff-multiline-string + (assert + (string=? + " ( + (!type . + string + ) + (value . + ( + line-one + - line-two + line-three + ) + ) + ) +" + (diff "line-one\nline-two\nline-three" "line-one\nline-three")))) + + + (test diff-vector + (assert + (string=? + " ( + (!type . + vector + ) + (value . + ( + 1 + - 2 + 3 + ) + ) + ) +" + (diff #(1 2 3) #(1 3))))) + + + (test diff-symbol-list + (assert + (string=? + "- symbol ++ ( ++ ) +" + (diff 'symbol '())))))) |
