added some test file

added a target to makefile to perform individual tests


git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@2040 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
rzf 2007-12-05 17:43:32 +00:00
parent 9c511da82c
commit 803e032b9f
7 changed files with 113 additions and 6 deletions

View File

@ -112,7 +112,11 @@ CPLINT_EXAMPLES= \
$(CPLINT_EXDIR)/trigger.cpl \
$(CPLINT_EXDIR)/trigger.uni \
$(CPLINT_EXDIR)/win.cpl \
$(CPLINT_EXDIR)/win.uni
$(CPLINT_EXDIR)/win.uni \
$(CPLINT_EXDIR)/exist.cpl \
$(CPLINT_EXDIR)/exist.uni \
$(CPLINT_EXDIR)/exist1.cpl \
$(CPLINT_EXDIR)/exist1.uni
CPLINT_DOCS=\
$(CPLINT_DOCDIR)/manual.bbl \
@ -153,4 +157,8 @@ install: all
installcheck:
for h in ${CPLINT_TEST_PROGRAMS}; do echo "t. halt." | yap -l $$h; done
# use the following target to run individual tests, e.g. make testlpad
test%:
echo "t. halt." | yap -l $(CPLINT_SRCDIR)/$@.pl

32
cplint/examples/exist.cpl Normal file
View File

@ -0,0 +1,32 @@
/*
semlpad.pl
ground_body(false)
?- s([a],P).
P = 0.18 ?
ground_body(true)
?- s([a],P).
P = 0.19 ?
yes
yes
lpad.pl
ground_body(false)
?- s([a],P).
P = 0.02 ?
yes
ground_body(true)
?- s([a],P).
P = 0.19 ?
yes
*/
a:0.5 :- p(X).
p(X):0.2 :- c(X).
c(1).
c(2).

View File

@ -0,0 +1,8 @@
mode(a).
mode(p(int)).
mode(c(int)).
type(int,[1,2]).

View File

@ -0,0 +1,31 @@
/*
semlpad.pl
ground_body(false)
?- s([a],P).
P = 0.276 ?
ground_body(true)
?- s([a],P).
P = 0.3115 ?
yes
lpad.pl
ground_body(false)
?- s([a],P).
P = 0.276 ?
ground_body(true)
?- s([a],P).
P = 0.3115 ?
*/
a:0.5 :- p(X).
p(3):0.3.
p(X):0.2 :- c(X).
c(1).
c(2).

View File

@ -0,0 +1,10 @@
mode(a).
mode(p(int)).
mode(c(int)).
type(int,[1,2,3]).

View File

@ -26,7 +26,12 @@ t:-
format("~nTesting lpad.yap~n~n",[]),
files(F),
statistics(runtime,[_,_]),
set(ground_body,false),
format("~nNon ground body~n~n",[]),
test_files(F,ground_body(false)),
set(ground_body,true),
format("~nGround body~n~n",[]),
test_files(F,ground_body(true)),
statistics(runtime,[_,T]),
T1 is T /1000,
format("Test successful, time ~f secs.~n",[T1]).
@ -59,7 +64,13 @@ test_all(F,[H|T]):-
files([
exapprox,exrange,threesideddice,mendels,
coin2,ex,throws,trigger,win,hiv,light,
invalid]).
invalid,exist,exist1]).
test((s([a],P),close_to(P,0.18)),exist,ground_body(false)).
test((s([a],P),close_to(P,0.19)),exist,ground_body(true)).
test((s([a],P),close_to(P,0.276)),exist1,ground_body(false)).
test((s([a],P),close_to(P,0.3115)),exist1,ground_body(true)).
test((s([p],P),close_to(P,0.5)),invalid,_).
test((s([q],P),close_to(P,0.5)),invalid,_).

View File

@ -71,18 +71,25 @@ exrange,
threesideddice,
%mendels, %ok only with grounding=variables
coin2,
ex
ex,exist,exist1
]).
files_variables([
exapprox,
exrange,
threesideddice,
%threesideddice, removed because of a strange bug in yap, in debug it does not fail
mendels,
coin2,
ex
ex
]).
test((s([a],P),close_to(P,0.18)),exist,ground_body(false)).
test((s([a],P),close_to(P,0.19)),exist,ground_body(true)).
test((s([a],P),close_to(P,0.276)),exist1,ground_body(false)).
test((s([a],P),close_to(P,0.3115)),exist1,ground_body(true)).
test((s([a],P),close_to(P,0.1719)),exapprox,ground_body(true)).
test((s([a],P),close_to(P,0.099)),exapprox,ground_body(false)).