User Tools

Site Tools


Sidebar

Hello!

Start here!

Download

Loki Semantic Wiki

BiFröST Framework

Semantic Business Platform

BPWiki

SBVRwiki

Other Projects



tests:prolog
startSectionEdit: $data "section" is NOT an array! One of your plugins needs an update.
startSectionEdit: $data "section" is NOT an array! One of your plugins needs an update.
startSectionEdit: $data "section" is NOT an array! One of your plugins needs an update.
startSectionEdit: $data "section" is NOT an array! One of your plugins needs an update.
startSectionEdit: $data "section" is NOT an array! One of your plugins needs an update.

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'
'$pack':pack_dir
->atomic_list_concat
;atomic_list_concat
atom_concat
current_prolog_flag
file_search_path
library_directory
man
pcehome_
prolog_file_type
system:'$xdg_prolog_directory'
system:current_prolog_flag
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: 2022/03/23 16:59 (external edit)