exercism / exercism/prolog

non-exhaustive tests

Ouverte
#81 6 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
bug help wanted
Langage dominant
Prolog
Étoiles
34
Forks
46
Métriques de merge des PR
Aucune PR mergée en 30 j

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:

```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.

Guide de contribution

Aucun guide de contribution indexé pour ce dépôt

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.