blob: 91df5ffec30685f2a41401c667db4ea720370036 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
(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
;; Default test procedures
setup-name! display-report
default-skip-test? default-when-test-skipped
default-before-test! default-setup-test! default-cleanup-test!
default-after-test default-report-test
default-on-exception-in-test
default-skip-group? default-when-group-skipped
default-before-group! default-setup-group! default-cleanup-group!
default-after-group default-report-group
default-on-exception-in-group
;; SRFI-64 style assertions
call-as-test call-as-group
define-test-application test-predicate test-binary
test-named-application test-application test-body
define-test-application
test-equal test-eqv test-eq test-approximate
test-error expect-to-fail
test-skip-all
test-group
with-test-group-cleanup
test-exit
pretty-print)
(begin
(define-record-type <test-info>
(wrap-test-info dict)
test-info?
(dict unwrap-test-info set-test-info!))
(define assertion-violation error))
(cond-expand
((or foment chicken-5) (include "cuprate.simple-define-test-application.scm"))
(else (include "cuprate.define-test-application.scm")))
;; Pretty printing
(cond-expand
(chicken (import (only (chicken pretty-print) pretty-print)))
((or foment chibi) (import (srfi 166))
(begin (define (pretty-print obj)
(show #t (pretty obj))
(newline))))
(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
((or chicken skint) (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-dto eqv-alist-dto)
(define (alist->default-dictionary x) x))))
(include "cuprate-impl.scm"))
|