5 use Test::More tests => 12;
7 BEGIN { use_ok( 'C4::Boolean', qw( true_p ) ); }
9 is( true_p('0'), '0', 'recognizes \'0\' as false' );
10 is( true_p('false'), '0', 'recognizes \'false\' as false' );
11 is( true_p('off'), '0', 'recognizes \'off\' as false' );
12 is( true_p('no'), '0', 'recognizes \'no\' as false' );
14 is( true_p('1'), '1', 'recognizes \'1\' as true' );
15 is( true_p('true'), '1', 'recognizes \'true\' as true' );
16 is( true_p('on'), '1', 'recognizes \'on\' as true' );
17 is( true_p('yes'), '1', 'recognizes \'yes\' as true' );
18 is( true_p('YES'), '1', 'verified case insensitivity' );
20 is( true_p(undef), undef, 'recognizes undefined as not boolean' );
21 is( true_p('foo'), undef, 'recognizes \'foo\' as not boolean' );