bug fices
This commit is contained in:
37
misc/tests
37
misc/tests
@@ -1,3 +1,34 @@
|
||||
current_predicate 2
|
||||
X Y _
|
||||
goal_expansion Y goal_expansion(_)
|
||||
|
||||
:- op(test, fx, 1200).
|
||||
|
||||
test_mode.
|
||||
|
||||
test( ( G :- Sols ) :-
|
||||
reset_sols,
|
||||
init_io( Streams ),
|
||||
catch( do_test(G, Sols), Done, handler( Done ) ).
|
||||
close_io( Streams ).
|
||||
|
||||
do_test(G0, Sols)
|
||||
copy_term(G0, G),
|
||||
catch( ( G, answer(G, Sol) ) , Error, test_error(Error, Sol) ),
|
||||
next_solution( I, Sol, G0, Sol ),
|
||||
!.
|
||||
do_test(G, Sols) :-
|
||||
counter(I),
|
||||
failure(G, Sols, I).
|
||||
|
||||
next_solution( I, Sol , G0, Sols ) :-
|
||||
inc(I),
|
||||
fetch(I, Sols, Pattern, Next),
|
||||
(
|
||||
Sol =@= Pattern
|
||||
->
|
||||
success(I, G0)
|
||||
;
|
||||
error(I, G0, Sol )
|
||||
),
|
||||
( var(Next) -> throw( done ) ).
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user