1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144
|
use strict;
use warnings;
## skip Test::Tabs
use Test::More;
use Test::Requires '5.008001';
use Test::Fatal;
use FindBin qw($Bin);
use lib "$Bin/lib";
use MyTest::TestClass::Number;
my $CLASS = q[MyTest::TestClass::Number];
## abs
can_ok( $CLASS, 'my_abs' );
subtest 'Testing my_abs' => sub {
my $e = exception {
my $object = $CLASS->new( attr => -5 );
$object->my_abs;
is( $object->attr, 5, q{$object->attr is 5} );
};
is( $e, undef, 'no exception thrown running abs example' );
};
## add
can_ok( $CLASS, 'my_add' );
subtest 'Testing my_add' => sub {
my $e = exception {
my $object = $CLASS->new( attr => 4 );
$object->my_add( 5 );
is( $object->attr, 9, q{$object->attr is 9} );
};
is( $e, undef, 'no exception thrown running add example' );
};
## cmp
can_ok( $CLASS, 'my_cmp' );
## div
can_ok( $CLASS, 'my_div' );
subtest 'Testing my_div' => sub {
my $e = exception {
my $object = $CLASS->new( attr => 6 );
$object->my_div( 2 );
is( $object->attr, 3, q{$object->attr is 3} );
};
is( $e, undef, 'no exception thrown running div example' );
};
## eq
can_ok( $CLASS, 'my_eq' );
## ge
can_ok( $CLASS, 'my_ge' );
## get
can_ok( $CLASS, 'my_get' );
subtest 'Testing my_get' => sub {
my $e = exception {
my $object = $CLASS->new( attr => 4 );
is( $object->my_get, 4, q{$object->my_get is 4} );
};
is( $e, undef, 'no exception thrown running get example' );
};
## gt
can_ok( $CLASS, 'my_gt' );
## le
can_ok( $CLASS, 'my_le' );
## lt
can_ok( $CLASS, 'my_lt' );
## mod
can_ok( $CLASS, 'my_mod' );
subtest 'Testing my_mod' => sub {
my $e = exception {
my $object = $CLASS->new( attr => 5 );
$object->my_mod( 2 );
is( $object->attr, 1, q{$object->attr is 1} );
};
is( $e, undef, 'no exception thrown running mod example' );
};
## mul
can_ok( $CLASS, 'my_mul' );
subtest 'Testing my_mul' => sub {
my $e = exception {
my $object = $CLASS->new( attr => 2 );
$object->my_mul( 5 );
is( $object->attr, 10, q{$object->attr is 10} );
};
is( $e, undef, 'no exception thrown running mul example' );
};
## ne
can_ok( $CLASS, 'my_ne' );
## set
can_ok( $CLASS, 'my_set' );
subtest 'Testing my_set' => sub {
my $e = exception {
my $object = $CLASS->new( attr => 4 );
$object->my_set( 5 );
is( $object->attr, 5, q{$object->attr is 5} );
};
is( $e, undef, 'no exception thrown running set example' );
};
## sub
can_ok( $CLASS, 'my_sub' );
subtest 'Testing my_sub' => sub {
my $e = exception {
my $object = $CLASS->new( attr => 9 );
$object->my_sub( 6 );
is( $object->attr, 3, q{$object->attr is 3} );
};
is( $e, undef, 'no exception thrown running sub example' );
};
done_testing;
|