Testing.3kaya

Langue: en

Autres versions - même langue

Version: May 2010 (fedora - 01/12/10)

Section: 3 (Bibliothèques de fonctions)

NAME

Testing - Unit testing support library

DESCRIPTION

This module contains functions for development of unit testing libraries. Tests are defined with Testing.add(3kaya) , and then the test set is run with Testing.run(3kaya)


 program test;
 
 Bool predicate(Int a) = (a%2 == 0);
 
 Void() test1() {
     xs = randomIntArray(10,1000);
     ys = filter(predicate,xs);
     assert(all(predicate,ys));
 }
 
 Void main() {
     init();
     add(@test1,10,"Filtering");
     run();
 }

Note that random values in this module are generated using Builtins.rand(3kaya) , a generator with high speed but poor quality. For higher quality random values, consider using Lfrand(3kaya) or another generator. For most testing, this will not be important.

DATA TYPES

Testing.Arbitrary(3kaya)

FUNCTIONS

Testing.add(3kaya)

Testing.init(3kaya)

Testing.randomArray(3kaya)

Testing.randomChar(3kaya)

Testing.randomCharArray(3kaya)

Testing.randomFloat(3kaya)

Testing.randomFloatArray(3kaya)

Testing.randomInt(3kaya)

Testing.randomIntArray(3kaya)

Testing.randomNegativeFloat(3kaya)

Testing.randomNegativeInt(3kaya)

Testing.randomPositiveFloat(3kaya)

Testing.randomPositiveInt(3kaya)

Testing.randomSignOfInt(3kaya)

Testing.randomString(3kaya)

Testing.randomStringArray(3kaya)

Testing.randomValue(3kaya)

Testing.run(3kaya)

AUTHORS

Kaya standard library by Edwin Brady, Chris Morris and others (kaya@kayalang.org). For further information see http://kayalang.org/

LICENSE

The Kaya standard library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License (version 2.1 or any later version) as published by the Free Software Foundation.