File: | t/Boolean.t |
Coverage: | 100.0% |
line | stmt | bran | cond | sub | time | code |
---|---|---|---|---|---|---|
1 | ||||||
2 | 1 1 1 | 1.33283518893511e+15 2 23 | use strict; | |||
3 | 1 1 1 | 5 1 51 | use warnings; | |||
4 | ||||||
5 | 1 1 1 | 210 19989 14 | use Test::More tests => 13; | |||
6 | ||||||
7 | 1 | 1429 | BEGIN { use_ok( 'C4::Boolean', qw( true_p ) ); } | |||
8 | ||||||
9 | 1 | 199510 | is( true_p('0'), '0', 'recognizes \'0\' as false' ); | |||
10 | 1 | 976 | is( true_p('false'), '0', 'recognizes \'false\' as false' ); | |||
11 | 1 | 536 | is( true_p('off'), '0', 'recognizes \'off\' as false' ); | |||
12 | 1 | 500 | is( true_p('no'), '0', 'recognizes \'no\' as false' ); | |||
13 | ||||||
14 | 1 | 499 | is( true_p('1'), '1', 'recognizes \'1\' as true' ); | |||
15 | 1 | 497 | is( true_p('true'), '1', 'recognizes \'true\' as true' ); | |||
16 | 1 | 525 | is( true_p('on'), '1', 'recognizes \'on\' as true' ); | |||
17 | 1 | 690 | is( true_p('yes'), '1', 'recognizes \'yes\' as true' ); | |||
18 | 1 | 588 | is( true_p('YES'), '1', 'verified case insensitivity' ); | |||
19 | ||||||
20 | 1 | 479 | is( true_p(undef), undef, 'recognizes undefined as not boolean' ); | |||
21 | 1 | 740 | is( true_p('foo'), undef, 'recognizes \'foo\' as not boolean' ); | |||
22 | 1 | 522 | is( true_p([]), undef, 'recognizes a reference as not a boolean' ); |