这些是在chess.pl中定义的
:- dynamic drop/1.
:- dynamic start/1.
a_drop(X) :- piese(X), piese_pos(X, Y), \+ on(Y), assertz(drop(X)).
a_pickup(X) :- retract(drop(_-_-X)).
a_clear:- retract(drop(_)).
print_drops:- forall(drop(X), write(X)).
on(X) :- once(drop(_-_-X)).
off(X) :- \+ drop(_-_-X).我有一个测试文件:
:- begin_tests(chess).
:- include(chess).
clear_board :- a_clear.
board_1_setup :- a_drop(b-r-(b-6)), a_drop(w-k-(d-5)), a_drop(w-b-(c-4)), a_drop(b-b-(b-3)).
test(hello, [
setup(board_1_setup),
cleanup(clear_board)
]) :- on(b-4).
:- end_tests(chess).当我运行以下命令时:swipl -g run_tests -t halt _chess.plt
这是输出。
% PL-Unit: chess
ERROR:
[[ EXCEPTION while printing message url('/home/eguneys/chess/pro/_chess.plt':10)
with arguments []:
raised: type_error(text,url('/home/eguneys/chess/pro/_chess.plt':10))
]]
:
test hello: failed
done
% 1 test failed
% 0 tests passed
ERROR: -g run_tests: false我原以为测试会失败,但是带着一条更友好的信息,这个错误垃圾是什么?
请帮帮忙。
测试通过了正常测试,例如:... :- on(b-6).
发布于 2022-10-13 20:55:24
这似乎在开发版本(ppa:swi-prolog/devel)中得到了修正。
在您的测试文件中似乎遗漏了一些输入或内容:
$ swipl -g run_tests -t halt chess.plt
% PL-Unit: chess
ERROR: /tmp/chess.plt:9:
error in setup: plunit_chess:a_drop/1: Unknown procedure: plunit_chess:piese/1
done
% No tests to runhttps://stackoverflow.com/questions/72355363
复制相似问题