From 803e032b9fead1d7b6a35400c542a1fab982c476 Mon Sep 17 00:00:00 2001 From: rzf Date: Wed, 5 Dec 2007 17:43:32 +0000 Subject: [PATCH] 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 --- cplint/Makefile.in | 12 ++++++++++-- cplint/examples/exist.cpl | 32 ++++++++++++++++++++++++++++++++ cplint/examples/exist.uni | 8 ++++++++ cplint/examples/exist1.cpl | 31 +++++++++++++++++++++++++++++++ cplint/examples/exist1.uni | 10 ++++++++++ cplint/testlpad.pl | 13 ++++++++++++- cplint/testsemlpad.pl | 13 ++++++++++--- 7 files changed, 113 insertions(+), 6 deletions(-) create mode 100644 cplint/examples/exist.cpl create mode 100644 cplint/examples/exist.uni create mode 100644 cplint/examples/exist1.cpl create mode 100644 cplint/examples/exist1.uni diff --git a/cplint/Makefile.in b/cplint/Makefile.in index 99207bbe5..d0eb0382f 100644 --- a/cplint/Makefile.in +++ b/cplint/Makefile.in @@ -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 + diff --git a/cplint/examples/exist.cpl b/cplint/examples/exist.cpl new file mode 100644 index 000000000..220564898 --- /dev/null +++ b/cplint/examples/exist.cpl @@ -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). diff --git a/cplint/examples/exist.uni b/cplint/examples/exist.uni new file mode 100644 index 000000000..95875b009 --- /dev/null +++ b/cplint/examples/exist.uni @@ -0,0 +1,8 @@ + +mode(a). + +mode(p(int)). + +mode(c(int)). + +type(int,[1,2]). diff --git a/cplint/examples/exist1.cpl b/cplint/examples/exist1.cpl new file mode 100644 index 000000000..22b194661 --- /dev/null +++ b/cplint/examples/exist1.cpl @@ -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). diff --git a/cplint/examples/exist1.uni b/cplint/examples/exist1.uni new file mode 100644 index 000000000..10413df56 --- /dev/null +++ b/cplint/examples/exist1.uni @@ -0,0 +1,10 @@ + +mode(a). + +mode(p(int)). + +mode(c(int)). + +type(int,[1,2,3]). + + diff --git a/cplint/testlpad.pl b/cplint/testlpad.pl index 071ebe19d..fc0ef8f5a 100644 --- a/cplint/testlpad.pl +++ b/cplint/testlpad.pl @@ -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,_). diff --git a/cplint/testsemlpad.pl b/cplint/testsemlpad.pl index a21171d75..eeb43d47d 100644 --- a/cplint/testsemlpad.pl +++ b/cplint/testsemlpad.pl @@ -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)).