From: Mark Thom Date: Wed, 9 Mar 2022 05:05:54 +0000 (-0700) Subject: print variables instead of offsets in setup_call_cleanup tests X-Git-Tag: v0.9.1~118 X-Git-Url: https://git.sagredo.dev/?a=commitdiff_plain;h=d83b32a200cf443e7ef47fd8f33695cf92c347dd;p=scryer-prolog.git print variables instead of offsets in setup_call_cleanup tests --- diff --git a/src/tests/setup_call_cleanup.pl b/src/tests/setup_call_cleanup.pl index 331f50f4..f15de65f 100644 --- a/src/tests/setup_call_cleanup.pl +++ b/src/tests/setup_call_cleanup.pl @@ -12,15 +12,15 @@ test_queries_on_setup_call_cleanup :- catch(setup_call_cleanup(X=throw(ex), true, X), ex, true), findall([S,G,C], setup_call_cleanup(S = 1, G = 2, C = 3), [[1,2,3]]), findall([S,G,C], setup_call_cleanup((S=1;S=2), G=3, C=4), [[1,3,4]]), - findall([S,G], setup_call_cleanup(S=1, G=2, writeq(S+G)), [[1,2]]), - findall([S,G], setup_call_cleanup(S=1, (G=2;G=3), writeq(S+G)), [[1,2],[1,3]]), - findall([S,G], (setup_call_cleanup(S=1, G=2, writeq(S+G>A+B)), A = 3, B = 4), [[1,2]]), - findall([S,G,E], catch(setup_call_cleanup(S=1, (G=2;G=3,throw(x)), writeq(S+G)), E, true), [[1,2,_],[_,_,x]]), - findall([S,B,G], (setup_call_cleanup(S=1, (G=2;G=3),writeq(S+G>B)), B=4, !), [[1,4,2]]), - findall([S,G,B], (setup_call_cleanup(S=1,G=2,writeq(S+G>B)),B=3,!), [[1,2,3]]), - findall([S,G,B], (setup_call_cleanup(S=1,(G=2;false),writeq(S+G>B)),B=3,!), [[1,2,3]]), - findall([S,G,B], (setup_call_cleanup(S=1,(G=2;S=2),writeq(S+G>B)), B=3, !), [[1,2,3]]), - catch((setup_call_cleanup(S=1,(G=2;G=3), writeq(S+G>B)), B=4, !, throw(x)), x, true), + findall([S,G], setup_call_cleanup(S=1, G=2, write_term(S+G, [variable_names(['S'=S,'G'=G])])), [[1,2]]), + findall([S,G], setup_call_cleanup(S=1, (G=2;G=3), write_term(S+G, [variable_names(['S'=S,'G'=G])])), [[1,2],[1,3]]), + findall([S,G], (setup_call_cleanup(S=1, G=2, write_term(S+G>A+B, [variable_names(['S'=S,'G'=G,'A'=A,'B'=B])])), A = 3, B = 4), [[1,2]]), + findall([S,G,E], catch(setup_call_cleanup(S=1, (G=2;G=3,throw(x)), write_term(S+G, [variable_names(['S'=S,'G'=G])])), E, true), [[1,2,_],[_,_,x]]), + findall([S,B,G], (setup_call_cleanup(S=1, (G=2;G=3),write_term(S+G>B, [variable_names(['S'=S,'G'=G,'B'=B])])), B=4, !), [[1,4,2]]), + findall([S,G,B], (setup_call_cleanup(S=1,G=2,write_term(S+G>B, [variable_names(['S'=S,'G'=G,'B'=B])])),B=3,!), [[1,2,3]]), + findall([S,G,B], (setup_call_cleanup(S=1,(G=2;false),write_term(S+G>B, [variable_names(['S'=S,'G'=G,'B'=B])])),B=3,!), [[1,2,3]]), + findall([S,G,B], (setup_call_cleanup(S=1,(G=2;S=2),write_term(S+G>B, [variable_names(['S'=S,'G'=G,'B'=B])])), B=3, !), [[1,2,3]]), + catch((setup_call_cleanup(S=1,(G=2;G=3), write_term(S+G>B, [variable_names(['S'=S,'G'=G,'B'=B])])), B=4, !, throw(x)), x, true), findall(Pat, catch(setup_call_cleanup(true,throw(goal),throw(cl)), Pat, true), [goal]), findall(Pat, catch(( setup_call_cleanup(true,(G=1;G=2),throw(cl)), throw(cont)), Pat, true), [cont]), findall([X,Y], (setup_call_cleanup(true, (X=1;X=2), writeq(a)), setup_call_cleanup(true,(Y=1;Y=2),writeq(b)), !), [[1,1]]). diff --git a/tests/scryer/src_tests.rs b/tests/scryer/src_tests.rs index b0b9efb5..2b6adbd5 100644 --- a/tests/scryer/src_tests.rs +++ b/tests/scryer/src_tests.rs @@ -51,7 +51,7 @@ fn rules() { fn setup_call_cleanup_load() { load_module_test( "src/tests/setup_call_cleanup.pl", - "1+21+31+2>_17737+_177381+_158071+2>41+2>_177381+2>31+2>31+2>4ba" + "1+21+31+2>A+B1+G1+2>41+2>B1+2>31+2>31+2>4ba", ); } @@ -60,7 +60,7 @@ fn setup_call_cleanup_process() { run_top_level_test_with_args( &["src/tests/setup_call_cleanup.pl", "-f", "-g", "halt"], "", - "1+21+31+2>_19590+_195911+_176601+2>41+2>_195911+2>31+2>31+2>4ba" + "1+21+31+2>A+B1+G1+2>41+2>B1+2>31+2>31+2>4ba", ); }