Ah, How to Do Unit Test for Multiple Results?

In my version of P-99 answers, see https://github.com/YauHsien/p99, some
predicate may be with issues that they were not found. For example, the
‘1.18’ defining slice/4 may have another results that they are not
expected, that is, some bug.

?- p99:slice([a,b,c,d,e,f,g,h,i,k],3,7,List).
List = [c, d, e, f, g, h, i] ;
List = [c, d, e, f, g, h, i, k] ;
List = [].

My simple unit test is a sequence of goals, each asserts that some input
definitely causes some output. A slice of [a,b,c,d,e,f,g,h,i,k] between 3rd
and 7th (including both should be [c,d,e,f,g,h,i]. In concept, a predicate
p99:slice/4 is acceptable if one of many cases of its output is definitely
correct, right? And then, my unit test simply show that it may get a right
answer in the multiverse of p99:slice/4.

By the way, I’m familiar with functional languages including Erlang, but I
do not figure out how  to assert all results of a goal in Prolog by unit
test, that everyone of results is correct answer, as well as, when some
results are not correct, it will alert in proper notations. And how to do
unit test on some predicate and show that there are three results for some
input, the first is correct, but others not?

本篇發表於 Prolog 並標籤為 。將永久鏈結加入書籤。