summaryrefslogtreecommitdiffstats
path: root/t/014-substrings.t
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2012-07-05 10:15:42 -0500
committerJesse Luehrs <doy@tozt.net>2012-07-05 10:27:29 -0500
commit4074f2d6a9bcfb33f0da7933ac26c5df0d2f21f7 (patch)
tree9d34241644d3d8babf199f362a9d2b7ee2180d75 /t/014-substrings.t
parenta12e592c538f370277e787cd57d01d512e1ca835 (diff)
downloadgames-word-4074f2d6a9bcfb33f0da7933ac26c5df0d2f21f7.tar.gz
games-word-4074f2d6a9bcfb33f0da7933ac26c5df0d2f21f7.zip
modernize, cleanup, etc
Diffstat (limited to 't/014-substrings.t')
-rw-r--r--t/014-substrings.t42
1 files changed, 0 insertions, 42 deletions
diff --git a/t/014-substrings.t b/t/014-substrings.t
deleted file mode 100644
index e61d264..0000000
--- a/t/014-substrings.t
+++ /dev/null
@@ -1,42 +0,0 @@
-#!/usr/bin/env perl
-use strict;
-use warnings;
-use Test::More;
-use Test::Deep;
-use List::Util qw/sum/;
-use Games::Word qw/is_substring all_substrings/;
-
-my %is_substring_tests = (
- "" => [""],
- "abc", => ["", "abc", "ab", "ac"],
- "aaba" => ["a", "aa", "aaa", "aab", "aba"],
- "abcba" => ["aa", "bb", "c", "abc", "cba", "abba"],
-);
-my %isnt_substring_tests = (
- "" => ["a"],
- "abc" => ["z", "ba", "baz", "abz"],
- "aaba" => ["c", "abaa"],
-);
-my %all_substrings_tests = (
- "" => [''],
- "a" => ['', "a"],
- "ab" => ['', "a", "b", "ab"],
- "aab" => ['', "a", "a", "b", "aa", "ab", "ab", "aab"],
- "abc" => ['', "a", "b", "c", "ab", "ac", "bc", "abc"],
-);
-plan tests => (sum map { scalar @$_ } values %is_substring_tests,
- values %isnt_substring_tests) +
- keys %all_substrings_tests;
-
-while (my ($word, $substrings) = each %is_substring_tests) {
- ok(is_substring($_, $word), "is '$_' a substring of '$word'?")
- for @$substrings;
-}
-while (my ($word, $substrings) = each %isnt_substring_tests) {
- ok(!is_substring($_, $word), "is '$_' not a substring of '$word'?")
- for @$substrings;
-}
-while (my ($word, $substrings) = each %all_substrings_tests) {
- cmp_deeply([all_substrings($word)], bag(@$substrings),
- "do we get all of the substrings of '$word'?");
-}