The cl-quickcheck Reference Manual

This is the cl-quickcheck Reference Manual, version 0.4, generated automatically by Declt version 4.0 beta 2 "William Riker" on Mon Feb 26 15:36:25 2024 GMT+0.

Table of Contents


1 Introduction


2 Systems

The main system appears first, followed by any subsystem dependency.


2.1 cl-quickcheck

Common Lisp port of the QuickCheck unit test framework

Author

Andrew Pennebaker <>

License

MIT

Version

0.4

Source

cl-quickcheck.asd.

Child Component

cl-quickcheck.lisp (file).


3 Files

Files are sorted by type and then listed depth-first from the systems components trees.


3.1 Lisp


3.1.1 cl-quickcheck/cl-quickcheck.asd

Source

cl-quickcheck.asd.

Parent Component

cl-quickcheck (system).

ASDF Systems

cl-quickcheck.


3.1.2 cl-quickcheck/cl-quickcheck.lisp

Source

cl-quickcheck.asd.

Parent Component

cl-quickcheck (system).

Packages

cl-quickcheck.

Public Interface
Internals

4 Packages

Packages are listed by definition order.


4.1 cl-quickcheck

Source

cl-quickcheck.lisp.

Use List

common-lisp.

Public Interface
Internals

5 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


5.1 Public Interface


5.1.1 Special variables

Special Variable: *break-on-failure*

When true, test failures jump us immediately into the debugger.

Package

cl-quickcheck.

Source

cl-quickcheck.lisp.

Special Variable: *loud*

When true, we show progress as tests are run with dots to stdout.

Package

cl-quickcheck.

Source

cl-quickcheck.lisp.

Special Variable: *num-trials*

Number of random trials we want to see pass in FOR-ALL tests.

Package

cl-quickcheck.

Source

cl-quickcheck.lisp.

Special Variable: *size*

Bounds the size of random test cases in a generator-dependent way.

Package

cl-quickcheck.

Source

cl-quickcheck.lisp.

Special Variable: *testing*

When true, we’re in the dynamic extent of a quickcheck form.

Package

cl-quickcheck.

Source

cl-quickcheck.lisp.

Special Variable: a-boolean
Package

cl-quickcheck.

Source

cl-quickcheck.lisp.

Special Variable: a-real
Package

cl-quickcheck.

Source

cl-quickcheck.lisp.

Special Variable: an-index
Package

cl-quickcheck.

Source

cl-quickcheck.lisp.

Special Variable: an-integer
Package

cl-quickcheck.

Source

cl-quickcheck.lisp.

Special Variable: k-generator
Package

cl-quickcheck.

Source

cl-quickcheck.lisp.

Special Variable: m-generator
Package

cl-quickcheck.

Source

cl-quickcheck.lisp.

Special Variable: n-generator
Package

cl-quickcheck.

Source

cl-quickcheck.lisp.


5.1.2 Macros

Macro: define (binding &body body)

Like Scheme’s top-level DEFINE, more or less.

Package

cl-quickcheck.

Source

cl-quickcheck.lisp.

Macro: for-all (bindings &body body)

Perform the test in BODY for random values of BINDINGS.

Package

cl-quickcheck.

Source

cl-quickcheck.lisp.

Macro: is (fn &rest operands)

Test that FN applied to OPERANDS is true, with the failure message detailing the failing arguments.

Package

cl-quickcheck.

Source

cl-quickcheck.lisp.

Macro: is= (x y)

Test that X is EQUAL to Y.

Package

cl-quickcheck.

Source

cl-quickcheck.lisp.

Macro: isnt (fn &rest operands)

Test that FN applied to OPERANDS is false.

Package

cl-quickcheck.

Source

cl-quickcheck.lisp.

Macro: isnt= (x y)

Test that X is not EQUAL to Y.

Package

cl-quickcheck.

Source

cl-quickcheck.lisp.

Macro: named (name &body tests)

Perform the given TESTS with all the test names set to NAME.

Package

cl-quickcheck.

Source

cl-quickcheck.lisp.

Macro: only-if (flag test)

