clucumber 0.1.1 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/LICENSE +1 -1
- data/README.md +4 -9
- data/lib/clucumber/clucumber-bootstrap.lisp +32 -0
- data/lib/clucumber/vendor/cl-interpol/alias.lisp +55 -0
- data/lib/clucumber/vendor/cl-interpol/cl-interpol.asd +56 -0
- data/lib/clucumber/vendor/cl-interpol/load.lisp +53 -0
- data/lib/clucumber/vendor/cl-interpol/packages.lisp +40 -0
- data/lib/clucumber/vendor/cl-interpol/read.lisp +716 -0
- data/lib/clucumber/vendor/cl-interpol/specials.lisp +113 -0
- data/lib/clucumber/vendor/cl-interpol/test/packages.lisp +34 -0
- data/lib/clucumber/vendor/cl-interpol/test/tests.lisp +128 -0
- data/lib/clucumber/vendor/cl-interpol/test.lisp +177 -0
- data/lib/clucumber/vendor/cl-interpol/test2.lisp +6254 -0
- data/lib/clucumber/vendor/cl-interpol/unicode.lisp +13912 -0
- data/lib/clucumber/vendor/cl-interpol/util.lisp +122 -0
- data/lib/clucumber/vendor/cl-ppcre/api.lisp +1262 -0
- data/lib/clucumber/vendor/cl-ppcre/charmap.lisp +152 -0
- data/lib/clucumber/vendor/cl-ppcre/charset.lisp +242 -0
- data/lib/clucumber/vendor/cl-ppcre/chartest.lisp +98 -0
- data/lib/clucumber/vendor/cl-ppcre/cl-ppcre-test.asd +34 -0
- data/lib/clucumber/vendor/cl-ppcre/cl-ppcre-unicode/packages.lisp +38 -0
- data/lib/clucumber/vendor/cl-ppcre/cl-ppcre-unicode/resolver.lisp +61 -0
- data/lib/clucumber/vendor/cl-ppcre/cl-ppcre-unicode.asd +58 -0
- data/lib/clucumber/vendor/cl-ppcre/cl-ppcre.asd +79 -0
- data/lib/clucumber/vendor/cl-ppcre/closures.lisp +471 -0
- data/lib/clucumber/vendor/cl-ppcre/convert.lisp +875 -0
- data/lib/clucumber/vendor/cl-ppcre/errors.lisp +84 -0
- data/lib/clucumber/vendor/cl-ppcre/lexer.lisp +737 -0
- data/lib/clucumber/vendor/cl-ppcre/lispworks-defsystem.lisp +57 -0
- data/lib/clucumber/vendor/cl-ppcre/load.lisp +67 -0
- data/lib/clucumber/vendor/cl-ppcre/optimize.lisp +578 -0
- data/lib/clucumber/vendor/cl-ppcre/packages.lisp +68 -0
- data/lib/clucumber/vendor/cl-ppcre/parser.lisp +319 -0
- data/lib/clucumber/vendor/cl-ppcre/ppcre-tests.lisp +269 -0
- data/lib/clucumber/vendor/cl-ppcre/regex-class-util.lisp +555 -0
- data/lib/clucumber/vendor/cl-ppcre/regex-class.lisp +259 -0
- data/lib/clucumber/vendor/cl-ppcre/repetition-closures.lisp +833 -0
- data/lib/clucumber/vendor/cl-ppcre/scanner.lisp +506 -0
- data/lib/clucumber/vendor/cl-ppcre/specials.lisp +172 -0
- data/lib/clucumber/vendor/cl-ppcre/test/packages.lisp +37 -0
- data/lib/clucumber/vendor/cl-ppcre/test/perl-tests.lisp +150 -0
- data/lib/clucumber/vendor/cl-ppcre/test/tests.lisp +159 -0
- data/lib/clucumber/vendor/cl-ppcre/test/unicode-tests.lisp +80 -0
- data/lib/clucumber/vendor/cl-ppcre/util.lisp +201 -0
- data/lib/clucumber/vendor/cl-unicode/alias.lisp +135 -0
- data/lib/clucumber/vendor/cl-unicode/api.lisp +412 -0
- data/lib/clucumber/vendor/cl-unicode/build/char-info.lisp +133 -0
- data/lib/clucumber/vendor/cl-unicode/build/dump.lisp +239 -0
- data/lib/clucumber/vendor/cl-unicode/build/read.lisp +280 -0
- data/lib/clucumber/vendor/cl-unicode/build/util.lisp +182 -0
- data/lib/clucumber/vendor/cl-unicode/cl-unicode.asd +90 -0
- data/lib/clucumber/vendor/cl-unicode/conditions.lisp +54 -0
- data/lib/clucumber/vendor/cl-unicode/derived.lisp +120 -0
- data/lib/clucumber/vendor/cl-unicode/hash-tables.lisp +20 -0
- data/lib/clucumber/vendor/cl-unicode/lists.lisp +10 -0
- data/lib/clucumber/vendor/cl-unicode/methods.lisp +15 -0
- data/lib/clucumber/vendor/cl-unicode/packages.lisp +76 -0
- data/lib/clucumber/vendor/cl-unicode/specials.lisp +135 -0
- data/lib/clucumber/vendor/cl-unicode/test/packages.lisp +34 -0
- data/lib/clucumber/vendor/cl-unicode/test/tests.lisp +150 -0
- data/lib/clucumber/vendor/cl-unicode/test-functions.lisp +94 -0
- data/lib/clucumber/vendor/cl-unicode/util.lisp +274 -0
- data/lib/clucumber/vendor/lift/compare/fiveam-tests.lisp +14 -0
- data/lib/clucumber/vendor/lift/compare/lift-tests.lisp +13 -0
- data/lib/clucumber/vendor/lift/compare/rt-tests.lisp +16 -0
- data/lib/clucumber/vendor/lift/compare/xlunit-tests.lisp +15 -0
- data/lib/clucumber/vendor/lift/dev/changes.lisp +61 -0
- data/lib/clucumber/vendor/lift/dev/config.lisp +354 -0
- data/lib/clucumber/vendor/lift/dev/copy-file.lisp +117 -0
- data/lib/clucumber/vendor/lift/dev/introspection.lisp +232 -0
- data/lib/clucumber/vendor/lift/dev/lift-interface.lisp +56 -0
- data/lib/clucumber/vendor/lift/dev/lift-notes.lisp +202 -0
- data/lib/clucumber/vendor/lift/dev/lift-randomized.lisp +45 -0
- data/lib/clucumber/vendor/lift/dev/lift.lisp +2383 -0
- data/lib/clucumber/vendor/lift/dev/macros.lisp +229 -0
- data/lib/clucumber/vendor/lift/dev/measuring.lisp +156 -0
- data/lib/clucumber/vendor/lift/dev/packages.lisp +161 -0
- data/lib/clucumber/vendor/lift/dev/port.lisp +151 -0
- data/lib/clucumber/vendor/lift/dev/prototypes.lisp +282 -0
- data/lib/clucumber/vendor/lift/dev/random-testing.lisp +124 -0
- data/lib/clucumber/vendor/lift/dev/report-locations.lisp +13 -0
- data/lib/clucumber/vendor/lift/dev/reports.lisp +916 -0
- data/lib/clucumber/vendor/lift/dev/utilities.lisp +242 -0
- data/lib/clucumber/vendor/lift/docs/package.lisp +6 -0
- data/lib/clucumber/vendor/lift/docs/setup.lisp +17 -0
- data/lib/clucumber/vendor/lift/examples/basic-examples.lisp +289 -0
- data/lib/clucumber/vendor/lift/examples/random-testing.lisp +32 -0
- data/lib/clucumber/vendor/lift/lift-documentation.asd +28 -0
- data/lib/clucumber/vendor/lift/lift-test.asd +35 -0
- data/lib/clucumber/vendor/lift/lift.asd +77 -0
- data/lib/clucumber/vendor/lift/test/equality-tests.lisp +40 -0
- data/lib/clucumber/vendor/lift/test/finding-tests.lisp +32 -0
- data/lib/clucumber/vendor/lift/test/lift-test.lisp +783 -0
- data/lib/clucumber/vendor/lift/test/order-of-operations.lisp +54 -0
- data/lib/clucumber/vendor/lift/test/packages.lisp +17 -0
- data/lib/clucumber/vendor/lift/test/test-config-files.lisp +20 -0
- data/lib/clucumber/vendor/lift/test/test-dynamic-variables.lisp +57 -0
- data/lib/clucumber/vendor/lift/test/test-maximum-problems.lisp +74 -0
- data/lib/clucumber/vendor/lift/test/test-prototypes.lisp +278 -0
- data/lib/clucumber/vendor/lift/test/test-timeout.lisp +37 -0
- data/lib/clucumber/vendor/lift/test/tests-in-progress.lisp +62 -0
- data/lib/clucumber/vendor/lift/test/testsuite-expects.lisp +60 -0
- data/lib/clucumber/vendor/lift/timeout/package.lisp +13 -0
- data/lib/clucumber/vendor/lift/timeout/with-timeout.lisp +123 -0
- data/lib/clucumber/vendor/lift/website/stuff/Temp.lisp +34 -0
- data/lib/clucumber/vendor/st-json/st-json.asd +3 -0
- data/lib/clucumber/vendor/st-json/st-json.lisp +310 -0
- data/lib/clucumber/vendor/trivial-backtrace/dev/backtrace.lisp +127 -0
- data/lib/clucumber/vendor/trivial-backtrace/dev/fallback.lisp +10 -0
- data/lib/clucumber/vendor/trivial-backtrace/dev/map-backtrace.lisp +103 -0
- data/lib/clucumber/vendor/trivial-backtrace/dev/mucking.lisp +75 -0
- data/lib/clucumber/vendor/trivial-backtrace/dev/packages.lisp +13 -0
- data/lib/clucumber/vendor/trivial-backtrace/dev/utilities.lisp +104 -0
- data/lib/clucumber/vendor/trivial-backtrace/test/packages.lisp +5 -0
- data/lib/clucumber/vendor/trivial-backtrace/test/test-setup.lisp +4 -0
- data/lib/clucumber/vendor/trivial-backtrace/test/tests.lisp +16 -0
- data/lib/clucumber/vendor/trivial-backtrace/trivial-backtrace-test.asd +22 -0
- data/lib/clucumber/vendor/trivial-backtrace/trivial-backtrace.asd +35 -0
- data/lib/clucumber/vendor/usocket/backend/allegro.lisp +199 -0
- data/lib/clucumber/vendor/usocket/backend/armedbear.lisp +491 -0
- data/lib/clucumber/vendor/usocket/backend/clisp.lisp +260 -0
- data/lib/clucumber/vendor/usocket/backend/cmucl.lisp +266 -0
- data/lib/clucumber/vendor/usocket/backend/lispworks.lisp +741 -0
- data/lib/clucumber/vendor/usocket/backend/mcl.lisp +369 -0
- data/lib/clucumber/vendor/usocket/backend/openmcl.lisp +206 -0
- data/lib/clucumber/vendor/usocket/backend/sbcl.lisp +424 -0
- data/lib/clucumber/vendor/usocket/backend/scl.lisp +261 -0
- data/lib/clucumber/vendor/usocket/condition.lisp +227 -0
- data/lib/clucumber/vendor/usocket/package.lisp +82 -0
- data/lib/clucumber/vendor/usocket/server.lisp +45 -0
- data/lib/clucumber/vendor/usocket/test/package.lisp +13 -0
- data/lib/clucumber/vendor/usocket/test/test-usocket.lisp +166 -0
- data/lib/clucumber/vendor/usocket/usocket-test.asd +26 -0
- data/lib/clucumber/vendor/usocket/usocket.asd +37 -0
- data/lib/clucumber/vendor/usocket/usocket.lisp +542 -0
- data/lib/clucumber/vendor/usocket/vendor/kqueue.lisp +1 -0
- data/lib/clucumber/vendor/usocket/vendor/split-sequence.lisp +245 -0
- data/lib/clucumber.rb +29 -7
- metadata +151 -5
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
;;;-*- Mode: Lisp; Package: lift-interface -*-
|
|
2
|
+
|
|
3
|
+
(defpackage #:lift-interface
|
|
4
|
+
(:use
|
|
5
|
+
#:common-lisp
|
|
6
|
+
#:lift
|
|
7
|
+
#+(or mcl ccl) #:ccl)
|
|
8
|
+
(:import-from #:lift
|
|
9
|
+
#:number-of-failures
|
|
10
|
+
#:number-of-errors
|
|
11
|
+
#:errors
|
|
12
|
+
#:failures
|
|
13
|
+
#:tests-run
|
|
14
|
+
#:test-class-name
|
|
15
|
+
#:run-tests-internal))
|
|
16
|
+
|
|
17
|
+
(in-package #:lift-interface)
|
|
18
|
+
|
|
19
|
+
(defvar *lift-report-window* nil)
|
|
20
|
+
|
|
21
|
+
(defclass lift-report-window (fred-window)
|
|
22
|
+
()
|
|
23
|
+
(:default-initargs
|
|
24
|
+
:scratch-p t))
|
|
25
|
+
|
|
26
|
+
(defun show-last-test-results (result)
|
|
27
|
+
(unless (and *lift-report-window*
|
|
28
|
+
(typep *lift-report-window* 'fred-window)
|
|
29
|
+
(window-shown-p *lift-report-window*))
|
|
30
|
+
(setf *lift-report-window* (make-instance 'lift-report-window)))
|
|
31
|
+
(let* ((*print-length* nil)
|
|
32
|
+
(*print-level* nil)
|
|
33
|
+
(*print-array* t)
|
|
34
|
+
(win *lift-report-window*))
|
|
35
|
+
(set-window-title
|
|
36
|
+
win
|
|
37
|
+
(format nil "~&Test Report for ~A: ~D test~:P run~:[~[~:;, ~:*~A Failure~:P~]~[~:;, ~:*~A Error~:P~]~;, All Passed~]"
|
|
38
|
+
(test-class-name result) (length (tests-run result))
|
|
39
|
+
(not (or (failures result) (errors result)))
|
|
40
|
+
(length (failures result))
|
|
41
|
+
(length (errors result))))
|
|
42
|
+
|
|
43
|
+
(select-all win)
|
|
44
|
+
(clear win)
|
|
45
|
+
(describe-object result win)
|
|
46
|
+
(force-output win)
|
|
47
|
+
(fred-update win)))
|
|
48
|
+
|
|
49
|
+
#+Ignore
|
|
50
|
+
(defmethod run-tests-internal :around ((case test-mixin) &key)
|
|
51
|
+
(show-last-test-results (call-next-method)))
|
|
52
|
+
|
|
53
|
+
(u:define-around-advice run-tests show-results
|
|
54
|
+
(show-last-test-results (u:call-next-advice)))
|
|
55
|
+
|
|
56
|
+
(run-tests :suite 'lift::test-lift)
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
(in-package #:lift)
|
|
2
|
+
|
|
3
|
+
If a test suite isn't defined and try to define a test for it, you get an odd error instead
|
|
4
|
+
|
|
5
|
+
#|
|
|
6
|
+
testsuite-setup
|
|
7
|
+
testsuite-run
|
|
8
|
+
testsuite-teardown
|
|
9
|
+
|
|
10
|
+
testsuite-run
|
|
11
|
+
run each method of this suite using run-test-internal
|
|
12
|
+
run child suites
|
|
13
|
+
|
|
14
|
+
run-test-internal
|
|
15
|
+
start-test
|
|
16
|
+
setup-test
|
|
17
|
+
funcall test-method
|
|
18
|
+
teardown-test
|
|
19
|
+
end-test
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
;; sharing test code
|
|
23
|
+
(defmethod testsuite-run ((case test-with-generators) (result test-result))
|
|
24
|
+
(loop for generators do
|
|
25
|
+
(set-generators)
|
|
26
|
+
(run-testsuite case result)))
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
;; single setup
|
|
30
|
+
|
|
31
|
+
My first thought (and attempt) was to have the test-suite do the setup for
|
|
32
|
+
single-setup? tests. This sort of works but gets wonky when a superclass has
|
|
33
|
+
it's own setup. It also doesn't make it easy to support making setup optional
|
|
34
|
+
|
|
35
|
+
My zeroth thought was to have a switch that each test checked.
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|#
|
|
42
|
+
ok - test-teardown needs to remove vars from *test-environment*
|
|
43
|
+
|
|
44
|
+
in deftestsuite:
|
|
45
|
+
;; create class first so that we can introspec on it
|
|
46
|
+
;;?? this is kind of weak
|
|
47
|
+
|
|
48
|
+
make sure that we have all the methods we need for
|
|
49
|
+
generator tests, single setup tests, tests with timeout
|
|
50
|
+
|
|
51
|
+
could probably get rid of (need to have something that grabs super-classes then):
|
|
52
|
+
(defun test-slot-names (test-name)
|
|
53
|
+
(mopu-class-slot-names test-name))
|
|
54
|
+
|
|
55
|
+
custom error messages as conditions
|
|
56
|
+
|
|
57
|
+
better message
|
|
58
|
+
> Error: Failed assertion: (TEST-CLASS-P CLASS)
|
|
59
|
+
> While executing: CCL::%ASSERTION-FAILURE
|
|
60
|
+
> Type Command-/ to continue, Command-. to abort.
|
|
61
|
+
> If continued: test the assertion again.
|
|
62
|
+
|
|
63
|
+
a describe for test-mixins
|
|
64
|
+
|
|
65
|
+
make run-tests-internal a method
|
|
66
|
+
make run-tests to the work
|
|
67
|
+
possibly change *current-test-class* to a symbol always
|
|
68
|
+
|
|
69
|
+
make run-test a function, see above
|
|
70
|
+
|
|
71
|
+
simplify parsers
|
|
72
|
+
|
|
73
|
+
what should number-of-tests really do
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
Lift:
|
|
77
|
+
|
|
78
|
+
;;; ---------------------------------------------------------------------------
|
|
79
|
+
;;; sharing setup and teardown
|
|
80
|
+
;;; ---------------------------------------------------------------------------
|
|
81
|
+
|
|
82
|
+
;;;; currently, LIFT always shuffles cases within each class
|
|
83
|
+
|
|
84
|
+
(deftestsuite big-setup ()
|
|
85
|
+
(:setup (long-slow-process))
|
|
86
|
+
(:teardown (some-clean-up))
|
|
87
|
+
:single-setup)
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
(addtest
|
|
91
|
+
test-1
|
|
92
|
+
)
|
|
93
|
+
|
|
94
|
+
(addtest
|
|
95
|
+
test-2
|
|
96
|
+
)
|
|
97
|
+
|
|
98
|
+
(deftestsuite foo-1 (big-setup)
|
|
99
|
+
)
|
|
100
|
+
|
|
101
|
+
(addtest
|
|
102
|
+
test-1-1
|
|
103
|
+
)
|
|
104
|
+
|
|
105
|
+
(addtest
|
|
106
|
+
test-1-2
|
|
107
|
+
)
|
|
108
|
+
|
|
109
|
+
;;; ---------------------------------------------------------------------------
|
|
110
|
+
;;; want to use the same test on different things. So we need to have
|
|
111
|
+
;;; the same test body with different setup
|
|
112
|
+
;;; ---------------------------------------------------------------------------
|
|
113
|
+
|
|
114
|
+
(deftestsuite foo ()
|
|
115
|
+
(<vars>)
|
|
116
|
+
(:cases ...)
|
|
117
|
+
(:setup ))
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
(subclasses* 'containers::abstract-queue)
|
|
122
|
+
|
|
123
|
+
(#<STANDARD-CLASS ABSTRACT-QUEUE> #<STANDARD-CLASS PRIORITY-QUEUE-HEAP>
|
|
124
|
+
#<STANDARD-CLASS RING-BUFFER> #<STANDARD-CLASS BASIC-QUEUE>
|
|
125
|
+
#<STANDARD-CLASS PRIORITY-QUEUE-ON-CONTAINER >)
|
|
126
|
+
|
|
127
|
+
No easy way to get, e.g., all the PQOCs b/c we don't know (and can't easily know)
|
|
128
|
+
which containers it can be on. Could add protocol.
|
|
129
|
+
|
|
130
|
+
(deftestsuite test-queue () ())
|
|
131
|
+
|
|
132
|
+
;;; ---------------------------------------------------------------------------
|
|
133
|
+
|
|
134
|
+
(deftestsuite test-queue-error-when-empty (test-queue)
|
|
135
|
+
((queue (make-container 'basic-queue)))
|
|
136
|
+
(:test
|
|
137
|
+
(insert-item queue 2)
|
|
138
|
+
(insert-item queue 4)
|
|
139
|
+
(dequeue queue)
|
|
140
|
+
(dequeue queue)
|
|
141
|
+
(ensure-error (dequeue queue))))
|
|
142
|
+
|
|
143
|
+
;;; ---------------------------------------------------------------------------
|
|
144
|
+
|
|
145
|
+
(deftestsuite test-queue-error-when-empty (test-queue)
|
|
146
|
+
((queue (make-container 'basic-queue))))
|
|
147
|
+
|
|
148
|
+
(deftestsuite test-queue-error-when-empty (test-queue)
|
|
149
|
+
((queue :foreach (prototype-of 'abstract-queue))))
|
|
150
|
+
|
|
151
|
+
(deftestsuite test-queue-error-when-empty (test-queue)
|
|
152
|
+
(queue)
|
|
153
|
+
(:cases (queue (prototype-of 'abstract-queue))))
|
|
154
|
+
|
|
155
|
+
(addtest (test-queue-error-when-empty)
|
|
156
|
+
(insert-item queue 2)
|
|
157
|
+
(insert-item queue 4)
|
|
158
|
+
(dequeue queue)
|
|
159
|
+
(dequeue queue)
|
|
160
|
+
(ensure-error (dequeue queue)))
|
|
161
|
+
|
|
162
|
+
;;; ---------------------------------------------------------------------------
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
;;; full factorial
|
|
166
|
+
(deftestsuite test-queue-error-when-empty (test-queue)
|
|
167
|
+
(q1 q2 q3 q4)
|
|
168
|
+
(:cases (queue-1 :foreach (prototype-of 'abstract-queue))
|
|
169
|
+
(queue-2 :foreach (prototype-of 'abstract-queue))))
|
|
170
|
+
|
|
171
|
+
(deftestsuite test-queue-error-when-empty (test-queue)
|
|
172
|
+
((queue-1 :foreach (prototype-of 'abstract-queue))
|
|
173
|
+
(queue-2 :foreach (prototype-of 'abstract-queue))))
|
|
174
|
+
|
|
175
|
+
(deftestsuite test-queue-error-when-empty (test-queue)
|
|
176
|
+
((queue-1 :foreach (prototype-of 'abstract-queue))
|
|
177
|
+
(queue-2 :foreach (prototype-of 'abstract-queue))))
|
|
178
|
+
|
|
179
|
+
;;; as pairs
|
|
180
|
+
(deftestsuite test-queue-error-when-empty (test-queue)
|
|
181
|
+
((queue-1 :foreach (prototype-of 'abstract-queue))
|
|
182
|
+
(queue-2 :andeach (prototype-of 'abstract-queue))))
|
|
183
|
+
|
|
184
|
+
;;; any generator will do
|
|
185
|
+
(deftestsuite foo ()
|
|
186
|
+
((number :foreach '(1 2 3 4 5 6))))
|
|
187
|
+
|
|
188
|
+
;;;; pros
|
|
189
|
+
;; simple syntax (so far!)
|
|
190
|
+
;;
|
|
191
|
+
|
|
192
|
+
;;;; Cons
|
|
193
|
+
;; conses up a list of prototypes instead of mapping them
|
|
194
|
+
;; (I think that supporting mapping would create big changes in LIFT).
|
|
195
|
+
;;
|
|
196
|
+
|
|
197
|
+
;;;; Unknowns
|
|
198
|
+
;; what will this implement as?
|
|
199
|
+
|
|
200
|
+
;;; ---------------------------------------------------------------------------
|
|
201
|
+
;;; another way to handle setup for 'sequencial' tests
|
|
202
|
+
;;; ---------------------------------------------------------------------------
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
(in-package #:lift)
|
|
2
|
+
|
|
3
|
+
;;; ---------------------------------------------------------------------------
|
|
4
|
+
;;; randomized testing helpers
|
|
5
|
+
;;; ---------------------------------------------------------------------------
|
|
6
|
+
|
|
7
|
+
(u:export-exported-symbols "VARIATES" "LIFT")
|
|
8
|
+
|
|
9
|
+
;;; ---------------------------------------------------------------------------
|
|
10
|
+
|
|
11
|
+
(defclass randomized-testsuite-mixin (test-mixin)
|
|
12
|
+
((generator
|
|
13
|
+
:reader generator)
|
|
14
|
+
(shuffle-methods?
|
|
15
|
+
:initform t
|
|
16
|
+
:initarg :shuffle-methods?
|
|
17
|
+
:reader shuffle-methods?)))
|
|
18
|
+
|
|
19
|
+
;;; ---------------------------------------------------------------------------
|
|
20
|
+
|
|
21
|
+
(defmethod testsuite-methods :around ((case randomized-testsuite-mixin))
|
|
22
|
+
(let ((methods (call-next-method)))
|
|
23
|
+
(if (shuffle-methods? case)
|
|
24
|
+
(variates:shuffle-elements! (copy-list methods) :generator (generator case))
|
|
25
|
+
methods)))
|
|
26
|
+
|
|
27
|
+
;;; ---------------------------------------------------------------------------
|
|
28
|
+
;;; single-setup testing
|
|
29
|
+
;;; ---------------------------------------------------------------------------
|
|
30
|
+
|
|
31
|
+
(defclass single-setup-mixin (test-mixin)
|
|
32
|
+
((single-setup?
|
|
33
|
+
:initform nil
|
|
34
|
+
:initargs :single-setup?
|
|
35
|
+
:reader single-setup?)))
|
|
36
|
+
|
|
37
|
+
;;; ---------------------------------------------------------------------------
|
|
38
|
+
|
|
39
|
+
(defmethod initialize-instance :after ((object single-setup-mixin) &key)
|
|
40
|
+
;; no shuffling of single setup tests
|
|
41
|
+
(when (slot-exists-p object 'shuffle-methods?)
|
|
42
|
+
(setf (slot-value object 'shuffle-methods?) nil)))
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|