Lines 2-20
Link Here
|
2 |
use strict; |
2 |
use strict; |
3 |
use warnings; |
3 |
use warnings; |
4 |
|
4 |
|
5 |
use Test::More tests => 13; |
5 |
use Test::More tests => 19; |
6 |
|
6 |
|
7 |
BEGIN { use_ok( 'C4::Boolean', qw( true_p ) ); } |
7 |
BEGIN { use_ok( 'C4::Boolean', qw( true_p ) ); } |
8 |
|
8 |
|
9 |
is( true_p('0'), '0', 'recognizes \'0\' as false' ); |
9 |
is( true_p('0'), '0', 'recognizes \'0\' as false' ); |
|
|
10 |
is( true_p('nil'), '0', 'recognizes \'nil\' as false' ); |
10 |
is( true_p('false'), '0', 'recognizes \'false\' as false' ); |
11 |
is( true_p('false'), '0', 'recognizes \'false\' as false' ); |
11 |
is( true_p('off'), '0', 'recognizes \'off\' as false' ); |
12 |
is( true_p('off'), '0', 'recognizes \'off\' as false' ); |
12 |
is( true_p('no'), '0', 'recognizes \'no\' as false' ); |
13 |
is( true_p('no'), '0', 'recognizes \'no\' as false' ); |
|
|
14 |
is( true_p('n'), '0', 'recognizes \'n\' as false' ); |
15 |
is( true_p('NO'), '0', 'verified case insensitivity' ); |
13 |
|
16 |
|
14 |
is( true_p('1'), '1', 'recognizes \'1\' as true' ); |
17 |
is( true_p('1'), '1', 'recognizes \'1\' as true' ); |
|
|
18 |
is( true_p('-1'), '1', 'recognizes \'-1\' as true' ); |
19 |
is( true_p('t'), '1', 'recognizes \'t\' as true' ); |
15 |
is( true_p('true'), '1', 'recognizes \'true\' as true' ); |
20 |
is( true_p('true'), '1', 'recognizes \'true\' as true' ); |
16 |
is( true_p('on'), '1', 'recognizes \'on\' as true' ); |
21 |
is( true_p('on'), '1', 'recognizes \'on\' as true' ); |
17 |
is( true_p('yes'), '1', 'recognizes \'yes\' as true' ); |
22 |
is( true_p('yes'), '1', 'recognizes \'yes\' as true' ); |
|
|
23 |
is( true_p('y'), '1', 'recognizes \'y\' as true' ); |
18 |
is( true_p('YES'), '1', 'verified case insensitivity' ); |
24 |
is( true_p('YES'), '1', 'verified case insensitivity' ); |
19 |
|
25 |
|
20 |
is( true_p(undef), undef, 'recognizes undefined as not boolean' ); |
26 |
is( true_p(undef), undef, 'recognizes undefined as not boolean' ); |
21 |
- |
|
|