Perform the TEST only if FLAG is true, otherwise return a SKIPPED test result whose name is TEST quoted.

Package

cl-quickcheck.

Source

cl-quickcheck.lisp.

Macro: pick-weighted (&body choices)

Given CHOICES with constant weights, pick a random one at runtime.

Package

cl-quickcheck.

Source

cl-quickcheck.lisp.

Macro: quickcheck (&body body)

Run BODY and report the results of any tests.

Package

cl-quickcheck.

Source

cl-quickcheck.lisp.

Macro: should-signal (condition &body body)

Test that evaluating BODY signals (a subtype of) CONDITION.

Package

cl-quickcheck.

Source

cl-quickcheck.lisp.

Macro: test (flag)

Test that FLAG is true.

Package

cl-quickcheck.

Source

cl-quickcheck.lisp.

Macro: wrap-each (wrapper &body wrappees)

Perform each of the WRAPPEES as if surrounded by WRAPPER (with
the literal symbol WRAPPEE inside WRAPPER being the hole where the wrappee appears). This is useful for factoring out common setup/teardown code for a sequence of tests without compromising their isolation.

Package

cl-quickcheck.

Source

cl-quickcheck.lisp.


5.1.3 Ordinary functions

Function: a-char ()
Package

cl-quickcheck.

Source

cl-quickcheck.lisp.

Function: a-list (generator)
Package

cl-quickcheck.

Source

cl-quickcheck.lisp.

Function: a-member (&rest generators)
Package

cl-quickcheck.

Source

cl-quickcheck.lisp.

Function: a-string ()
Package

cl-quickcheck.

Source

cl-quickcheck.lisp.

Function: a-symbol ()
Package

cl-quickcheck.

Source

cl-quickcheck.lisp.

Function: a-tuple (&rest generators)
Package

cl-quickcheck.

Source

cl-quickcheck.lisp.

Function: collect-test-results (fn)

Call FN with *TESTING* true, and return a list of the test results.

Package

cl-quickcheck.

Source

cl-quickcheck.lisp.

Function: generate (generator)

Ask GENERATOR to produce a value.

Package

cl-quickcheck.

Source

cl-quickcheck.lisp.

Function: report (test-cases)

Print out the interesting test results in longer form.

Package

cl-quickcheck.

Source

cl-quickcheck.lisp.

Reader: test-bindings (instance)
Writer: (setf test-bindings) (instance)
Package

cl-quickcheck.

Source

cl-quickcheck.lisp.

Target Slot

bindings.

Reader: test-detail (instance)
Writer: (setf test-detail) (instance)
Package

cl-quickcheck.

Source

cl-quickcheck.lisp.

Target Slot

detail.

Reader: test-flopped (instance)
Writer: (setf test-flopped) (instance)
Package

cl-quickcheck.

Source

cl-quickcheck.lisp.

Target Slot

flopped.

Reader: test-name (instance)
Writer: (setf test-name) (instance)
Package

cl-quickcheck.

Source

cl-quickcheck.lisp.

Target Slot

name.


5.1.4 Structures

Structure: test
Package

cl-quickcheck.

Source

cl-quickcheck.lisp.

Direct superclasses

structure-object.

Direct slots
Slot: name
Readers

test-name.

Writers

(setf test-name).

Slot: flopped
Readers

test-flopped.

Writers

(setf test-flopped).

Slot: detail
Readers

test-detail.

Writers

(setf test-detail).

Slot: bindings
Readers

test-bindings.

Writers

(setf test-bindings).


5.2 Internals


5.2.1 Special variables

Special Variable: *logger*

Function to do whatever’s appropriate with the result of each test as it completes.

Package

cl-quickcheck.

Source

cl-quickcheck.lisp.


5.2.2 Macros

Macro: capture-stdout (&body body)
Package

cl-quickcheck.

Source

cl-quickcheck.lisp.

Macro: let-dfv (((name params &body body1)) &body body2)

Bind a dynamic function variable, with CALL-NEXT-FUNCTION in its body calling the same variable as bound in the enclosing dynamic scope.

Package

cl-quickcheck.

Source

cl-quickcheck.lisp.


5.2.3 Ordinary functions

