Branch Coverage

lib/ClarID/Tools/Command/code.pm
Criterion Covered Total %
branch 174 308 56.4


line true false branch
241 0 45 unless exists $FIELDS{$e}
248 0 32 unless exists $FIELDS{$e}
258 9 27 if defined $self->infile
263 0 27 if ($self->with_condition_name and $self->action ne "decode")
268 16 11 if ($self->action eq 'encode') { }
11 0 elsif ($self->action eq 'decode') { }
272 0 16 unless @conds
275 0 16 if (@conds > $self->max_conditions)
284 0 16 unless my $pat_cfg = $self->codebook->{'entities'}{$self->entity}{'condition_pattern'}
286 0 16 unless my $re = $pat_cfg->{'regex'}
290 0 19 unless $c =~ /^$re$/
299 2 154 if $field eq "batch" and not defined $self->batch
300 2 152 if $field eq "replicate" and not defined $self->replicate
301 0 152 unless defined $self->$field
308 0 11 unless defined $self->clar_id
330 4 32 if ($self->action eq "decode" and $self->with_condition_name)
331 0 4 unless -e $self->icd10_map
333 0 4 unless open my $jh, "<", $self->icd10_map
342 9 27 if (defined(my $infile = $self->infile))
345 0 9 if ($infile =~ /\.gz$/) { }
346 0 0 unless $in_fh = "IO::Uncompress::Gunzip"->new($infile)
350 0 9 unless open my $fh_in, "<", $infile
356 0 9 if (defined $self->outfile) { }
357 0 0 if ($self->outfile =~ /\.gz$/) { }
358 0 0 unless $out_fh = "IO::Compress::Gzip"->new($self->outfile)
362 0 0 unless open my $fh_out, ">", $self->outfile
382 27 0 exists $full->{'entities'} ? :
383 0 27 unless my $cb = $$root{$self->entity}
385 16 11 if ($self->action eq 'encode') { }
398 2 8 if ($self->with_condition_name)
424 0 9 unless my $hdr = $csv->getline($in_fh)
430 9 0 exists $full->{'entities'} ? :
431 0 9 unless my $cb = $$root{$self->entity}
435 4 5 if ($self->action eq 'encode') { }
436 2 2 $self->format eq 'stub' ? :
441 2 3 if $self->with_condition_name
448 13 17 if ($self->action eq 'encode') { }
452 0 13 unless @conds
453 0 13 if (@conds > $self->max_conditions)
461 0 13 unless my $pat_cfg = $cb->{'condition_pattern'}
463 0 13 unless my $re = $pat_cfg->{'regex'}
465 0 16 unless $c =~ /^$re$/
480 13 4 if ($self->format eq 'human') { }
490 0 17 unless defined $row->{$id_col}
495 5 12 if ($self->with_condition_name and $code2name)
513 0 120 unless defined $v and exists $fmap->{$v}
524 36 24 $mode eq 'human' ? :
526 36 24 $mode eq 'human' ? :
539 0 47 unless defined $val
540 0 47 unless $pcfg and $pcfg->{'regex'}
543 1 46 unless $val =~ /$re/
546 0 46 if @caps > $need
548 46 0 @caps ? :
46 0 $need ? :
556 0 0 if ($map and ref $map eq "HASH" and exists $map->{$val})
557 0 0 $mode eq 'human' ? :
558 0 0 if defined $map->{$val}{$k}
562 0 13 unless defined $val
565 13 0 if ($pcfg and $pcfg->{'regex'})
567 0 13 unless $val =~ /$re/
570 0 13 if @caps > $need
573 0 0 if (not @caps and $need == 1 and $mode eq "stub")
578 13 0 @caps ? :
596 0 9 unless (exists $cb->{'project'}{$pr})
598 0 0 if exists $cb->{'project'}{$alt}
600 0 9 unless exists $cb->{'project'}{$pr}
611 0 9 unless $pad =~ /^\d+$/ and $pad > 0
613 0 9 unless $sid =~ /^\d+$/ and $sid >= 0 and $sid <= $max
636 7 1 defined $ba ? :
642 7 1 defined $re ? :
654 7 1 if defined $batch_code
655 7 1 if defined $rep_code
664 0 13 unless @p >= 9
669 0 13 unless defined $project
672 0 13 unless defined $species
675 0 13 unless defined $tissue
678 0 13 unless defined $stype
680 0 13 unless defined $assay
684 0 13 unless $pad =~ /^\d+$/ and $pad > 0
685 0 13 unless $sid =~ /^\d{$pad}$/
691 11 2 if (@rest)
694 11 0 if ($rest[-1] =~ /^R(\d{2})$/)
700 11 0 if (@rest and $rest[-1] =~ /^B(\d{2})$/)
709 0 13 unless defined $timepoint
717 0 17 if (exists $cb->{'condition'}{$code}) { }
722 0 17 if (not $code =~ /\./ and length $code > 3)
733 2 11 unless defined $batch
734 2 11 unless defined $replicate
767 0 8 unless $w =~ /^\d+$/ and $w > 0
768 0 8 unless defined $sid and $sid =~ /^\d+$/ and $sid <= 62 ** $w - 1
774 0 0 defined $co ? :
8 0 $conds_aref ? :
778 0 8 unless @conds
779 0 8 if @conds > $self->max_conditions
787 0 8 unless exists $self->icd10_order->{$c}
804 8 0 defined $ba ? :
808 8 0 defined $re ? :
826 0 3 unless defined $id and length $id
839 0 3 if (not defined $replicate and $id =~ s/(\d{2})$//)
840 0 3 if (not defined $batch and $id =~ s/(\d{2})$//)
843 0 3 unless $id =~ s/(\d+)([DWMYN])$//
845 1 2 if $d_unit eq "N" and $d_num != 0
854 2 4 if ($id =~ s/\Q$stub\E$//)
856 0 2 unless defined $timepoint
859 0 2 unless $id =~ s/(\d{2})$//
861 0 2 unless $cond_count > 0
871 2 2 if ($head =~ s/^\Q$stub\E//)
873 0 2 unless defined $project
880 0 2 unless exists $sp_by{$spec_stub}
885 0 2 unless $w =~ /^\d+$/ and $w > 0
895 2 20 if ($head =~ s/^\Q$stub\E//)
897 0 2 unless defined $tissue
904 2 4 if ($head =~ s/^\Q$stub\E//)
906 0 2 unless defined $stype
913 2 20 if ($head =~ s/^\Q$stub\E//)
915 0 2 unless defined $assay
918 0 2 unless length($head) % 3 == 0
920 0 2 unless @c_stubs == $cond_count
928 0 2 unless $ord >= 1 and $ord < @{$self->icd10_by_order;}
973 0 6 unless $pad =~ /^\d+$/ and $pad > 0
976 0 6 unless defined $sid and $sid =~ /^\d+$/ and $sid <= $max
981 6 0 defined $co ? :
982 0 6 unless @conds
985 0 7 unless my $pat_cfg = $cb->{'condition_pattern'}
986 0 7 unless $c =~ /^$pat_cfg->{'regex'}$/
1009 0 6 unless @p == 6
1014 0 6 unless defined $ag_key
1043 0 6 unless exists $cb->{'type'}{$type}
1044 0 6 unless exists $cb->{'sex'}{$sex}
1046 0 6 unless exists $cb->{'age_group'}{$age_group}
1053 0 6 unless $w =~ /^\d+$/ and $w > 0
1058 0 6 unless @conds
1059 0 6 if @conds > 99
1062 0 7 unless exists $self->icd10_order->{$c}
1084 0 6 unless defined $w and $w =~ /^\d+$/ and $w > 0
1096 0 6 unless length $rest >= 2
1101 0 6 unless $cond_count > 0
1106 0 6 unless length $rest >= $conds_len
1112 0 6 unless length $rest >= 1
1117 0 6 unless length $rest >= $w
1151 0 6 unless defined $type
1155 0 6 unless defined $sex_key
1159 0 6 unless defined $age_group_key
1163 0 6 unless @rev_chunks == $cond_count
1174 0 7 unless $ord >= 1 and $ord < @{$self->icd10_by_order;}
1218 0 29 unless defined $id and $id =~ /^\d+$/ and $id >= 0
1221 0 29 if $id == 0
1239 0 17 unless defined $stub and $stub =~ /^[0-9A-Za-z]+$/
1243 0 52 unless exists $BASE62_REV{$char}
1253 0 9 if $code =~ /\./ or length $code <= 3
1259 0 36 unless my $ents = $doc->{'entities'}
1263 0 72 unless my $cat = $ents->{$entity}
1268 0 540 if $slot eq "_defaults"
1296 6 0 if ($$sref =~ s/$re//)