some tests
This commit is contained in:
parent
1c5b6c3687
commit
bc53e8bae9
18
regression/modules/meta.yap
Normal file
18
regression/modules/meta.yap
Normal file
@ -0,0 +1,18 @@
|
||||
|
||||
% :- library(test).
|
||||
|
||||
%:- multifile ytest:test/4.
|
||||
|
||||
:- source.
|
||||
|
||||
:- [library(ytest)].
|
||||
:- [library(ytest/preds)].
|
||||
|
||||
meta_expand(InputCl, C1) :-
|
||||
source_module(SM),
|
||||
'$yap_strip_module'(SM:InputCl, M, ICl),
|
||||
'$expand_a_clause'( M:ICl, SM, C1, _CO).
|
||||
|
||||
:- [meta_tests].
|
||||
|
||||
:- run_tests.
|
38
regression/modules/runmeta.yap
Normal file
38
regression/modules/runmeta.yap
Normal file
@ -0,0 +1,38 @@
|
||||
|
||||
:- source.
|
||||
|
||||
:- [library(ytest)].
|
||||
:- [library(hacks)].
|
||||
|
||||
:- [meta_tests].
|
||||
|
||||
meta_expand( Clause, Canon) :-
|
||||
source_module(M),
|
||||
indicator( M:Clause, I, _J),
|
||||
dynamic( I ),
|
||||
assert(Clause, R),
|
||||
clause(J, B, R),
|
||||
fully_strip_module(J, MH, H),
|
||||
( MH == M
|
||||
->
|
||||
HF = H
|
||||
;
|
||||
HF = MH:H
|
||||
),
|
||||
( B == true
|
||||
->
|
||||
Canon = HF
|
||||
;
|
||||
Canon = ( HF :- B )
|
||||
),
|
||||
erase(R).
|
||||
|
||||
indicator(MC, HM:N/A, HM:G0) :-
|
||||
fully_strip_module(MC, M, C),
|
||||
( C = ( H:- _) -> true ; C = H),
|
||||
fully_strip_module(M:H, HM, HF),
|
||||
functor(HF, N, A),
|
||||
functor(G0, N, A).
|
||||
|
||||
|
||||
:- initialization run_tests.
|
Reference in New Issue
Block a user