|all_ok CODE PARAMETERS, [ TEST_NAME ]||See the general comments.|
|all_are CODE VALUE, PARAMETERS, [ TEST_NAME ]||The equivalent to Test::Mores is method. The given subroutine has to return always the given value. They are compared with eq.|
|all_arent CODE VALUE, PARAMETERS, [ TEST_NAME ]||The equivalent to Test::Mores isnt method. The given subroutine has to return always values different from the given one. They are compared with eq.|
|any_ok CODE PARAMETERS, [ TEST_NAME ]||Returns whether the subroutine returns true for one of the given parameters.|
|any_is CODE VALUE, PARAMETERS, [ TEST_NAME ]||Returns whether there is at least one parameter (combination) for that the given subroutine results the specified value.|
|any_isnt CODE VALUE, PARAMETERS, [ TEST_NAME ]||Returns whether there is at least one parameter (combination) for that the given subroutine results to a value different to the specified one.|
|most_ok CODE PARAMETERS => NR_OF_TESTS [, TEST_NAME]||
Tests NR_OF_TESTS (randomly choosen) parameter (combinations)
of the given parameters. All the (randomly choosen) parameters
have to let the subroutine results to true.
This method is intended to used, when a full test would need to long and you want to avoid systematic mistakes.
There could be some parameter (combinations), that are tested twice or more often.
In the most cases, you will simply import this module (use Test::ManyParams).
But when you want to set the seed for the randomization of the most_ok method, the way for importing looks like use Test::ManyParams seed = 42>.
At the time, it only will call srand(42), but later on, it will hold foreach test script and file its own random numbers, so that several modules all using this Test::ManyParams module wont collide.
If you dont seet a seed value, at default the time ^ $$ value will be taken as seed (the default value could be changed in future versions without any notice). Thats not a very good seed, but I hope it will be good and quick enough for the most cases.
You can access the setted seed with the variable $Test::ManyParams::seed. Thats a non-exported, readonly variable.
Please take care only to import Test::ManyParams one times in one package, as the use command is executed while compile time and so different seedings will be confusing.
all_ok all_are all_arent any_is any_isnt most_ok
The representation of the parameters uses Data::Dumper. As this module neither set $Data::Dumper::Indent, nor reads it out, setting $Data::Dumper::Indent to some strange values can destroy a useful parameter outprint. I dont plan to fix this behaviour in the next time, as I there a more important things to do. (Who changes global variables harvest what he/she/it has seed.)
The most_ok method is hard to test. I wrote some tests that helped to remove the obviously bugs, but there could be some subtle bugs. Especially I didnt test what happens, if you try to test more parameters than there could be.
There are perhaps many mistakes in this documentation.
Please tell me everything you can find.
There are a lot of methods Id like to implement still. The most of them are simple Heres a list of them:
Similar methods are planned with the prefix any_.
all_are_deeply CODE SCALAR, PARAMETERS, [ TEST_NAME ] all_like CODE REGEXP, PARAMETERS, [ TEST_NAME ] all_unlike CODE REGEXP, PARAMETERS, [ TEST_NAME ] all_can CODE REGEXP, PARAMETERS, [ TEST_NAME ] all_dies_ok CODE PARAMETERS, [TEST_NAME] all_lives_ok CODE PARAMETERS, [TEST_NAME] all_throws_ok CODE REGEXP, PARAMETERS, [TEST_NAME]
The most_ok method should accept also a percentage rate and a time slot or ... for specification of how many tests should be run. Typical examples for that could be 1000, 1%, 5s, 100 + bounds.
The pro and contra of had been discussed a bit on perl.qa. One of the results is that random parameter tests are very sensful, but the reproducibility is very important. So the module has to seed (or recognise the seed) of the random generator and to give the possibility to set them (e.g. with use Test::ManyParams seed = 42>). Recognising a failed test, this seed has to be printed. It always seems to be sensful to set an own random numbering for each package using this module. The last part still has to be done.
Thats only a short synopsis of this discussion, it will be better explained when these features are built in.
Of course, there will be also some methods like most_are,most_arent,... .
This module had been and will be discussed on perl.qa.
Thanks to Nicholas Clark and to Tels (http://www.bloodgate.com) for giving a lot of constructive ideas.
Janek Schleicher, <email@example.com>
Copyright 2002 by Janek Schleicher
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
|perl v5.20.3||MANYPARAMS (3)||2003-05-13|