User Tools

Site Tools


tests:prolog

Tests: Prolog interface

  • Delete file lib/plugins/loki/temp/loki/tests/prolog.txt before tests
  • Tests are performed manually - you have to compare if sections “Expected result” and “Actual result” represent the same thing!

Simple goal

Description: Simple Prolog goal for knowledge saved inside <pl></pl> tag. Note that knowledge is not saved in cache!

Code:

<pl goal="woman(X),write(X),nl,fail">
woman(kate).
man(john).
</pl>

Expected result:

kate

Actual result:

kate

Goal and scope

Description: Knowledge saved (cache=“true”) inside one <pl></pl> tag and used inside other <pl></pl> tag with specified scope.

Code:

<pl cache="true">
man(jack).
man(jim).
</pl>
 
<pl goal="man(X),write(X),nl,fail" scope="tests:prolog">
</pl>

Expected result:

jack
jim

Note that john should not appear because this fact should not be saved in cache! (it is from previous test)

Actual result:

jack
jim

Predicates

Description: List all predicates in specified scope.

Code:

<pl goal="consult('lib/plugins/loki/loki.pl'),wikiconsult('tests/prolog'),list.">
%
</pl>

Expected result:

The list similar to the one shown below. It must contain predicates: man, wiki_header.

absolute_file_name
atom_concat
->atomic_list_concat
;atomic_list_concat
expand_answer
expand_file_name
expand_query
file_search_path
library_directory
link_xpce:pcehome_
man
'$member'
'$pack':pack_dir
prolog_file_type
system:current_prolog_flag
'$toplevel':catch
toplevel_variables:expand_answer
toplevel_variables:expand_query
wiki_header

Actual result:


'$member'
'$no-null-bytes'
'$pack':pack_dir
'$toplevel':catch
->atomic_list_concat
;atomic_list_concat
absolute_file_name
atom_concat
expand_answer
expand_file_name
expand_query
file_search_path
library_directory
link_xpce:pcehome_
man
prolog_file_type
system:current_prolog_flag
toplevel_variables:expand_answer
toplevel_variables:expand_query
wiki_header


Description: Show info about specified predicate in specified scope.

Code:

<pl goal="consult('lib/plugins/loki/loki.pl'),wikiconsult('tests/prolog'),list(man).">
%
</pl>

Expected result:

man(jack).
man(jim).

Actual result:

man(jack).
man(jim).

Errors

Description: Error messages for Prolog code

Code:

<pl goal="invalid_goal" scope="*" msgerr="display"></pl>

Expected result:

Errors list that contains (probably at the end):

ERROR: Prolog initialisation failed:
ERROR: ignore/1: Undefined procedure: invalid_goal/0

Actual result:



tests/prolog.txt · Last modified: 2017/09/19 16:31 (external edit)