| 1 | package Sidef::Types::Bool::Bool; | |||||||||||||||||||||||||||||||||
| 2 | ||||||||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use utf8; | |||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||
| 4 | 1 | ▶ | use 5.016; | |||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||
| 5 | ||||||||||||||||||||||||||||||||||
| 6 | 1 | ▶ | $JSON::PP::true //= 1; | |||||||||||||||||||||||||||||||
|
Condition50%1/2
$JSON::PP::true //= 1
MC/DC0%0/1
$JSON::PP::true //= 1
$JSON::PP::true
Truth table50%1/2
A
A= $JSON::PP::true
| ||||||||||||||||||||||||||||||||||
| 7 | 1 | ▶ | $JSON::PP::false //= 0; | |||||||||||||||||||||||||||||||
|
Condition50%1/2
$JSON::PP::false //= 0
MC/DC0%0/1
$JSON::PP::false //= 0
$JSON::PP::false
Truth table50%1/2
A
A= $JSON::PP::false
| ||||||||||||||||||||||||||||||||||
| 8 | ||||||||||||||||||||||||||||||||||
| 9 | use overload | |||||||||||||||||||||||||||||||||
| 10 | 0 | ▶ | q{bool} => sub { ${$_[0]} }, | |||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=3.3
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| ||||||||||||||||||||||||||||||||||
| 11 | 0 | ▶ | q{0+} => sub { ${$_[0]} }, | |||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| ||||||||||||||||||||||||||||||||||
| 12 | 0 | ▶ | q{""} => sub { ${$_[0]} ? 'true' : 'false' }; | |||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=10.1
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||
| 13 | ||||||||||||||||||||||||||||||||||
| 14 | 1 | ▶ | use constant { | |||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||
| 15 | 1 | TRUE => (bless \(my $t = 1), __PACKAGE__), | ||||||||||||||||||||||||||||||||
| 16 | FALSE => (bless \(my $f = 0), __PACKAGE__), | |||||||||||||||||||||||||||||||||
| 17 | 1 | }; | ||||||||||||||||||||||||||||||||
| 18 | ||||||||||||||||||||||||||||||||||
| 19 | 1 | ▶ | use parent qw(Sidef::Object::Object); | |||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||
| 20 | ||||||||||||||||||||||||||||||||||
| 21 | 0 | ▶ | sub new { | |||||||||||||||||||||||||||||||
|
Subroutine
new: not called CC=2 SCAR=17.9
Pod
documented
| ||||||||||||||||||||||||||||||||||
| 22 | 0 | ▶ | $_[1] ? (TRUE) : (FALSE); | |||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||
| 23 | } | |||||||||||||||||||||||||||||||||
| 24 | ||||||||||||||||||||||||||||||||||
| 25 | 1 | *call = \&new; | ||||||||||||||||||||||||||||||||
| 26 | ||||||||||||||||||||||||||||||||||
| 27 | 0 | ▶ | sub run { | |||||||||||||||||||||||||||||||
|
Subroutine
run: not called CC=1 SCAR=6.9
Pod
documented
| ||||||||||||||||||||||||||||||||||
| 28 | 0 | $_[0]; | ||||||||||||||||||||||||||||||||
| 29 | } | |||||||||||||||||||||||||||||||||
| 30 | ||||||||||||||||||||||||||||||||||
| 31 | 0 | ▶ | sub true { (TRUE) } | |||||||||||||||||||||||||||||||
|
Subroutine
true: not called CC=1 SCAR=6.9
Pod
documented
| ||||||||||||||||||||||||||||||||||
| 32 | 0 | ▶ | sub false { (FALSE) } | |||||||||||||||||||||||||||||||
|
Subroutine
false: not called CC=1 SCAR=6.9
Pod
documented
| ||||||||||||||||||||||||||||||||||
| 33 | ||||||||||||||||||||||||||||||||||
| 34 | 0 | ▶ | sub pick { | |||||||||||||||||||||||||||||||
|
Subroutine
pick: not called CC=2 SCAR=17.9
Pod
documented
| ||||||||||||||||||||||||||||||||||
| 35 | 0 | ▶ | CORE::rand(1) < 0.5 ? (TRUE) : (FALSE); | |||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||
| 36 | } | |||||||||||||||||||||||||||||||||
| 37 | ||||||||||||||||||||||||||||||||||
| 38 | 1 | *rand = \&pick; | ||||||||||||||||||||||||||||||||
| 39 | ||||||||||||||||||||||||||||||||||
| 40 | 0 | ▶ | sub get_value { ${$_[0]} ? $JSON::PP::true : $JSON::PP::false } | |||||||||||||||||||||||||||||||
|
Subroutine
get_value: not called CC=2 SCAR=17.9
Pod
undocumented
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||
| 41 | 0 | ▶ | sub to_bool { $_[0] } | |||||||||||||||||||||||||||||||
|
Subroutine
to_bool: not called CC=1 SCAR=6.9
Pod
undocumented
| ||||||||||||||||||||||||||||||||||
| 42 | ||||||||||||||||||||||||||||||||||
| 43 | 1 | *to_b = \&to_bool; | ||||||||||||||||||||||||||||||||
| 44 | ||||||||||||||||||||||||||||||||||
| 45 | { | |||||||||||||||||||||||||||||||||
| 46 | 1 | ▶ | no strict 'refs'; | |||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||
| 47 | ||||||||||||||||||||||||||||||||||
| 48 | 1 | ▶ | *{__PACKAGE__ . '::' . '|'} = sub { | |||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=14.0
| ||||||||||||||||||||||||||||||||||
| 49 | 0 | my ($self, $arg) = @_; | ||||||||||||||||||||||||||||||||
| 50 | 0 | ▶ | $$self ? $self : $arg; | |||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||
| 51 | 1 | }; | ||||||||||||||||||||||||||||||||
| 52 | ||||||||||||||||||||||||||||||||||
| 53 | 1 | ▶ | *{__PACKAGE__ . '::' . '&'} = sub { | |||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=14.0
| ||||||||||||||||||||||||||||||||||
| 54 | 0 | my ($self, $arg) = @_; | ||||||||||||||||||||||||||||||||
| 55 | 0 | ▶ | $$self ? $arg : $self; | |||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||
| 56 | 1 | }; | ||||||||||||||||||||||||||||||||
| 57 | ||||||||||||||||||||||||||||||||||
| 58 | 1 | ▶ | *{__PACKAGE__ . '::' . '^'} = sub { | |||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=3 SCAR=22.3
| ||||||||||||||||||||||||||||||||||
| 59 | 0 | my ($self, $arg) = @_; | ||||||||||||||||||||||||||||||||
| 60 | 0 | ▶ | ($$self xor $arg) ? (TRUE) : (FALSE); | |||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/4
$$self xor $arg
MC/DC0%0/2
$$self xor $arg
$$self
$arg
Truth table0%0/4
A xor B
A= $$selfB= $arg
| ||||||||||||||||||||||||||||||||||
| 61 | 1 | }; | ||||||||||||||||||||||||||||||||
| 62 | } | |||||||||||||||||||||||||||||||||
| 63 | ||||||||||||||||||||||||||||||||||
| 64 | 0 | ▶ | sub is_true { $_[0] } | |||||||||||||||||||||||||||||||
|
Subroutine
is_true: not called CC=1 SCAR=6.9
Pod
documented
| ||||||||||||||||||||||||||||||||||
| 65 | ||||||||||||||||||||||||||||||||||
| 66 | 0 | ▶ | sub not { | |||||||||||||||||||||||||||||||
|
Subroutine
not: not called CC=2 SCAR=17.9
Pod
documented
| ||||||||||||||||||||||||||||||||||
| 67 | 0 | ▶ | ${$_[0]} ? (FALSE) : (TRUE); | |||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||
| 68 | } | |||||||||||||||||||||||||||||||||
| 69 | ||||||||||||||||||||||||||||||||||
| 70 | 1 | *is_false = \¬ | ||||||||||||||||||||||||||||||||
| 71 | 1 | *flip = \¬ | ||||||||||||||||||||||||||||||||
| 72 | 1 | *toggle = \¬ | ||||||||||||||||||||||||||||||||
| 73 | 1 | *neg = \¬ | ||||||||||||||||||||||||||||||||
| 74 | ||||||||||||||||||||||||||||||||||
| 75 | 0 | ▶ | sub dump { | |||||||||||||||||||||||||||||||
|
Subroutine
dump: not called CC=2 SCAR=17.9
Pod
documented
| ||||||||||||||||||||||||||||||||||
| 76 | 0 | my ($self) = @_; | ||||||||||||||||||||||||||||||||
| 77 | 0 | ▶ | Sidef::Types::String::String->new($$self ? 'true' : 'false'); | |||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||
| 78 | } | |||||||||||||||||||||||||||||||||
| 79 | ||||||||||||||||||||||||||||||||||
| 80 | 1 | *to_s = \&dump; | ||||||||||||||||||||||||||||||||
| 81 | 1 | *to_str = \&dump; | ||||||||||||||||||||||||||||||||
| 82 | ||||||||||||||||||||||||||||||||||
| 83 | 1 | 1 | ||||||||||||||||||||||||||||||||