diff options
author | jluehrs2 <jluehrs2@uiuc.edu> | 2008-01-31 03:50:50 -0500 |
---|---|---|
committer | jluehrs2 <jluehrs2@uiuc.edu> | 2008-01-31 03:50:50 -0500 |
commit | 7b6e6c87bf10203dabaf007ad155fd29fd550989 (patch) | |
tree | 09dd45ad37afbfc1567ec3475d51938465748f3b /t/011-is-permutation.t | |
parent | 008781e2f4f073ccf2fdb1225d705f256b318449 (diff) | |
download | games-word-7b6e6c87bf10203dabaf007ad155fd29fd550989.tar.gz games-word-7b6e6c87bf10203dabaf007ad155fd29fd550989.zip |
add tests for random_permutation and is_permutation
Diffstat (limited to 't/011-is-permutation.t')
-rw-r--r-- | t/011-is-permutation.t | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/t/011-is-permutation.t b/t/011-is-permutation.t new file mode 100644 index 0000000..96e959a --- /dev/null +++ b/t/011-is-permutation.t @@ -0,0 +1,18 @@ +#!perl -T +use strict; +use warnings; +use Test::More tests => 20; +use Games::Word qw/random_permutation is_permutation/; + +ok( is_permutation("", ""), "testing empty string"); +ok( is_permutation("blah", "blah"), "testing same string"); +ok( is_permutation("blah", "alhb"), "testing permuted string"); +ok(!is_permutation("blah", "blh"), "testing word with letter deleted"); +ok(!is_permutation("blah", "blahs"), "testing word with letter added"); +ok(!is_permutation("blah", "blahh"), "testing word with repeated letter"); +ok( is_permutation("blaah", "hbala"), "testing word with duplicate letters"); +ok(!is_permutation("blaah", "bblah"), "more duplicate letter tests"); + +for (1..12) { + ok(is_permutation("blah", random_permutation("blah")), "random tests"); +} |