aboutsummaryrefslogtreecommitdiffstats
path: root/lib/cuprate.sld
diff options
context:
space:
mode:
authorGravatar Peter McGoron 2025-11-01 22:29:42 -0400
committerGravatar Peter McGoron 2025-11-01 22:29:42 -0400
commit44e4fd1e1f914e5b307435769c8909da8a72aafb (patch)
tree0c5e707c836f646229462adb08314ac8988e2d14 /lib/cuprate.sld
parentadd expect-to-fail (diff)
Big rewrite:
1. Rename to "cuprate". 2. Remove mutexes. 3. Move rewriters to other library. 4. Move the DTO out of the `test-info` parameter. They are now separate parameters, with the expectation that the DTO will not change over time. This significantly reduces the complexity of the code. 5. Use SRFI-146 for Chicken.
Diffstat (limited to '')
-rw-r--r--lib/cuprate.sld59
1 files changed, 59 insertions, 0 deletions
diff --git a/lib/cuprate.sld b/lib/cuprate.sld
new file mode 100644
index 0000000..a032db5
--- /dev/null
+++ b/lib/cuprate.sld
@@ -0,0 +1,59 @@
+(define-library (cuprate)
+ (import (scheme base) (scheme write) (scheme process-context) (srfi 225)
+ (cuprate rewriters))
+ (export ;; test info
+ test-info test-info? modify-test-info! inspect-test-info
+ test-info-dict test-dto default-test-info-dict default-test-dto
+ ;; test accessors and setters
+ test-set! test-update! test-update/default! test-delete!
+ test-contains? test-ref test-ref/default test-set
+ test-update/default
+ call-as-test call-as-group
+ ;; Default test procedures
+ setup-name! display-report
+ default-skip-test? default-before-test! default-setup-test!
+ default-when-test-skipped default-after-test default-report-test
+ default-on-exception
+ default-setup-group! default-before-group!
+ default-after-group default-report-group
+ ;; SRFI-64 style assertions
+ test-application test-body
+ test-equal test-eqv test-eq test-approximate
+ call-as-test-error test-error expect-to-fail
+ test-skip-all
+ test-group
+ with-test-group-cleanup
+ test-exit)
+ (begin
+ (define-record-type <test-info>
+ (wrap-test-info dict)
+ test-info?
+ (dict unwrap-test-info set-test-info!))
+ (define assertion-violation error))
+ ;; Pretty printing
+ (cond-expand
+ (chicken (import (only (chicken pretty-print) pretty-print)))
+ (foment (import (srfi 166))
+ (begin (define (pretty-print obj)
+ (show #t (pretty obj))
+ (newline))))
+ (chibi (import (srfi 166))
+ (begin (define (pretty-print obj)
+ (show #t (pretty obj)))))
+ (gauche (import (scheme show))
+ (begin (define (pretty-print obj)
+ (show #t (pretty obj)))))
+ (else (begin (define (pretty-print x)
+ (write x)
+ (newline)))))
+ ;; Better containers for the test info than alists, if available.
+ (cond-expand
+ (chicken (import (srfi 128) (srfi 146 hash))
+ (begin
+ (define default-test-dto hash-mapping-dto)
+ (define (alist->default-dictionary x)
+ (alist->hashmap (make-default-comparator) x))))
+ (else (begin
+ (define default-test-info-dto eqv-alist-dto)
+ (define (alist->default-dictionary x) x))))
+ (include "cuprate.scm")) \ No newline at end of file