Subject: | any < any |
Strawberry Perl 5.16.0.1-32bit on Windows 7 Enterprise SP1.
It appears any(x) < any(y) and any(y) > any(x) have their results reversed, i.e. the first expression produces the result that would be expected from the second and vice versa. See the attached test and results. Note that I have not checked other operators.
Subject: | TestQuantumSuperpositions.pl |
use strict;
use warnings;
use Scalar::Util qw(blessed);
use Test::More tests => 8;
use Test::Differences;
use Quantum::Superpositions;
sub isq
{
my ($value, $expected, $test_name) = @_;
subtest($test_name => sub {
isa_ok($value, blessed $expected, "Type");
eq_or_diff_data([sort @$value], [sort @$expected], "Eigenstates");
});
}
isq(any(1,2,3) < all(2,3,4), any(1), "any < all");
isq(all(2,3,4) > any(1,2,3), all(2,3,4), "all > any");
isq(any(1,2,3) < any(1,2,3), any(1,2), "any < any");
isq(any(1,2,3) > any(1,2,3), any(2,3), "any > any");
isq(all(1,2,3) < any(2,3,4), all(1,2,3), "all < any");
isq(any(2,3,4) > all(1,2,3), any(4), "any > all");
isq(all(1,2,3) < all(4,5,6), all(1,2,3), "all < all");
isq(all(4,5,6) > all(1,2,3), all(4,5,6), "all > all");
Subject: | testresults.txt |
1..8
ok 1 - Type isa Quantum::Superpositions::Disj
ok 2 - Eigenstates
1..2
ok 1 - any < all
ok 1 - Type isa Quantum::Superpositions::Conj
ok 2 - Eigenstates
1..2
ok 2 - all > any
ok 1 - Type isa Quantum::Superpositions::Disj
not ok 2 - Eigenstates
# Failed test 'Eigenstates'
# at TestQuantumSuperpositions.pl line 14.
# +----+-----+----+----------+
# | Elt|Got | Elt|Expected |
# +----+-----+----+----------+
# | | * 0|1 *
# | 0|2 | 1|2 |
# * 1|3 * | |
# +----+-----+----+----------+
1..2
# Looks like you failed 1 test of 2.
not ok 3 - any < any
# Failed test 'any < any'
# at TestQuantumSuperpositions.pl line 15.
ok 1 - Type isa Quantum::Superpositions::Disj
not ok 2 - Eigenstates
# Failed test 'Eigenstates'
# at TestQuantumSuperpositions.pl line 14.
# +----+-----+----+----------+
# | Elt|Got | Elt|Expected |
# +----+-----+----+----------+
# * 0|1 * | |
# | 1|2 | 0|2 |
# | | * 1|3 *
# +----+-----+----+----------+
1..2
# Looks like you failed 1 test of 2.
not ok 4 - any > any
# Failed test 'any > any'
# at TestQuantumSuperpositions.pl line 15.
ok 1 - Type isa Quantum::Superpositions::Conj
ok 2 - Eigenstates
1..2
ok 5 - all < any
ok 1 - Type isa Quantum::Superpositions::Disj
ok 2 - Eigenstates
1..2
ok 6 - any > all
ok 1 - Type isa Quantum::Superpositions::Conj
ok 2 - Eigenstates
1..2
ok 7 - all < all
ok 1 - Type isa Quantum::Superpositions::Conj
ok 2 - Eigenstates
1..2
ok 8 - all > all
# Looks like you failed 2 tests of 8.