我遵循了这个问题How can I test a non-deterministic predicate in any order with PL-Unit?中提出的答案。
test(hello, [
setup(board_1_setup),
cleanup(clear_board),
Ys = [d-6, e-6, f-6, d-5, f-5, e-4, f-4]
]) :- setof(Y, any_turn_king_move(e-5, Y), Ys).
ERROR: /home/eguneys/chess/pro/_chess.plt:10:
test hello: wrong answer (compared using =)
ERROR: Expected: [d-6,e-6,f-6,d-5,f-5,e-4,f-4]
ERROR: Got: [d-5,d-6,e-4,e-6,f-4,f-5,f-6]如果我把他们安排得井井有条,测试就通过了。
为什么即使我把它们放在setof中,它仍然会检查订单。
发布于 2022-05-26 11:21:47
我在这个链接https://sicstus.sics.se/sicstus/docs/4.2.0/html/sicstus/PlUnit-A-Unit-Test-Box.html上试过一个片段。
而且起作用了。
如下所示:
test(king_move_safe, [
setup(board_1_setup),
cleanup(clear_board),
set(Y = [d-5, e-4, f-4, f-5])
]) :- king_move_safe(e-5, Y).我不知道这是怎么回事,如果有人能解释这是怎么回事,我会接受这个答案。
https://stackoverflow.com/questions/72380292
复制相似问题