6 BEGIN { delete $ENV{PERL_TEST_LEANER_USES_TEST_MORE} }
8 use Test::Leaner tests => 7 * 10 + 4 * 7 + 10;
11 package Test::Leaner::TestCmpNum;
13 use overload '<=>' => sub {
17 $y = $y->{num} if ref $y;
19 ($x, $y) = ($y, $x) if $r;
27 bless { num => $_[0] }, $class
32 [ '1.0', '==', '1.0' ],
33 [ '1e0', '==', '1e0' ],
34 [ '1.0', '<=', '1.0' ],
35 [ '1.0', '>=', '1.0' ],
36 [ '1.0', '<=', '2.0' ],
37 [ '1.0', '<', '2.0' ],
38 [ '2.0', '>=', '1.0' ],
39 [ '2.0', '>', '1.0' ],
40 [ '1.0', '!=', '2.0' ],
41 [ '2.0', '!=', '1.0' ],
44 for my $t (@num_tests) {
45 my ($x, $op, $y) = @$t;
48 cmp_ok int($x), $op, $y;
49 cmp_ok $x, $op, int($y);
50 cmp_ok int($x), $op, int($y);
52 my $ox = Test::Leaner::TestCmpNum->new($x);
53 my $oy = Test::Leaner::TestCmpNum->new($y);
61 package Test::Leaner::TestCmpStr;
63 use overload 'cmp' => sub {
67 $y = $y->{str} if ref $y;
69 ($x, $y) = ($y, $x) if $r;
77 bless { str => $_[0] }, $class
91 for my $t (@str_tests) {
92 my ($x, $op, $y) = @$t;
96 my $ox = Test::Leaner::TestCmpStr->new($x);
97 my $oy = Test::Leaner::TestCmpStr->new($y);
101 cmp_ok $ox, $op, $oy;
118 for my $t (@logic_tests) {
119 my ($x, $op, $y) = @$t;