Automating test generation

This library aims at facilitating test generation in a logic program, namely when interfacing to foreign code.

It introduces the following specs:

  • Named Arguments: you can refer to an argument through a name. This allows having optional arguments. As an example, you can say:

maxlength=MaxLength

and the original program is extended to support an optional parameter Length, eg:

vector( Type, Length, V ) :- alloc( Type, Length, MaxLength, V )

will become

vector( Type, Length, V, MaxLength ) :- alloc( Type, Length, MaxLength, V )

  • Tests

You can write type tests and ISO-like tests offline.

  • Initializers

It allows default code for variables. In the previous code, the initializer MaxLength = 1024 would result in two clauses:

vector( Type, Length, V, MaxLength ) :- alloc( Type, Length, MaxLength, V ). vector( Type, Length, V ) :- alloc( Type, Length, 1024, V ).

See myddas.yap for a few examples.

author:
Vitor Santos Costa