|Syntactic Confectionery Delight|
combinations of VARYING multiple arraysby Anonymous Monk
|on Nov 16, 2010 at 14:51 UTC||Need Help??|
Anonymous Monk has asked for the
wisdom of the Perl Monks concerning the following question:
Suppose I have a shell script which takes any combination of switches say -a -b -c -d -e (but these are mnemonic in practice) all of which take arguments. I want to test the script using various test arguments numbering p(a) thru p(e) e.g. if I have 2 test cases for switch -a then p(a) is 2. Although I also have say 1 "break it" test for option -a.
In fact I have 220 shell scripts to test whose allowed switches overlap, but if I can make just one test for one script then I can figure out later how to replicate the process.
So I would configure the first test using a hash like:
So how do I generate all combinations of switches, good cases and badcases?, bearing in mind that different options require different sets of cases (of differing cardinality) to test them.
I know I probably need something like Algorithm::Loops, but I can't fit the module to the particular requirement in my head because of the varying counts i.e. it's not the standard combination of multiple arrays situation published elsewhere on this site. There are additional issues such as managing conflicting option choices and generating test data that works for options in combination, but I have to start somewhere and this seems the most salient obstacle.
Thanks for any help!