exercism / exercism/prolog

non-exhaustive tests

Offen
#81 6 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
bug help wanted
Vorherrschende Sprache
Prolog
Sterne
34
Forks
46
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

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.

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.