Algorithm-Combinatorics
view release on metacpan or search on metacpan
t/01_combinations.t view on Meta::CPAN
use strict;
use warnings;
use FindBin qw($Bin);
use lib $Bin;
use Test::More qw(no_plan);
use Algorithm::Combinatorics qw(combinations);
use Tester;
my $tester = Tester->__new(\&combinations);
my (@result, @expected);
# ---------------------------------------------------------------------
eval { combinations() };
ok($@, '');
eval { combinations([1]) };
ok($@, '');
eval { combinations(0, 0) };
ok($@, '');
# ---------------------------------------------------------------------
@expected = ([]);
$tester->__test(\@expected, [], 0);
@expected = ([]);
$tester->__test(\@expected, [1, 2], 0);
# ---------------------------------------------------------------------
@expected = (["foo"]);
$tester->__test(\@expected, ["foo"], 1);
# ---------------------------------------------------------------------
@expected = (["foo"], ["bar"]);
$tester->__test(\@expected, ["foo", "bar"], 1);
# ---------------------------------------------------------------------
@expected = (["foo", "bar"]);
$tester->__test(\@expected, ["foo", "bar"], 2);
# ---------------------------------------------------------------------
@expected = (
["foo", "bar"],
["foo", "baz"],
["bar", "baz"],
);
$tester->__test(\@expected, ["foo", "bar", "baz"], 2);
# ---------------------------------------------------------------------
@expected = (
["foo", "bar", "baz"],
["foo", "bar", "zoo"],
["foo", "baz", "zoo"],
["bar", "baz", "zoo"],
( run in 2.317 seconds using v1.01-cache-2.11-cpan-cdf2f3d4e48 )