File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11# plunit_assert
22
3- Provides a more expressive API for PlUnit by implementing xUnit-like test predicates such as ` assert_true/1 ` and ` assert_type/2 ` .
3+ PlUnit is a unit testing library for Prolog. Its goals are:
44
55
6-
7-
8- A longer-term goal is also that it should provide more helpful failure messages.
6+ 1 . provide a more expressive and familiar API for PlUnit by implementing xUnit-like test predicates such as ` assert_true/1 ` and ` assert_type/2 `
7+ 2 . provide significantly more helpful and user-friendly feedback on test fail
8+ 3 . full compatibility with PlUnit: you can still use ` assertion/1 ` if you wish
99
1010
1111## API Documentation
@@ -23,11 +23,32 @@ https://packages.pointbeing.net/plunit_assert/
2323Thus, the library can currently be installed using:
2424
2525```
26- ?- pack_install(plunit_assert, [url('https://packages.pointbeing.net/plunit_assert/plunit_assert-0.1 .0.tgz')]).
26+ ?- pack_install(plunit_assert, [url('https://packages.pointbeing.net/plunit_assert/plunit_assert-0.2 .0.tgz')]).
2727```
2828
29- Once the library is at a more stable release there is a plan to make it discoverable (see [ #15 ] ( ../../issues/15 ) ).
29+ Once at version 1.0.0, plunit_assert will be published and discoverable via ` pack_list/1 ` .
30+
31+ ## Examples
32+ ```
33+ ?- assert_type(3.0, boolean).
34+ [plunit_assert] Asserted 3.0 is of type 'boolean' but got 'float'
35+ false.
36+ ```
3037
38+ ```
39+ ?- assert_equals(3+1, 4).
40+ true.
41+
42+ ?- assert_is(3+1, 4).
43+ [plunit_assert] Asserted identity but 3+1 and 4 are not identical
44+ false.
45+ ```
46+
47+ ```
48+ ?- assert_lte(3^7, 6+9.6).
49+ [plunit_assert] Comparison failed: 3^7 (2187) is not less than or equal to 6+9.6 (15.6)
50+ false.
51+ ```
3152
3253
3354
You can’t perform that action at this time.
0 commit comments