Did you know ... Search Documentation:
Pack plunit_assert -- prolog/plunit_assert.pl
PublicShow source

A unit testing library for Prolog, providing an expressive xUnit-like API for PlUnit.

author
- Simon Harding <github@pointbeing.net>
license
- MIT
 assert_true(+Goal) is semidet
Test that Goal succeeds and therefore is truthy
Arguments:
Goal- The goal to be tested
See also
- assertion/1
 assert_false(+Goal) is semidet
Test that Goal fails and therefore is falsy
Arguments:
Goal- The goal to be tested
See also
- assertion/1
 assert_equals(+A, +B) is semidet
This is a superset of assert_is/2 and arithmetic comparison with =:=
Arguments:
A- The first of the terms to be compared
B- The second of the terms to be compared
 assert_not_equals(+A, +B) is semidet
Test that A and B are not equal terms
Arguments:
A- The first of the terms to be compared
B- The second of the terms to be compared
See also
- assert_equals/2
 assert_is(+A, +B) is semidet
Test that A and B are identical terms

Uses ==/2 to check for term identity, which means it compares the terms A and B structurally, including the functor and arity (number of arguments) of the terms and the equality of each corresponding argument. Thus, succeeds if A and B are identical terms, without attempting to unify variables or perform any arithmetic evaluations

Arguments:
A- The first of the terms to be compared
B- The second of the terms to be compared
See also
- assertion/1
- ==/2
 assert_is_not(+A, +B) is semidet
Test that A and B are not identical terms
Arguments:
A- The first of the terms to be compared
B- The second of the terms to be compared
See also
- assert_is/2
 assert_exception(+Goal) is semidet
Test that an exception is thrown during the invocation of Goal
Arguments:
Goal- The goal to be tested
See also
- assertion/1
 assert_unbound(+Var) is semidet
Test that Var is unbound

This is analogous to isNull() or isNone() in other xUnit implementations

Arguments:
Var- The variable to be tested for boundness
See also
- assertion/1
 assert_not_unbound(+Var) is semidet
Test that Var is not unbound
Arguments:
Var- The variable to be tested for unboundness
See also
- assert_unbound/1
 assert_in(+Var, +Collection) is semidet
Test that Var is in Collection

This checks for list/set membership, and also whether Var is a valid dictionary key in Collection

Arguments:
Var- The needle
Collection- The haystack
See also
- assertion/1
 assert_not_in(+Var, +Collection) is semidet
Test that Var is not in Collection

This checks for list/set membership, and also whether Var is a valid dictionary key in Collection

Arguments:
Var- The needle
Collection- The haystack
See also
- assert_in/2
 assert_type(+Term, +Type) is semidet
Test that Var is of type Type

Supported types are: number, integer, float, atom, compound, list, dict

Arguments:
Term- The term to be tested
Type- The type to be asserted
See also
- assertion/1
To be done
- Compound types
 assert_not_type(+Term, +Type) is semidet
Test that Var is not of type Type
Arguments:
Term- The term to be tested
Type- The type to be un-asserted
See also
- assert_type/2
 assert_gt(+A, +B) is semidet
Test that A is greater than B
Arguments:
A-
B-
 assert_lt(+A, +B) is semidet
Test that A is less than B
Arguments:
A-
B-
 assert_gte(+A, +B) is semidet
Test that A is greater than or equal to B
Arguments:
A-
B-
 assert_lte(+A, +B) is semidet
Test that A is less than or equal to B
Arguments:
A-
B-
 assert_test_fails(+Goal) is semidet
Meta test to check that Goal would trigger a PlUnit test fail
Arguments:
Goal- The goal to be queried in the form of a plunit_assert predicate
 assert_test_passes(+Goal) is semidet
Meta test to check that Goal would not trigger a PlUnit test fail
Arguments:
Goal- The goal to be queried in the form of a plunit_assert predicate