Prolog Coding Guidelines: Difference between revisions

(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…')
 
No edit summary
Line 1: Line 1:
 
= Module Information =
* Module Information


Every module should be annotated with module information.
Every module should be annotated with module information.
Line 23: Line 22:
This is important for the coverage report.
This is important for the coverage report.


* Unit Tests
= Unit Tests =


Unit tests should be setup using the self_check module.
Unit tests should be setup using the self_check module.

Revision as of 11:23, 17 November 2011

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.