bin/perl-slim

filter: Statementstmt 100% 25 / 25 Branchbran 100% 20 / 20 Conditioncond 80.9% 17 / 21 MC/DCmcdc 66.6% 8 / 12 Subroutinesub 100% 4 / 4 Podpod n/a totaltotal 90.2% 74 / 82 CC 1 SCAR 0.0
CC
1
Cov
94%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« lib/Test/FitNesse/Slim/SlimHelperLibrary.pm ↑ Summary blib/lib/Test/FitNesse/Slim.pm »
1 #! /usr/bin/env perl
2  
3 20 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 20 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 20 ▶use Test::FitNesse::Slim::Server;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 7 ▶sub usage {
Subroutine usage: called CC=1 SCAR=0.0
9 7 "Usage: $0 [-v] [-s seconds] [--bind-address IPv4] port (1 uses stdin/stdout pipes)\n"
10 }
11  
12 20 my($verbose,$statement_timeout,$bind_address,$bind_address_set,$port);
13 20 ▶while (@ARGV) {
Branch: 1 branch
BranchTrueFalseTotal
if (@ARGV) 31 15 46
14 31 my $argument = shift @ARGV;
15 31 ▶ if ($argument eq '-v') {
Branch: 4 branches
BranchTrueFalseTotal
if ($argument eq '-v') { } 2 29 31
elsif ($argument eq '-s') { } 6 23 29
elsif ($argument eq '--bind-address') { } 8 15 23
elsif ($argument =~ /\A-/ or defined $port) { } 1 14 15
16 2 $verbose = 1;
17 }
18 elsif ($argument eq '-s') {
19 6 ▶ die usage if defined($statement_timeout)
Branch: 1 branch
BranchTrueFalseTotal
if defined $statement_timeout or not @ARGV or not $ARGV[0] =~ /\A[1-9][0-9]{0,8}\z/ or $ARGV[0] > 2147483647 2 4 6
Condition77%7/9
defined $statement_timeout or not @ARGV or not $ARGV[0] =~ /\A[1-9][0-9]{0,8}\z/ or $ARGV[0] > 2147483647
l!l&&r!l&&!r
204
defined $statement_timeout or not @ARGV or not $ARGV[0] =~ /\A[1-9][0-9]{0,8}\z/
l!l&&r!l&&!r
114
defined $statement_timeout or not @ARGV
l!l&&r!l&&!r
105
MC/DC50%2/4
defined $statement_timeout or not @ARGV or not $ARGV[0] =~ /\A[1-9][0-9]{0,8}\z/ or $ARGV[0] > 2147483647
defined $statement_timeout not @ARGV not $ARGV[0] =~ /\A[1-9][0-9]{0,8}\z/ $ARGV[0] > 2147483647
Truth table60%3/5
A or not(B) or not(C) or D
A= defined $statement_timeoutB= not @ARGVC= not $ARGV[0] =~ /\A[1-9][0-9]{0,8}\z/D= $ARGV[0] > 2147483647
ABCDresult
1XXX1
01XX1
001X1
00011
00000
20 || !@ARGV || $ARGV[0] !~ /\A[1-9][0-9]{0,8}\z/
21 || $ARGV[0] > 2_147_483_647;
22 4 $statement_timeout = 0 + shift @ARGV;
23 }
24 elsif ($argument eq '--bind-address') {
25 8 ▶ die usage if $bind_address_set || !@ARGV;
Branch: 1 branch
BranchTrueFalseTotal
if $bind_address_set or not @ARGV 2 6 8
Condition100%3/3
$bind_address_set or not @ARGV
l!l&&r!l&&!r
116
MC/DC100%2/2
$bind_address_set or not @ARGV
$bind_address_set not @ARGV
Truth table100%3/3
A or not(B)
A= $bind_address_setB= not @ARGV
ABresult
1X1
011
000
26 6 $bind_address = shift @ARGV;
27 6 $bind_address_set = 1;
28 }
29 ▶ elsif ($argument =~ /\A-/ || defined $port) {
Condition66%2/3
$argument =~ /\A-/ or defined $port
l!l&&r!l&&!r
1014
MC/DC50%1/2
$argument =~ /\A-/ or defined $port
$argument =~ /\A-/ defined $port
Truth table66%2/3
A or B
A= $argument =~ /\A-/B= defined $port
ABresult
1X1
011
000
30 1 die usage;
31 }
32 else {
33 14 $port = $argument;
34 }
35 }
36  
37 15 ▶die usage unless defined($port) && $port =~ /\A[0-9]+\z/;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $port and $port =~ /\A[0-9]+\z/ 1 14 15
Condition66%2/3
defined $port and $port =~ /\A[0-9]+\z/
!ll&&!rl&&r
1014
MC/DC50%1/2
defined $port and $port =~ /\A[0-9]+\z/
defined $port $port =~ /\A[0-9]+\z/
Truth table66%2/3
A and B
A= defined $portB= $port =~ /\A[0-9]+\z/
ABresult
0X0
100
111
38 14 ▶die usage if $bind_address_set && $port eq '1';
Branch: 1 branch
BranchTrueFalseTotal
if $bind_address_set and $port eq 1 1 13 14
Condition100%3/3
$bind_address_set and $port eq 1
!ll&&!rl&&r
941
MC/DC100%2/2
$bind_address_set and $port eq 1
$bind_address_set $port eq 1
Truth table100%3/3
A and B
A= $bind_address_setB= $port eq 1
ABresult
0X0
100
111
39  
40 13 ▶Test::FitNesse::Slim::Server->new(
Branch: 1 branch
BranchTrueFalseTotal
$bind_address_set ? : 4 9 13
41 verbose => $verbose,
42 statement_timeout => $statement_timeout,
43 ($bind_address_set ? (bind_address => $bind_address) : ()),
44 )->run($port);
45  
46 __END__
« lib/Test/FitNesse/Slim/SlimHelperLibrary.pm ↑ Summary blib/lib/Test/FitNesse/Slim.pm »