Branch Coverage

blib/lib/Games/Object.pm
Criterion Covered Total %
branch 361 510 70.7


line true false branch
101 19 46 if ref $obj
111 55 0 if ($type eq 'attr') { }
0 0 elsif ($type eq 'flag') { }
116 44 11 if defined &$simple
121 1 0 @_ == 3 && _IsObject($_[1]) && _IsObject($_[2]) ? :
1 1 @_ == 2 && _IsObject($_[1]) ? :
3 2 @_ == 1 ? :
53 5 @_ == 0 ? :
137 1 0 @_ == 3 && _IsObject($_[1]) && _IsObject($_[2]) ? :
1 1 @_ == 2 && _IsObject($_[1]) ? :
14 2 @_ == 1 ? :
154 0 0 if defined &$name
160 0 0 $val ? :
197 3 0 ref $_[$#_] eq 'HASH' ? :
198 0 0 @_ == 2 ? :
3 0 @_ == 1 ? :
0 3 @_ == 0 ? :
207 8 13 if defined $verb and not defined &$verb
218 3 0 ref $_[$#_] eq 'HASH' ? :
219 0 3 !_IsObject($_[$#_]) ? :
220 0 0 @_ == 2 ? :
3 0 @_ == 1 ? :
0 3 @_ == 0 ? :
230 10 11 if not defined &$action
242 0 0 $cmp == 0 ? :
253 0 0 if (@_) { }
300 0 0 if $key eq 'id'
301 0 0 if ($key eq 'attr') { }
304 0 0 unless $$attr{'flags'} & 2
323 0 123 if (defined $$obj{$lock}) { }
346 46 10 ref $obj2 ? :
348 5 51 $swapped ? :
357 4 8 ref $obj2 ? :
359 4 8 $swapped ? :
385 36 27 if defined $args{'id'}
411 14 2 if $Games::Object::ActionMethod
435 8 11 if @_ == 1 and ref $_[0]
436 0 19 if @_ == 1 and not ref $_[0]
447 0 19 if defined $args{'file'} and defined $args{'filename'}
450 1 18 if (defined $args{'filename'}) { }
0 18 elsif (not defined $args{'file'}) { }
452 0 1 unless $args{'file'}->open("<$args{'filename'}")
464 0 19 unless defined $line
465 0 19 unless $line =~ /^OBJ:(.+)$/
472 0 19 unless defined $line
473 0 19 unless $line =~ /^CL:(.+)$/
479 0 19 if (_IsObject($proto)) { }
490 9 10 if (defined $args{'id'}) { }
0 10 elsif (defined $$obj{'id'}) { }
497 1 18 if defined $args{'filename'}
503 2 0 unless (defined $$obj{'attr'}{$aname})
507 0 2 ref $$snapshot{$key} eq 'HASH' ? :
0 2 ref $$snapshot{$key} eq 'ARRAY' ? :
2 8 $key =~ /^(value|real_value)$/ ? :
521 8 11 if ($Games::Object::AccessorMethod)
523 16 7 unless $$obj{'attr'}{$aname}{'flags'} & 16
527 8 11 if ($Games::Object::ActionMethod)
540 10 9 if $subclass ne 'Games::Object'
564 8 10 if @_ == 1 and ref $_[0]
565 0 18 if @_ == 1 and not ref $_[0]
575 0 18 if defined $args{'file'} and defined $args{'filename'}
577 0 18 if (defined $args{'filename'}) { }
0 18 elsif (not defined $args{'file'}) { }
579 0 0 unless $args{'file'}->open(">$args{'filename'}")
606 0 18 if $args{'filename'}
627 42 0 $man ? :
637 0 0 $man ? :
672 1 5 if (ref $fname eq 'ARRAY')
680 0 5 unless defined $flag
686 0 5 if ($inherited)
696 5 0 if ($$flag{'value'} != 1)
713 0 4 if (ref $fname eq 'ARRAY')
721 0 4 unless defined $flag
727 0 4 if ($inherited)
737 3 1 if ($$flag{'value'} != 0)
758 12 11 if defined $flag and $$flag{'value'}
772 0 4 unless defined $flag
774 1 3 if $$flag{'value'}
775 1 3 if $total
797 22 78 if defined $$attr{'real_value'}
811 109 109 unless defined $args{$key}
817 1 108 unless ($$attr{'type'} =~ /^(int|number)$/)
818 0 1 if $key eq 'real_value'
820 1 0 if ($$attr{'type'} eq 'object')
823 0 1 unless ref $new
826 0 1 if ref($new) =~ /SCALAR|ARRAY|HASH|CODE|LVALUE|GLOB/
830 0 1 if _IsObject($new)
835 1 0 if not $args{'no_action'} and $old ne $new and $key eq 'value'
858 14 94 if ($oob)
861 14 0 unless ($args{'force'})
866 3 11 if ($oob_what eq 'ignore') { }
877 4 7 if ($too_small) { }
879 4 0 if $oob_what eq 'use_up'
882 7 0 if $oob_what eq 'use_up'
895 65 40 if $$attr{'type'} eq 'int' and not $$attr{'track_fractional'}
900 97 8 if not $args{'no_action'} and $old != $new and $key eq 'value'
914 3 0 if not $args{'no_action'} and $too_small and $old != $new and $key eq 'value'
928 4 3 if not $args{'no_action'} and $too_big and $old != $new and $key eq 'value'
959 10 58 if ($$attr{'flags'} & 2)
994 665 504 $aname eq '_MANAGER' ? :
997 750 419 if (not $man && $man->has_relation('inherit')) { }
999 564 186 if (defined $$obj{'attr'}{$aname}) { }
1000 3 561 wantarray ? :
1002 0 186 wantarray ? :
1010 347 97 if (defined $$aobj{'attr'}{$aname}) { }
25 72 elsif ($man->inheriting_from($aobj)) { }
1014 3 344 if ($inherited and $$attr{'flags'} & 8)
1034 76 343 wantarray ? :
1051 39 5 if (not $man && $man->has_relation('inherit')) { }
1053 39 0 if (defined $$obj{'flag'}{$fname}) { }
1054 8 31 wantarray ? :
1056 0 0 wantarray ? :
1064 4 4 if (defined $$fobj{'flag'}{$fname}) { }
3 1 elsif ($man->inheriting_from($fobj)) { }
1068 0 4 if ($inherited and $$flag{'flags'} & 8)
1088 1 4 wantarray ? :
1121 37 103 if $$attr{'type'} eq 'int'
1135 16 124 if $$attr{'type'} eq 'number'
1148 26 114 if $$attr{'type'} eq 'string'
1158 2 138 if ($$attr{'type'} eq 'object')
1162 0 2 if defined $$attr{'value'} and _IsObject($$attr{'value'})
1168 59 81 if $$attr{'type'} eq 'any'
1174 0 140 if (@_)
1185 39 101 if $Games::Object::AccessorMethod and not $$attr{'flags'} & 16
1189 131 9 unless defined $$attr{'tend_to_rate'}
1193 0 140 if defined $$attr{'tend_to_rate'} and not defined $$attr{'real_value'}
1197 35 105 if $$attr{'type'} eq 'int' and not $$attr{'track_fractional'}
1203 1 139 if ($$attr{'flags'} & 2 and $$attr{'flags'} & 4)
1208 0 0 defined $$attr{'minimum'} ? :
0 0 $type eq 'any' && ref $$attr{$key} eq 'HASH' ? :
0 0 $type eq 'any' && ref $$attr{$key} eq 'ARRAY' ? :
1 0 $type eq 'string' ? :
0 1 $type =~ /^(int|number)$/ ? :
1 4 $key =~ /^(value|real_value)$/ ? :
1240 56 2 unless defined $$obj{'attr'}{$aname}
1274 953 9 unless defined $prop
1278 256 706 unless defined $attr
1281 0 706 unless defined $$attr{$prop}
1285 706 0 if ($prop =~ /^(value|real_value)$/) { }
1287 5 701 if ($$attr{'type'} eq 'int' and $$attr{'track_fractional'}) { }
3 698 elsif ($$attr{'type'} eq 'string' and defined $$attr{'map'} and defined $$attr{'map'}{$$attr{$prop}}) { }
1304 0 706 if defined $$attr{'minimum'} and $result < $$attr{'minimum'}
1306 0 706 if defined $$attr{'maximum'} and $result > $$attr{'maximum'}
1321 10 0 unless defined $prop
1325 0 10 unless defined $attr
1328 0 10 unless defined $$attr{$prop}
1341 0 0 unless defined $prop
1343 0 0 if (defined $attr) { }
1344 0 0 defined $$attr{$prop} ? :
1365 4 80 if (defined $args{'cancel_modify'})
1368 4 0 if (defined $$obj{'pmod'}{$id}) { }
1374 4 0 unless ($$mod{'incremental'})
1382 3 1 if defined $$mod{'modify'}
1384 1 3 if defined $$mod{'modify_real'}
1389 1 3 if ($args{'immediate'}) { }
1397 0 4 if $$obj{'pmod_active'} == 0
1403 1 79 if (defined $args{'cancel_modify_re'})
1425 0 0 unless defined $attr or $inherited
1427 0 79 if not defined $attr and $inherited
1431 2 0 $inherited ? :
2 77 if $$attr{'flags'} & 1
1438 1 76 if ($inherited)
1449 1 73 $$attr{'type'} eq 'object' ? :
3 74 $$attr{'type'} eq 'int' && $$attr{'track_fractional'} ? :
0 77 defined $$attr{'values'} ? :
1476 536 3 unless defined $args{$prop}
1477 0 3 unless $vtype =~ /^(int|number)$/
1486 2 75 if $pcount > 0 and $acount == 0
1489 0 75 if $acount == 0
1490 0 11 if defined $args{'value'} || defined $args{'real_value'} and defined $args{'modify'} || defined $args{'modify_real'}
1494 0 75 if defined $args{'real_value'} || defined $args{'modify_real'} and not defined $$attr{'real_value'}
1499 11 64 if (defined $args{'value'} or defined $args{'real_value'}) { }
1509 0 11 if ($args{'defer'})
1523 0 64 unless $$attr{'type'} =~ /^(int|number)$/
1540 10 54 if ($args{'persist_as'})
1552 0 10 $was_pmod ? :
1567 2 8 if $args{'other'}
1568 0 10 if $args{'object'}
1570 10 0 unless $was_pmod
1574 55 9 if (not $args{'persist_as'} or $args{'apply_now'})
1578 52 3 if defined $args{'modify'}
1580 3 52 if defined $args{'modify_real'}
1586 1 54 if defined $args{'persist_as'}
1625 0 197 unless $callback
1631 33 164 if (ref $cargs[0] eq 'ARRAY') { }
1636 5 90 unless (ref $callback)
1637 5 0 if ($callback eq 'FAIL') { }
0 0 elsif ($callback eq 'NOCHECK') { }
0 0 elsif ($callback eq 'CHECK') { }
1661 0 89 if $nocheck
1667 2 87 unless ($rc)
1668 1 1 if (@cargs and not ref $cargs[0] and $cargs[0] eq 'FAIL')
1686 4 4 $oname =~ /^O:(.+)$/ ? :
29 8 $oname eq 'O:manager' ? :
0 37 $oname eq 'O:object' ? :
8 37 $oname eq 'O:other' ? :
119 45 $oname eq 'O:self' ? :
1697 2 162 unless ($obj)
1698 1 1 if $flags & 4096
1709 263 359 unless $arg =~ /[AO]:/
1712 0 18 $arg =~ /^O:([a-zA-Z0-9_]+$)/ ? :
0 18 $arg eq 'O:manager' ? :
34 18 $arg eq 'O:object' ? :
25 52 $arg eq 'O:other' ? :
11 77 $arg eq 'O:self' ? :
65 88 $arg eq 'A:action' ? :
206 153 $arg =~ /^A:([a-zA-Z0-9_]+)$/ && defined $$aargs{$1} ? :
1724 335 24 if (defined $narg)
1731 0 0 $subarg =~ /^O:([a-zA-Z0-9_]+$)/ ? :
5 0 $subarg eq 'O:manager' ? :
17 5 $subarg eq 'O:object' ? :
2 22 $subarg eq 'O:other' ? :
5 24 $subarg eq 'O:self' ? :
0 29 $subarg eq 'A:action' ? :
0 29 $subarg =~ /^A:([a-zA-Z0-9_]+)$/ && defined $$aargs{$1} ? :
1745 0 24 if $@
1749 4 158 if (not ref $obj) { }
1781 0 7 unless $obj->can($method)
1788 3 31 if (_IsObject($args[$aindex]))
1823 105 140 if ($action =~ /^attr:(.+):(.+)$/) { }
8 132 elsif ($action =~ /^flag:(.+):(.+)$/) { }
132 0 elsif ($action =~ /^object:(.+)$/) { }
1829 69 36 if defined $attr and exists $$attr{$oname}
1831 69 36 if $callback
1839 2 6 if defined $flag and exists $$flag{$oname}
1841 2 6 if $callback
1856 139 106 unless $callback
1883 17 24 unless $plist
1909 2 5 if (defined $$obj{'queue_changed'} and defined $$obj{'queue_changed'}{$qindex})
1915 2 0 if ($change eq 'GO::id') { }
1922 6 1 unless defined $mcount{$meth}
1923 0 7 if ($mcount{$meth} > $process_limit) { }
0 7 elsif ($mcount{$meth} == $process_limit) { }
1953 87 43 unless defined $$attr{'tend_to_rate'}
1959 37 6 if ($new < $target) { }
6 0 elsif ($new > $target) { }
1961 0 37 if $new > $target
1964 0 6 if $new < $target
1990 34 0 if ($$amod{'priority'} == $$bmod{'priority'}) { }
2002 0 43 if ($$mod{'locked'}) { }
0 43 elsif ($$mod{'delay'} > 0) { }
1 42 elsif (defined $$mod{'time'} and $$mod{'time'} <= 0) { }
24 18 elsif ($$mod{'applied'} and not $$mod{'incremental'}) { }
2023 2 22 if defined $$mod{'time'}
2035 16 2 if defined $$mod{'modify'}
2037 2 16 if defined $$mod{'modify_real'}
2043 1 17 if defined $$mod{'time'}
2061 32 605 if (defined $id) { }
2063 0 32 if $man
2082 41 665 if (@_ == 2) { }
2084 40 1 if $man
2101 9 72 if (@_) { }
2103 5 4 if $pri >= $highest_pri
2132 0 0 unless defined $$obj{'attr'}
2142 0 0 if $man