plunit

SWI-Prolog - Unit testing library plunit - How is forall option used?

若如初见. 提交于 2019-12-24 00:24:23
问题 For my lexer (tokenizer) all of the ASCII 7-bit characters (0x00 to 0x7F) have a specific token. As SWI-Prolog supports Unicode, the character codes go from 0x0000 to 0xFFFF. In my lexer, since there are many characters that will not map to a specific token there is an unknown token (tokUnknown). To ensure that all of the characters with code between 0 and 127 (0x00 to 0x7F) do not have tokUnknown , test cases are needed. The test case needs a simple lexer to convert the character to a token.

What is a “Test succeeded with choicepoint” warning in PL-Unit, and how do I fix it?

淺唱寂寞╮ 提交于 2019-12-23 16:13:04
问题 I'm writing a prolog program to check if a variable is an integer . The way I'm "returning" the result is strange, but I don't think it's important for answering my question. The Tests I've written passing unit tests for this behaviour; here they are... foo_test.pl :- begin_tests('foo'). :- consult('foo'). test('that_1_is_recognised_as_int') :- count_ints(1, 1). test('that_atom_is_not_recognised_as_int') :- count_ints(arbitrary, 0). :- end_tests('foo'). :- run_tests. The Code And here's the