Branch Coverage

blib/lib/MongoDB/_URI.pm
Criterion Covered Total %
branch 112 166 67.4


line true false branch
183 21 0 if &Int()->($v)
192 15 4 if (&looks_like_number($v))
199 2 1 if &Int()->($v) and $v >= -1
203 3 0 if &Int()->($v)
207 10 0 if &Int()->($v)
214 0 1485 unless defined $str
215 70 1415 if ($str =~ s/%([0-9a-f]{2})/chr hex $1;/egi)
225 12 0 if ($tag =~ /\S/)
227 1 11 if (@kv != 2)
243 6 272 unless @kv == 2
247 7 265 unless ($valid->{$lc_k})
248 0 7 if ($txt_record) { }
255 2 263 if (exists $parsed{$lc_k} and not exists $options_with_list_type{$lc_k})
259 3 260 if ($lc_k eq 'authmechanismproperties') { }
5 255 elsif ($lc_k eq 'compressors') { }
14 241 elsif ($lc_k eq 'authsource') { }
6 235 elsif ($lc_k eq 'readpreferencetags') { }
63 172 elsif ($self->_valid_str_to_bool_options->{$lc_k}) { }
64 108 elsif (my $opt_validation = $self->_extra_options_validation->{$lc_k}) { }
261 3 0 if (defined $temp)
263 2 1 if (exists $parsed{$lc_k}{'CANONICALIZE_HOST_NAME'})
265 2 0 if (defined $temp)
280 0 6 unless $valid_compressors->{$compressor}
290 5 1 if (defined $temp)
296 56 7 if (defined $temp)
301 26 38 unless (ref $opt_validation eq 'CODE')
306 20 44 if (not $valid) { }
317 8 1 if (exists $parsed{'tlsinsecure'} and exists $parsed{'tlsallowinvalidcertificates'} || exists $parsed{'tlsallowinvalidhostnames'})
326 4 6 if (exists $parsed{'tls'} and exists $parsed{'ssl'} and $parsed{'tls'} != $parsed{'ssl'})
333 6 184 if (exists $parsed{'tls'}) { }
4 180 elsif (exists $parsed{'ssl'}) { }
346 0 0 unless scalar @split_name > 2
358 0 0 if ($srv_data) { }
360 0 0 unless $rr->type eq 'SRV'
363 0 0 unless ($target =~ /\.\Q$domain_name\E$/)
366 0 0 if ($phase and $phase eq 'init') { }
378 0 0 if not defined $minimum_ttl or $rr->ttl < $minimum_ttl
382 0 0 if (defined $txt_data)
385 0 0 unless $rr->type eq 'TXT'
388 0 0 if (scalar @txt_answers > 1) { }
0 0 elsif (scalar @txt_answers == 1) { }
399 0 0 unless (@hosts)
401 0 0 if ($phase and $phase eq 'init') { }
409 0 0 if $minimum_ttl < 60 and $phase and $phase ne 'init'
430 0 5 unless (defined $result{'hostids'} and length $result{'hostids'})
434 1 4 if ($result{'hostids'} =~ /,/)
438 1 3 if ($result{'hostids'} =~ /:\d+$/)
442 2 1 if (defined $result{'options'})
452 1 2 unless $result{'options'}
459 22 5 unless exists $options->{$stb_key}
460 5 0 $options->{$stb_key} || $options->{$stb_key} eq 'true' ? :
464 1 2 if (defined $result{'username'} or defined $result{'password'})
475 3 0 scalar keys %$options ? :
492 0 0 if (defined $self->{'expires'} and $self->{'expires'} <= &MongoDB::_URI::time())
500 0 0 unless ($ok)
504 0 0 unless $ok
507 0 0 unless @current == @new
510 0 0 unless $new[$index] eq $current[$index]
522 5 541 unless (defined $hostids and length $hostids)
527 34 550 if $hostid =~ m[/] and $hostid =~ /\.sock/
530 15 535 if substr($hostid, 0, 1) eq '['
534 3 532 unless length $host
536 139 393 if (defined $port)
537 9 130 unless $port =~ /^\d+$/
539 5 125 unless $port >= 1 and $port <= 65535
544 123 388 /:/ ? :
557 0 0 unless ($uri =~ /^$uri_re$/)
573 4 558 if ($uri =~ m[^mongodb\+srv://])
579 5 555 unless ($uri =~ /^$uri_re$/)
588 72 483 if (defined $result{'username'})
591 6 66 if __userinfo_invalid_chars($result{'username'})
595 49 500 if (defined $result{'password'})
598 3 46 if __userinfo_invalid_chars($result{'password'})
604 226 249 if (defined $result{'db_name'})
607 1 225 if $result{'db_name'} =~ m[/]
611 206 268 if (defined $result{'options'})
617 943 1793 if defined $result{$attr}
625 0 65 unless defined $str
627 25 7 $str eq 'false' ? :
33 32 $str eq 'true' ? :
628 7 58 unless defined $ret
640 11 0 if ($] ge '5.008') { }
645 0 0 if length $str == do { use bytes; length $str }