Function: answer (name flopped &optional detail)

Log a test outcome, with appropriate interactive side effects.

Package

cl-quickcheck.

Source

cl-quickcheck.lisp.

Function: call-tester (passp-fn)

Call PASSP-FN and return whether it flopped.

Package

cl-quickcheck.

Source

cl-quickcheck.lisp.

Function: classify (flopped)
Package

cl-quickcheck.

Source

cl-quickcheck.lisp.

Function: collect-dups (tests)

Return a hashtable from names of elements of TESTS to lists of the elements with the same name.

Package

cl-quickcheck.

Source

cl-quickcheck.lisp.

Function: concat-symbol (&rest parts)

Intern a symbol by catenating PARTS.

Package

cl-quickcheck.

Source

cl-quickcheck.lisp.

Function: copy-test (instance)
Package

cl-quickcheck.

Source

cl-quickcheck.lisp.

Function: default-generator (name)

Give a generator expression for a name that’s missing an explicit one. You’ll have to define the meaning of this shorthand elsewhere.

Package

cl-quickcheck.

Source

cl-quickcheck.lisp.

Function: distribution (tests)

Count test cases failed, skipped, passed, and total.

Package

cl-quickcheck.

Source

cl-quickcheck.lisp.

Function: hash-table-values (table)

Return a list of TABLE’s values in arbitrary order.

Package

cl-quickcheck.

Source

cl-quickcheck.lisp.

Function: intercept-errors (fn)
Package

cl-quickcheck.

Source

cl-quickcheck.lisp.

Function: is-macro (form fn operands)
Package

cl-quickcheck.

Source

cl-quickcheck.lisp.

Function: judgedp (opt-count)

OPT-COUNT describes a repeated test: NIL if it ever failed, otherwise a count of passed trials. Return true iff the test has either passed *NUM-TRIALS* times or failed at least once.

Package

cl-quickcheck.

Source

cl-quickcheck.lisp.

Function: make-test (&key name flopped detail bindings)
Package

cl-quickcheck.

Source

cl-quickcheck.lisp.

Function: normalize-binding (binding)

Return BINDING’s pair of name and generator expression.

Package

cl-quickcheck.

Source

cl-quickcheck.lisp.

Function: print-test (test)
Package

cl-quickcheck.

Source

cl-quickcheck.lisp.

Function: random-element (list)
Package

cl-quickcheck.

Source

cl-quickcheck.lisp.

Function: run-for-all (test-fn vars &rest generators)

Repeatedly call TEST-FN with VARS bound to values from GENERATORS.

Package

cl-quickcheck.

Source

cl-quickcheck.lisp.

Function: run-is-tester (name fn-fn)

Return a test outcome from the result of FN-FN, which returns a list of a function to call for the actual test, plus its arguments.

Package

cl-quickcheck.

Source

cl-quickcheck.lisp.

Function: run-named (name fn)
Package

cl-quickcheck.

Source

cl-quickcheck.lisp.

Function: run-only-if (flag-name flag-fn name test-fn)

Behavior of the ONLY-IF macro.

Package

cl-quickcheck.

Source

cl-quickcheck.lisp.

Function: run-quickcheck (fn)

Call FN to run a test suite, and report the result.

Package

cl-quickcheck.

Source

cl-quickcheck.lisp.

Function: run-should-signal (name expected-condition fn)

Test that calling FN signals (a subtype of) EXPECTED-CONDITION.

Package

cl-quickcheck.

Source

cl-quickcheck.lisp.

Function: run-tester (name passp-fn)

Return a test outcome from calling PASSP-FN.

Package

cl-quickcheck.

Source

cl-quickcheck.lisp.

Function: run-trial (test-fn vars generators)

Run one trial of a FOR-ALL test.

Package

cl-quickcheck.

Source

cl-quickcheck.lisp.

Function: show-progress (flopped)

Write a single character as a bird’s-eye view of a test result.

Package

cl-quickcheck.

Source

cl-quickcheck.lisp.

Function: sort-out (tests)

Collect the test cases of TESTS into separate lists by name, and return them in order of the first appearance of a case with that name.

