Open
Description
As explained here #80 there is a way to write tests that is not exhaustive enough. As an example, if we have a simple program like:
add(X,Y,Z) :-
Z >= X+Y.
A test like:
?- add(1,2,3).
true.
succeeds. When is obviously not correct. nevertheless if we do this:
?- add(1,2,X).
ERROR: Arguments are not sufficiently instantiated
ERROR: In:
ERROR: [9] _2658>=1+2
ERROR: [7] <user>
ERROR:
ERROR: Note: some frames are missing due to last-call optimization.
ERROR: Re-run your program in debug mode (:- debug.) to get more detail.
throws an error. In this case, this predicate should be tested like so add(1,2,X), x =:= 3
.
This is a particular characteristic of Prolog, and that is why is particularly confusing.
This are all tests that have this flaw:
- anagram
- binary
- complex-numbers
- grains
- hamming
- nucleotide-count
- pascals-triangle
- rna-transcription
- spiral-matrix
- sum-of-multiples
- triangle
If you submit a PR to fix one of them, please refer to this issue. And if you find another exercise with this problem add a comment here.