Prolog Coding Guidelines

Revision as of 11:22, 17 November 2011 by Michael Leuschel (talk | contribs) (Created page with ' * Module Information Every module should be annotated with module information. This is used by our coverage analysis tool. <pre> :- module(MYMODULE, [ exported_predicate/arit…')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
  • Module Information

Every module should be annotated with module information. This is used by our coverage analysis tool.

:- module(MYMODULE, [  exported_predicate/arity, ... ]).

:- use_module(tools).

:- module_info(group,kernel).
:- module_info(description,'This module does wonderful things').
:- module_info(revision,'$Rev: 9558 $').
:- module_info(lastchanged,'$LastChangedDate: 2011-11-17 12:09:15 +0100 (Thu, 17 Nov 2011) $').

Afterwards run

  svn propset svn:keywords "Date Revision" MYMODULE.pl

so that svn can automatically update the revision and last changed information. This is important for the coverage report.

  • Unit Tests

Unit tests should be setup using the self_check module.

:- use_module(self_check).

Afterwards you can use the following to add new unit tests:

:- assert_must_succeed((bsets_clp:empty_sequence([]))).
:- assert_must_fail((bsets_clp:empty_sequence([int(1)]))).

These tests can be run manually from the ProB Tcl/Tk version, from the command-line using the -self_check command. They will also be automatically run on our jenkins server after committing.