Package

cl-quickcheck.

Source

cl-quickcheck.lisp.

Function: summarize-all (verdicts)
Package

cl-quickcheck.

Source

cl-quickcheck.lisp.

Function: summarize-test (cases)

Report the results of the test cases of a test, if they’re interesting.

Package

cl-quickcheck.

Source

cl-quickcheck.lisp.

Function: tally (test opt-count)
Package

cl-quickcheck.

Source

cl-quickcheck.lisp.

Function: test-failed (test)
Package

cl-quickcheck.

Source

cl-quickcheck.lisp.

Function: test-p (object)
Package

cl-quickcheck.

Source

cl-quickcheck.lisp.

Function: test-passed (test)
Package

cl-quickcheck.

Source

cl-quickcheck.lisp.

Function: test-skipped (test)
Package

cl-quickcheck.

Source

cl-quickcheck.lisp.

Function: unique-names (tests)

Return the test-names of TESTS, in order of first appearance.

Package

cl-quickcheck.

Source

cl-quickcheck.lisp.

Function: update-bindings (test bindings)
Package

cl-quickcheck.

Source

cl-quickcheck.lisp.

Function: update-name (test name)
Package

cl-quickcheck.

Source

cl-quickcheck.lisp.

Function: verdict (tests)

Choose the most significant result from TESTS: failed, passed, or skipped, in that order.

Package

cl-quickcheck.

Source

cl-quickcheck.lisp.


Appendix A Indexes


A.1 Concepts


A.2 Functions

