Subject: | Calculating same value twice results in different ordering of outcome |
Run this test:
#!/usr/bin/perl
use strict;
use warnings;
use Math::Combinatorics;
use Test::More tests => 2;
test();
test();
sub test {
my $c = Math::Combinatorics->new(
count => 2,
data => [qw(a b c)]
);
my @result;
while(my @combo = $c->next_combination()){
push(@result, join('', @combo));
}
is_deeply([@result], [qw(ab ac bc)]);
}
And you'll get:
1..2
ok 1
not ok 2
# Failed test in ./proveMathCombFails.pl at line 21.
# Structures begin differing at:
# $got->[0] = 'cb'
# $expected->[0] = 'ab'
# Looks like you failed 1 test of 2.
Which means the very same test succeeds first and then fails in the
second run.