{addToSum(X)}. /*~ ~*/ do_and_undo(addToSum(X), subFromSum(X)). % prologBuiltin(addToSum/1). /*~ ~*/ % prologBuiltin(addToSum/1). addToSum(X) :- retract(sum_01a(S)), !, NewS is X+S, assert(sum_01a(NewS)). /*~ ~*/ addToSum(X) :- assert(sum_01a(X)). /*~ ~*/ subFromSum(X) :- retract(sum_01a(S)), NewS is S-X, assert(sum_01a(NewS)), !. /*~ ~*/ subFromSum(X) :- format('~n I can''t find a sum to subtract ~w from.',[X]), listing(sum_01a/1). % FACTS /*~ ~*/ % FACTS value_01a(1). /*~ %~ debugm(pfc_lib,show_success(pfc_lib,pfc_lib:action_is_undoable(addToSum(1)))) ~*/ value_01a(2). /*~ %~ debugm(pfc_lib,show_success(pfc_lib,pfc_lib:action_is_undoable(addToSum(2)))) ~*/ value_01a(3). % TEST RESULTS /*~ %~ debugm(pfc_lib,show_success(pfc_lib,pfc_lib:action_is_undoable(addToSum(3)))) ~*/ % TEST RESULTS :- mpred_test(sum_01a(6)). % TEST REMOVAL HIT /*~ %~ ?-( mpred_test("Test_0001_Line_0000__sum_01a_6_in_user",user:sum_01a(6))). passed=info(why_was_true(user:sum_01a(6))) no_proof_for(sum_01a(6)). no_proof_for(sum_01a(6)). no_proof_for(sum_01a(6)). name='logicmoo.pfc.test.sanity_base.UNDO_02A-Test_0001_Line_0000__sum_01a_6_in_user'. JUNIT_CLASSNAME='logicmoo.pfc.test.sanity_base.UNDO_02A'. JUNIT_CMD='timeout --foreground --preserve-status -s SIGKILL -k 10s 10s swipl -x /var/lib/jenkins/workspace/logicmoo_workspace/bin/lmoo-clif -t "[\'undo_02a.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_02A_Test_0001_Line_0000_sum_01a_6_in_user-junit.xml ~*/ % TEST REMOVAL HIT \+ value_01a(2). % :- mpred_why(value_01a(2)). /*~ %~ debugm( baseKB, %~ show_success( baseKB, %~ baseKB : mpred_withdraw( value_01a(2), %~ ( mfl4(User,user,'* https://logicmoo.org:2082/gitlab/logicmoo/logicmoo_workspace/-/edit/master/packs_sys/pfc/t/sanity_base/undo_02a.pfc ',49) , %~ ax)))) ~*/ % :- mpred_why(value_01a(2)). :- mpred_test(sum_01a(4)). % TEST REMOVAL MISS /*~ %~ ?-( mpred_test("Test_0002_Line_0000__sum_01a_4_in_user",user:sum_01a(4))). failure=info((why_was_true(user:(\+sum_01a(4))),nop(ftrace(user:sum_01a(4))))) no_proof_for(\+sum_01a(4)). no_proof_for(\+sum_01a(4)). no_proof_for(\+sum_01a(4)). name='logicmoo.pfc.test.sani goal=user:sum_01a(4). time=0.000499725341796875. failure=failure=info((why_was_true(user:(\+sum_01a(4))),nop(ftrace(user:sum_01a(4))))) no_proof_for(\+sum_01a(4)). no_proof_for(\+sum_01a(4)). no_proof_for(\+sum_01a(4)). result=failure. ]]>