exercism / exercism/prolog

non-exhaustive tests

Aperta
#81 6 commenti 0 reazioni 0 assegnatari Vedi su GitHub
bug help wanted
Lingua principale
Prolog
Stelle
34
Fork
46
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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:

```Prolog
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]
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:

- [x] anagram
- [x] binary
- [X] complex-numbers
- [x] grains
- [x] hamming
- [x] nucleotide-count
- [x] pascals-triangle
- [x] rna-transcription
- [x] spiral-matrix
- [x] 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.

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.