update tests
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
:- module(tests_on_builtins, []).
|
||||||
|
|
||||||
:- use_module(library(lists)).
|
:- use_module(library(lists)).
|
||||||
:- use_module(library(non_iso)).
|
:- use_module(library(non_iso)).
|
||||||
|
|||||||
54
src/tests/call_with_inference_limit.pl
Normal file
54
src/tests/call_with_inference_limit.pl
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
:- module(tests_on_call_with_inference_limit, []).
|
||||||
|
|
||||||
|
:- use_module(library(lists)).
|
||||||
|
:- use_module(library(non_iso)).
|
||||||
|
|
||||||
|
:- dynamic(f/1).
|
||||||
|
:- dynamic(g/1).
|
||||||
|
|
||||||
|
test_queries_on_call_with_inference_limit :-
|
||||||
|
catch(call_with_inference_limit(throw(error), 0, inference_limit_exceeded),
|
||||||
|
error,
|
||||||
|
true),
|
||||||
|
catch(call_with_inference_limit(throw(error), 1, inference_limit_exceeded),
|
||||||
|
error,
|
||||||
|
true),
|
||||||
|
\+ call_with_inference_limit(g(X), 5, R),
|
||||||
|
maplist(assertz, [g(1), g(2), g(3), g(4), g(5)]),
|
||||||
|
findall([R,X],
|
||||||
|
call_with_inference_limit(g(X), 10, R),
|
||||||
|
[[true, 1],
|
||||||
|
[true, 2],
|
||||||
|
[true, 3],
|
||||||
|
[true, 4],
|
||||||
|
[!, 5]]),
|
||||||
|
findall([R,X],
|
||||||
|
(call_with_inference_limit(g(X), 10, R), call(true)),
|
||||||
|
[[true, 1],
|
||||||
|
[true, 2],
|
||||||
|
[true, 3],
|
||||||
|
[true, 4],
|
||||||
|
[!, 5]]),
|
||||||
|
findall([R,X],
|
||||||
|
(call_with_inference_limit(g(X), 4, R), call(true)),
|
||||||
|
[[true, 1],
|
||||||
|
[true, 2],
|
||||||
|
[inference_limit_exceeded, _]]),
|
||||||
|
findall([X,R1,R2],
|
||||||
|
(call_with_inference_limit(g(X), 4, R1),
|
||||||
|
call_with_inference_limit(g(X), 5, R2)),
|
||||||
|
[[1,true,!],
|
||||||
|
[2,true,!],
|
||||||
|
[3,true,!],
|
||||||
|
[4,true,!],
|
||||||
|
[5,!,!]]),
|
||||||
|
\+ \+ assertz((f(X) :- call_with_inference_limit(g(X), 8, _))),
|
||||||
|
findall([R,X],
|
||||||
|
call_with_inference_limit(f(X), 12, R),
|
||||||
|
[[true,1],
|
||||||
|
[true,2],
|
||||||
|
[true,3],
|
||||||
|
[true,4],
|
||||||
|
[!,5]]).
|
||||||
|
|
||||||
|
:- initialization(test_queries_on_call_with_inference_limit).
|
||||||
@@ -1,3 +1,5 @@
|
|||||||
|
:- module(tests_on_facts, []).
|
||||||
|
|
||||||
:- dynamic(p/2).
|
:- dynamic(p/2).
|
||||||
:- dynamic(p/3).
|
:- dynamic(p/3).
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
:- module(test_on_predicates, []).
|
||||||
|
|
||||||
:- dynamic(p/2).
|
:- dynamic(p/2).
|
||||||
:- dynamic(p/3).
|
:- dynamic(p/3).
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
:- module(tests_on_rules, []).
|
||||||
|
|
||||||
:- dynamic(p/3).
|
:- dynamic(p/3).
|
||||||
:- dynamic(p/2).
|
:- dynamic(p/2).
|
||||||
:- dynamic(q/2).
|
:- dynamic(q/2).
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
:- module(test_on_setup_call_cleanup, []).
|
||||||
|
|
||||||
:- use_module(library(non_iso)).
|
:- use_module(library(non_iso)).
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user