{addToSum(X)}. /*~ ~*/ do_and_undo(addToSum(X), subFromSum(X)). /*~ ~*/ addToSum(X) :- retract(sum(S)), !, NewS is X+S, assert(sum(NewS)). /*~ ~*/ addToSum(X) :- assert(sum(X)). /*~ ~*/ subFromSum(X) :- retract(sum(S)), NewS is S-X, assert(sum(NewS)), !. /*~ ~*/ subFromSum(X) :- format('~n I can''t find a sum to subtract ~w from.',[X]). % FACTS /*~ ~*/ % FACTS value(1). /*~ %~ debugm(pfc_lib,show_success(pfc_lib,pfc_lib:action_is_undoable(addToSum(1)))) ~*/ value(2). /*~ %~ /var/lib/jenkins/workspace/logicmoo_workspace/packs_sys/pfc/t/sanity_base/undo_01b.pfc:38 %~ debugm(pfc_lib,show_success(pfc_lib,pfc_lib:action_is_undoable(addToSum(2)))) ~*/ value(3). % TEST RESULTS /*~ %~ debugm(pfc_lib,show_success(pfc_lib,pfc_lib:action_is_undoable(addToSum(3)))) ~*/ % TEST RESULTS :- mpred_test(sum(6)). % TEST REMOVAL HIT /*~ %~ ?-( mpred_test("Test_0001_Line_0000__sum_6_in_user",user:sum(6))). passed=info(why_was_true(user:sum(6))) no_proof_for(sum(6)). no_proof_for(sum(6)). no_proof_for(sum(6)). name='logicmoo.pfc.test.sanity_base.UNDO_01B-Test_0001_Line_0000__sum_6_in_user'. JUNIT_CLASSNAME='logicmoo.pfc.test.sanity_base.UNDO_01B'. JUNIT_CMD='timeout --foreground --preserve-status -s SIGKILL -k 10s 10s swipl -x /var/lib/jenkins/workspace/logicmoo_workspace/bin/lmoo-clif -t "[\'undo_01b.pfc\']"'. % saving_junit: /var/lib/jenkins/workspace/logicmoo_workspace/test_results/jenkins/Report-logicmoo-pfc-test-sanity_base-vSTARv0vSTARvvDOTvvSTARv-2-1--grep-2-i-WARN-ERROR-_file-00-fail-pass--Units-Logicmoo_pfc_test_sanity_base_UNDO_01B_Test_0001_Line_0000_sum_6_in_user-junit.xml ~*/ % TEST REMOVAL HIT \+ value(2). /*~ %~ /var/lib/jenkins/workspace/logicmoo_workspace/packs_sys/pfc/t/sanity_base/undo_01b.pfc:46 %~ debugm( baseKB, %~ show_success( baseKB, %~ baseKB : mpred_withdraw( value(2), %~ ( mfl4(User,user,'* https://logicmoo.org:2082/gitlab/logicmoo/logicmoo_workspace/-/edit/master/packs_sys/pfc/t/sanity_base/undo_01b.pfc ',46) , %~ ax)))) ~*/ :- mpred_test(sum(4)). % TEST REMOVAL MISS /*~ %~ ?-( mpred_test("Test_0002_Line_0000__sum_4_in_user",user:sum(4))). failure=info((why_was_true(user:(\+sum(4))),nop(ftrace(user:sum(4))))) no_proof_for(\+sum(4)). no_proof_for(\+sum(4)). no_proof_for(\+sum(4)). name='logicmoo.pfc.test.sanity_base.UNDO_01B-Test_0002_Line_0000__sum_4_in_user'. JUNIT_CLASSNAME='logicmoo.pfc.t goal=user:sum(4). time=0.0004611015319824219. failure=failure=info((why_was_true(user:(\+sum(4))),nop(ftrace(user:sum(4))))) no_proof_for(\+sum(4)). no_proof_for(\+sum(4)). no_proof_for(\+sum(4)). result=failure. ]]>