Jump to:   (  
A   C   D   F   G   H   I   J   L   M   N   O   P   Q   R   S   T   U   V   W  
Index Entry  Section

(
(setf test-bindings): Public ordinary functions
(setf test-detail): Public ordinary functions
(setf test-flopped): Public ordinary functions
(setf test-name): Public ordinary functions

A
a-char: Public ordinary functions
a-list: Public ordinary functions
a-member: Public ordinary functions
a-string: Public ordinary functions
a-symbol: Public ordinary functions
a-tuple: Public ordinary functions
answer: Private ordinary functions

C
call-tester: Private ordinary functions
capture-stdout: Private macros
classify: Private ordinary functions
collect-dups: Private ordinary functions
collect-test-results: Public ordinary functions
concat-symbol: Private ordinary functions
copy-test: Private ordinary functions

D
default-generator: Private ordinary functions
define: Public macros
distribution: Private ordinary functions

F
for-all: Public macros
Function, (setf test-bindings): Public ordinary functions
Function, (setf test-detail): Public ordinary functions
Function, (setf test-flopped): Public ordinary functions
Function, (setf test-name): Public ordinary functions
Function, a-char: Public ordinary functions
Function, a-list: Public ordinary functions
Function, a-member: Public ordinary functions
Function, a-string: Public ordinary functions
Function, a-symbol: Public ordinary functions
Function, a-tuple: Public ordinary functions
Function, answer: Private ordinary functions
Function, call-tester: Private ordinary functions
Function, classify: Private ordinary functions
Function, collect-dups: Private ordinary functions
Function, collect-test-results: Public ordinary functions
Function, concat-symbol: Private ordinary functions
Function, copy-test: Private ordinary functions
Function, default-generator: Private ordinary functions
Function, distribution: Private ordinary functions
Function, generate: Public ordinary functions
Function, hash-table-values: Private ordinary functions
Function, intercept-errors: Private ordinary functions
Function, is-macro: Private ordinary functions
Function, judgedp: Private ordinary functions
Function, make-test: Private ordinary functions
Function, normalize-binding: Private ordinary functions
Function, print-test: Private ordinary functions
Function, random-element: Private ordinary functions
Function, report: Public ordinary functions
Function, run-for-all: Private ordinary functions
Function, run-is-tester: Private ordinary functions
Function, run-named: Private ordinary functions
Function, run-only-if: Private ordinary functions
Function, run-quickcheck: Private ordinary functions
Function, run-should-signal: Private ordinary functions
Function, run-tester: Private ordinary functions
Function, run-trial: Private ordinary functions
Function, show-progress: Private ordinary functions
Function, sort-out: Private ordinary functions
Function, summarize-all: Private ordinary functions
Function, summarize-test: Private ordinary functions
Function, tally: Private ordinary functions
Function, test-bindings: Public ordinary functions
Function, test-detail: Public ordinary functions
Function, test-failed: Private ordinary functions
Function, test-flopped: Public ordinary functions
Function, test-name: Public ordinary functions
Function, test-p: Private ordinary functions
Function, test-passed: Private ordinary functions
Function, test-skipped: Private ordinary functions
Function, unique-names: Private ordinary functions
Function, update-bindings: Private ordinary functions
Function, update-name: Private ordinary functions
Function, verdict: Private ordinary functions

G
generate: Public ordinary functions

H
hash-table-values: Private ordinary functions

I
intercept-errors: Private ordinary functions
is: Public macros
is-macro: Private ordinary functions
is=: Public macros
isnt: Public macros
isnt=: Public macros

J
judgedp: Private ordinary functions

L
let-dfv: Private macros

M
Macro, capture-stdout: Private macros
Macro, define: Public macros
Macro, for-all: Public macros
Macro, is: Public macros
Macro, is=: Public macros
Macro, isnt: Public macros
Macro, isnt=: Public macros
Macro, let-dfv: Private macros
Macro, named: Public macros
Macro, only-if: Public macros
Macro, pick-weighted: Public macros
Macro, quickcheck: Public macros
Macro, should-signal: Public macros
Macro, test: Public macros
Macro, wrap-each: Public macros
make-test: Private ordinary functions

N
named: Public macros
normalize-binding: Private ordinary functions

O
only-if: Public macros

P
pick-weighted: Public macros
print-test: Private ordinary functions

Q
quickcheck: Public macros

R
random-element: Private ordinary functions
report: Public ordinary functions
run-for-all: Private ordinary functions
run-is-tester: Private ordinary functions
run-named: Private ordinary functions
run-only-if: Private ordinary functions
run-quickcheck: Private ordinary functions
run-should-signal: Private ordinary functions
run-tester: Private ordinary functions
run-trial: Private ordinary functions

S
should-signal: Public macros
show-progress: Private ordinary functions
sort-out: Private ordinary functions
summarize-all: Private ordinary functions
summarize-test: Private ordinary functions

T
tally: Private ordinary functions
test: Public macros
test-bindings: Public ordinary functions
test-detail: Public ordinary functions
test-failed: Private ordinary functions
test-flopped: Public ordinary functions
test-name: Public ordinary functions
test-p: Private ordinary functions
test-passed: Private ordinary functions
test-skipped: Private ordinary functions

U
unique-names: Private ordinary functions
update-bindings: Private ordinary functions
update-name: Private ordinary functions

V
verdict: Private ordinary functions

W
wrap-each: Public macros


A.3 Variables

Jump to:   *  
A   B   D   F   K   M   N   S  
Index Entry  Section

*
*break-on-failure*: Public special variables
*logger*: Private special variables
*loud*: Public special variables
*num-trials*: Public special variables
*size*: Public special variables
*testing*: Public special variables

A
a-boolean: Public special variables
a-real: Public special variables
an-index: Public special variables
an-integer: Public special variables

B
bindings: Public structures

D
detail: Public structures

F
flopped: Public structures

K
k-generator: Public special variables

M
m-generator: Public special variables

N
n-generator: Public special variables
name: Public structures

S
Slot, bindings: Public structures
Slot, detail: Public structures
Slot, flopped: Public structures
Slot, name: Public structures
Special Variable, *break-on-failure*: Public special variables
Special Variable, *logger*: Private special variables
Special Variable, *loud*: Public special variables
Special Variable, *num-trials*: Public special variables
Special Variable, *size*: Public special variables
Special Variable, *testing*: Public special variables
Special Variable, a-boolean: Public special variables
Special Variable, a-real: Public special variables
Special Variable, an-index: Public special variables
Special Variable, an-integer: Public special variables
Special Variable, k-generator: Public special variables
Special Variable, m-generator: Public special variables
Special Variable, n-generator: Public special variables