1Testing(3kaya)               Kaya module reference              Testing(3kaya)
2
3
4

NAME

6       Testing - Unit testing support library
7

DESCRIPTION

9       This   module  contains  functions  for  development  of  unit  testing
10       libraries. Tests are defined with Testing.add (3kaya) ,  and  then  the
11       test set is run with Testing.run (3kaya)
12
13
14    program test;
15
16    Bool predicate(Int a) = (a%2 == 0);
17
18    Void() test1() {
19        xs = randomIntArray(10,1000);
20        ys = filter(predicate,xs);
21        assert(all(predicate,ys));
22    }
23
24    Void main() {
25        init();
26        add(@test1,10,"Filtering");
27        run();
28    }
29
30       Note   that   random   values   in  this  module  are  generated  using
31       Builtins.rand (3kaya) , a generator with high speed but  poor  quality.
32       For  higher  quality  random  values,  consider  using Lfrand(3kaya) or
33       another generator. For most testing, this will not be important.
34

DATA TYPES

36       Testing.Arbitrary (3kaya)

FUNCTIONS

38       Testing.add (3kaya)
39       Testing.init (3kaya)
40       Testing.randomArray (3kaya)
41       Testing.randomChar (3kaya)
42       Testing.randomCharArray (3kaya)
43       Testing.randomFloat (3kaya)
44       Testing.randomFloatArray (3kaya)
45       Testing.randomInt (3kaya)
46       Testing.randomIntArray (3kaya)
47       Testing.randomNegativeFloat (3kaya)
48       Testing.randomNegativeInt (3kaya)
49       Testing.randomPositiveFloat (3kaya)
50       Testing.randomPositiveInt (3kaya)
51       Testing.randomSignOfInt (3kaya)
52       Testing.randomString (3kaya)
53       Testing.randomStringArray (3kaya)
54       Testing.randomValue (3kaya)
55       Testing.run (3kaya)

AUTHORS

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

LICENSE

60       The  Kaya  standard  library  is free software; you can redistribute it
61       and/or modify it under the terms  of  the  GNU  Lesser  General  Public
62       License  (version  2.1  or  any later version) as published by the Free
63       Software Foundation.
64
65
66
67Kaya                             December 2010                  Testing(3kaya)
Impressum