Next: Introduction, Previous: (dir), Up: (dir) [Contents][Index]
This is the assert-p Reference Manual, version 1.0.0, generated automatically by Declt version 3.0 "Montgomery Scott" on Mon Dec 02 09:03:29 2019 GMT+0.
• Introduction | What assert-p is all about | |
• Systems | The systems documentation | |
• Modules | The modules documentation | |
• Files | The files documentation | |
• Packages | The packages documentation | |
• Definitions | The symbols documentation | |
• Indexes | Concepts, functions, variables and data types |
1 - Load assert-p system by quicklisp
(ql:quickload :assert-p)
2 - Download and load assert-p system by github and asdf
Download directly from github:
git clone https://github.com/noloop/assert-p.git
and load by ASDF:
(asdf:load-system :assert-p)
Note: Remember to configure asdf to find your directory where you downloaded the libraries (asdf call them "systems") above, if you do not know how to make a read at: https://common-lisp.net/project/asdf/asdf/Configuring-ASDF-to-find-your-systems.html or https://lisp-lang.org/learn/writing-libraries.
An assertion library assembles is an set of assertions that throw an assertion-error when the assertion fails. An assertion library usually follows a pattern so that the Test Runners can capture the assertion-error that it throws. The default I follow is using the library :assertion-error of which assert-p is dependent. All assert-p assertions return t
when the assertion passes and throw assertion-error
when the assertion fails.
Check actual eq t. Return t when actual is t, and throw assertion-error when actual is not t.
(t-p t) => t
(t-p nil) => throw assertion-error
(t-p '()) => throw assertion-error
(t-p 5) => throw assertion-error
Check actual not eq t. Return t when actual is not t, and throw assertion-error when actual is t.
(not-t-p t) => throw assertion-error
(not-t-p nil) => t
(not-t-p '()) => t
(not-t-p 5) => t
Check actual eq 0. Return t when actual is 0, and throw assertion-error when actual is not 0.
(zero-p 0) => t
(zero-p 1) => throw assertion-error
(zero-p '()) => throw assertion-error
(zerot-p nil) => throw assertion-error
Check actual not eq 0. Return t when actual is not 0, and throw assertion-error when actual is 0.
(not-zero-p 0) => throw assertion-error
(not-zero-p 1) => t
(not-zero-p '()) => t
(not-zerot-p nil) => t
Check actual eq nil. Return t when actual is nil, and throw assertion-error when actual is not nil.
(nil-p nil) => t
(nil-p 1) => throw assertion-error
(nil-p '()) => t
(nil-p 0) => throw assertion-error
Check actual not eq nil. Return t when actual is not nil, and throw assertion-error when actual is nil.
(not-nil-p nil) => throw assertion-error
(not-nil-p 1) => t
(not-nil-p '()) => throw assertion-error
(not-nil-p 0) => t
Check null actual. Equivalent to (null actual). Return t when actual is null, and throw assertion-error when actual is not null.
(null-p nil) => t
(null-p 1) => throw assertion-error
(null-p '()) => t
(null-p 0) => throw assertion-error
Check not null actual. Equivalent to (not (null actual)). Return t when actual is not null, and throw assertion-error when actual is null.
(not-null-p nil) => throw assertion-error
(not-null-p 1) => t
(not-null-p '()) => throw assertion-error
(not-null-p 0) => t
Check actual eq expected. Return t when actual is eq expected, and throw assertion-error when actual is not eq expected.
(eq-p nil nil) => t
(eq-p 1 3) => throw assertion-error
(eq-p 1 1) => t ; Depending on the implementation it may return T or NIL.
(eq-p nil '())) => t
(eq-p :a :a) => t
(eq-p t nil) => throw assertion-error
Check actual not eq expected. Return t when actual is not eq expected, and throw assertion-error when actual is eq expected.
(not-eq-p nil nil) => throw assertion-error
(not-eq-p nil '())) => throw assertion-error
(not-eq-p :a :a) => throw assertion-errort
(not-eq-p t nil) => t
Check actual eql expected. Return t when actual is eql expected, and throw assertion-error when actual is not eql expected.
(eql-p nil nil) => t
(eql-p 1 3) => throw assertion-error
(eql-p 1 1) => t
(eql-p nil '())) => t
(eql-p :a :a) => t
(eql-p t nil) => throw assertion-error
Check actual not eql expected. Return t when actual is not eql expected, and throw assertion-error when actual is not expected.
(not-eql-p nil nil) => throw assertion-error
(not-eql-p 1 3) => t
(not-eql-p 1 1) => throw assertion-error
(not-eql-p nil '())) => throw assertion-error
(not-eql-p :a :a) => throw assertion-error
(not-eql-p t nil) => t
Check actual equal expected. Return t when actual is equal expected, and throw assertion-error when actual is not equal expected.
(equal-p nil nil) => t
(equal-p 1 3) => throw assertion-error
(equal-p 1 1) => t
(equal-p nil '())) => t
(equal-p :a :a) => t
(equal-p t nil) => throw assertion-error
(equal-p '(1 2 3) '(1 2 3)) => t
(not-equal-p "a" "A") => throw assertion-error
Check actual not equal expected. Return t when actual is not equal expected, and throw assertion-error when actual is equal expected.
(not-equal-p nil nil) => throw assertion-error
(not-equal-p 1 3) => t
(not-equal-p 1 1) => throw assertion-error
(not-equal-p nil '())) => throw assertion-error
(not-equal-p :a :a) => throw assertion-error
(not-equal-p t nil) => t
(not-equal-p '(1 2 3) '(1 2 3)) => throw assertion-error
(not-equal-p "a" "A") => t
Check actual equalp expected. Return t when actual is equalp expected, and throw assertion-error when actual is not equalp expected.
(equalp-p nil nil) => t
(equalp-p 1 3) => throw assertion-error
(equalp-p 1 1) => t
(equalp-p nil '())) => t
(equalp-p :a :a) => t
(equalp-p t nil) => throw assertion-error
(equalp-p '(1 2 3) '(1 2 3)) => t
(equalp-p "a" "A") => t
Check actual not equalp expected. Return t when actual is not equalp expected, and throw assertion-error when actual is equalp expected.
(not-equalp-p nil nil) => throw assertion-error
(not-equalp-p 1 3) => t
(not-equalp-p 1 1) => throw assertion-error
(not-equalp-p nil '())) => throw assertion-error
(not-equalp-p :a :a) => throw assertion-error
(not-equalp-p t nil) => t
(not-equalp-p '(1 2 3) '(1 2 3)) => throw assertion-error
(not-equalp-p "a" "A") => throw assertion-error
Check actual typep expected. Return t when actual is typep expected, and throw assertion-error when actual is not typep expected.
(typep-p 1 'integer) => t
(typep-p "a" 'string) => t
(typep-p :a 'symbol) => t
(typep-p nil 'integer)) => throw assertion-error
(typep-p nil 'symbol) => t
Check actual not typep expected. Return t when actual is not typep expected, and throw assertion-error when actual is typep expected.
(not-typep-p 1 'integer) => throw assertion-error
(not-typep-p "a" 'string) => throw assertion-error
(not-typep-p :a 'symbol) => throw assertion-error
(not-typep-p nil 'integer)) => t
(not-typep-p nil 'symbol) => throw assertion-error
Check actual every predicate expected. Predicate is a symbol of function, actual is a list, and expected an atom. Example: (values-p '= '(t t t) t)
It's similar to (every #'(lambda (i) (= t i)) '(t t t))
. Return t when actual values is expected, and throw assertion-error when actual values is not expected.
(values-p '= '(1 1 1) 1) => t
(values-p 'string= '("a" "a" "a") "a") => t
(values-p 'eq '(t t t) t)) => t
(values-p 'eq '(t nil t) t)) => throw assertion-error
(values-p 'eq '(nil nil nil) t)) => throw assertion-error
Check actual every not predicate expected. Predicate is a symbol of function, actual is a list, and expected an atom. Example: (values-p '= '(t t t) t)
It's similar to (every #'(lambda (i) (not (= t i))) '(t t t))
. Return t when actual values is not expected, and throw assertion-error when actual values is expected.
(not-values-p '= '(1 1 1) 1) => throw assertion-error
(not-values-p 'string= '("a" "a" "a") "a") => throw assertion-error
(not-values-p 'eq '(t t t) t)) => throw assertion-error
(not-values-p 'eq '(t nil t) t)) => throw assertion-error
(not-values-p 'eq '(nil nil nil) t)) => t
Check if fn throw an error. Return t when fn throw error, and throw assertion-error when fn not throw error.
(error-p #'(lambda () (error "Something"))) => t
(error-p #'(lambda () ())) => throw assertion-error
Check if fn not throw an error. Return t when fn not throw error, and throw assertion-error when fn throw error.
(not-error-p #'(lambda () (error "Something"))) => throw assertion-error
(not-error-p #'(lambda () ())) => t
Check if fn throw an specified condition error. Return t when fn throw specified condition error, and throw assertion-error when fn not throw specified condition error.
(condition-error-p #'(lambda () (error 'division-by-zero))
division-by-zero) => t
(condition-error-p #'(lambda () ())
division-by-zero) => throw assertion-error
(condition-error-p #'(lambda () (error "Something"))
division-by-zero) => throw assertion-error
Check if fn not throw an specified condition error. Return t when fn not throw specified condition error, and throw assertion-error when fn throw specified condition error.
(not-condition-error-p #'(lambda () (error 'division-by-zero))
division-by-zero) => throw assertion-error
(not-condition-error-p #'(lambda () ())
division-by-zero) => t
(not-condition-error-p #'(lambda () (error "Something"))
division-by-zero) => t
Custom check for special cases. Where test-result is a form that returns t or nil, actual is value actual used in test-result, expected is value expected used in test-result, operator is operator used in test-result. Return t when test-result is t, and throw assertion-error when test-result is nil.
(custom-p (every #'eq '(:a :b :c) '(:a :b))
'(:a :b :c)
'(:a :b)
"every =") => t
(custom-p (every #'eq '(:a :b :c) '(:a :b :z))
'(:a :b :c)
'(:a :b)
"string=") => throw assertion-error
(custom-p (string= "I exist?" "I exist?")
"I exist?"
"I exist?"
"string=") => t
(custom-p (string= "I exist?" "I'm not sure.")
"I exist?"
"I'm not sure."
"string=") => throw assertion-error
function (t-p actual) => t or throw assertion-error
function (not-t-p actual) => t or throw assertion-error
function (zero-p actual) => t or throw assertion-error
function (not-zero-p actual) => t or throw assertion-error
function (nil-p actual) => t or throw assertion-error
function (not-nil-p actual) => t or throw assertion-error
function (null-p actual) => t or throw assertion-error
function (not-null-p actual) => t or throw assertion-error
function (eq-p actual expected) => t or throw assertion-error
function (not-eq-p actual expected) => t or throw assertion-error
function (eql-p actual expected) => t or throw assertion-error
function (not-eql-p actual expected) => t or throw assertion-error
function (equal-p actual expected) => t or throw assertion-error
function (not-equal-p actual expected) => t or throw assertion-error
function (equalp-p actual expected) => t or throw assertion-error
function (not-equalp-p actual expected) => t or throw assertion-error
function (typep-p actual expected) => t or throw assertion-error
function (not-typep-p actual expected) => t or throw assertion-error
function (values-p predicate actual expected) => t or throw assertion-error
function (not-values-p predicate actual expected) => t or throw assertion-error
function (error-p fn) => t or throw assertion-error
function (not-error-p fn) => t or throw assertion-error
macro (condition-error-p fn condition) => t or throw assertion-error
macro (not-condition-error-p fn condition) => t or throw assertion-error
function (custom-p test-result actual expected operator) => t or throw assertion-error
Copyright (C) 2019 noloop
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see https://www.gnu.org/licenses/.
Contact author:
noloop@zoho.com
Next: Modules, Previous: Introduction, Up: Top [Contents][Index]
The main system appears first, followed by any subsystem dependency.
• The assert-p system |
noloop <noloop@zoho.com>
noloop <noloop@zoho.com>
(:git "git@github.com:noloop/assert-p.git")
GPLv3
A library of assertions written in Common Lisp.
1.0.0
assertion-error
assert-p.asd (file)
src (module)
Modules are listed depth-first from the system components tree.
• The assert-p/src module |
assert-p (system)
src/
Files are sorted by type and then listed depth-first from the systems components trees.
• Lisp files |
• The assert-p.asd file | ||
• The assert-p/src/package.lisp file | ||
• The assert-p/src/macros.lisp file | ||
• The assert-p/src/assert-p.lisp file |
Next: The assert-p/src/package․lisp file, Previous: Lisp files, Up: Lisp files [Contents][Index]
assert-p.asd
assert-p (system)
Next: The assert-p/src/macros․lisp file, Previous: The assert-p․asd file, Up: Lisp files [Contents][Index]
src (module)
src/package.lisp
Next: The assert-p/src/assert-p․lisp file, Previous: The assert-p/src/package․lisp file, Up: Lisp files [Contents][Index]
package.lisp (file)
src (module)
src/macros.lisp
Previous: The assert-p/src/macros․lisp file, Up: Lisp files [Contents][Index]
macros.lisp (file)
src (module)
src/assert-p.lisp
assertion (function)
Next: Definitions, Previous: Files, Up: Top [Contents][Index]
Packages are listed by definition order.
• The noloop.assert-p package |
package.lisp (file)
assert-p
common-lisp
Definitions are sorted by export status, category, package, and then by lexicographic order.
• Exported definitions | ||
• Internal definitions |
Next: Internal definitions, Previous: Definitions, Up: Definitions [Contents][Index]
• Exported macros | ||
• Exported functions |
Next: Exported functions, Previous: Exported definitions, Up: Exported definitions [Contents][Index]
Check if fn throw an specified condition error.
assert-p.lisp (file)
Check if fn not throw an specified condition error.
assert-p.lisp (file)
Previous: Exported macros, Up: Exported definitions [Contents][Index]
Custom check for special cases. Where test-result is a form that returns t or nil, actual is value actual used in test-result, expected is value expected used in test-result, operator is operator used in test-result. Return t when test-result is t, and throw assertion-error when test-result is nil.
assert-p.lisp (file)
Check actual eq expected
assert-p.lisp (file)
Check actual eql expected
assert-p.lisp (file)
Check actual equal expected
assert-p.lisp (file)
Check actual equalp expected
assert-p.lisp (file)
Check if fn throw an error.
assert-p.lisp (file)
Check actual eq nil
assert-p.lisp (file)
Check actual not eq expected
assert-p.lisp (file)
Check actual not eql expected
assert-p.lisp (file)
Check actual not equal expected
assert-p.lisp (file)
Check actual not equalp expected
assert-p.lisp (file)
Check if fn not throw an error.
assert-p.lisp (file)
Check actual not eq nil
assert-p.lisp (file)
Check not null actual. Equivalent to (not (null actual))
assert-p.lisp (file)
Check actual not eq t
assert-p.lisp (file)
Check actual not typep expected
assert-p.lisp (file)
Check actual every not predicate expected. Predicate is a symbol of function, actual is a list, and expected an atom. Example: (values-p ’= ’(t t t) t) It’s similar to (every #’(lambda (i) (not (= t i))) ’(t t t))
assert-p.lisp (file)
Check actual not eq 0
assert-p.lisp (file)
Check null actual. Equivalent to (null actual)
assert-p.lisp (file)
Check actual eq t
assert-p.lisp (file)
Check actual typep expected
assert-p.lisp (file)
Check actual every predicate expected. Predicate is a symbol of function, actual is a list, and expected an atom. Example: (values-p ’= ’(t t t) t) It’s similar to (every #’(lambda (i) (= t i)) ’(t t t))
assert-p.lisp (file)
Check actual eq 0
assert-p.lisp (file)
Previous: Exported definitions, Up: Definitions [Contents][Index]
• Internal macros | ||
• Internal functions |
Next: Internal functions, Previous: Internal definitions, Up: Internal definitions [Contents][Index]
macros.lisp (file)
macros.lisp (file)
macros.lisp (file)
macros.lisp (file)
macros.lisp (file)
macros.lisp (file)
Previous: Internal macros, Up: Internal definitions [Contents][Index]
When result is t return t. When result is nil throw assertion-error. One assertion need result(t or nil), one object actual, one object expected, and one operator(string or symbol). Assertion-error also loading one message of error(built with actual, expected and operator) and the stack trace of error throw moment.
assert-p.lisp (file)
Previous: Definitions, Up: Top [Contents][Index]
• Concept index | ||
• Function index | ||
• Variable index | ||
• Data type index |
Next: Function index, Previous: Indexes, Up: Indexes [Contents][Index]
Jump to: | A F L M |
---|
Jump to: | A F L M |
---|
Next: Variable index, Previous: Concept index, Up: Indexes [Contents][Index]
Jump to: | A C E F M N O T V W Z |
---|
Jump to: | A C E F M N O T V W Z |
---|
Next: Data type index, Previous: Function index, Up: Indexes [Contents][Index]
Previous: Variable index, Up: Indexes [Contents][Index]
Jump to: | A N P S |
---|
Index Entry | Section | ||
---|---|---|---|
| |||
A | |||
assert-p : | The assert-p system | ||
| |||
N | |||
noloop.assert-p : | The noloop․assert-p package | ||
| |||
P | |||
Package, noloop.assert-p : | The noloop․assert-p package | ||
| |||
S | |||
System, assert-p : | The assert-p system | ||
|
Jump to: | A N P S |
---|