interpl

Experiments with intepreters in Prolog
git clone https://ccx.te2000.cz/git/interpl
Log | Files | Refs | README

commit 7ee0be1481073b9c3e490ddf8a51db6c75dcdb84
parent d8d881a4f32ea30e4893ffecc45820b93ef3553f
Author: Jan Pobrislo <ccx@te2000.cz>
Date:   Fri, 30 May 2025 18:51:34 +0000

More tests for eval

Diffstat:
MREADME | 2++
Mtests.pl | 11+++++++++++
2 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/README b/README @@ -1,2 +1,4 @@ 1. Install swi-prolog 2. `make tests` +3. ??? +4. Errors! diff --git a/tests.pl b/tests.pl @@ -100,6 +100,14 @@ test_eval(Call, ExpectedResult) :- interp_eval(Call, Result, Env, _), assertion(Result =@= ExpectedResult). +eval_example(`(car (cdr quote(((b) (x y) ((c))))))`, `(x y)`). +eval_example(`(cdr (cdr quote(((b) (x y) ((c))))))`, `(((c)))`). + +eval_example_decoded(Call, ExpectedResult) :- + eval_example(CallCodes, ResultCodes), + decode(CallCodes, Call), + decode(ResultCodes, ExpectedResult). + test(eval_quote) :- test_eval({|sexp||(quote a)|}, a). @@ -111,4 +119,7 @@ test(eval_apply_example, [forall(apply_example(Func, Args, ExpectedResult))]) :- Call = [Func|QArgs], test_eval(Call, ExpectedResult). +test(eval_example, [forall(eval_example_decoded(Call, ExpectedResult))]) :- + test_eval(Call, ExpectedResult). + :- end_tests(eval).