From acc561366f3fe6ec0377103f52ef0f7e923711c9 Mon Sep 17 00:00:00 2001 From: Rose Hogenson Date: Mon, 1 Aug 2022 19:35:19 -0700 Subject: 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. --- lib/csc/compare-test.csc | 98 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 lib/csc/compare-test.csc (limited to 'lib/csc/compare-test.csc') 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 + (make-test-type a b) + test-type? + %test-type + (a test-type-a) + (b test-type-b)) + + + (test diff-record + (assert + (string=? + " ( + (!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 '())))))) -- cgit v1.3.1