| 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
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 31 | my $argument = shift @ARGV; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 31 | ▶ | if ($argument eq '-v') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 2 | $verbose = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | elsif ($argument eq '-s') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 6 | ▶ | die usage if defined($statement_timeout) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
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
defined $statement_timeout or not @ARGV or not $ARGV[0] =~ /\A[1-9][0-9]{0,8}\z/
defined $statement_timeout or not @ARGV
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
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 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
Condition100%3/3
$bind_address_set or not @ARGV
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
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 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
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
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 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
Condition66%2/3
defined $port and $port =~ /\A[0-9]+\z/
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/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 14 | ▶ | die usage if $bind_address_set && $port eq '1'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$bind_address_set and $port eq 1
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
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 13 | ▶ | Test::FitNesse::Slim::Server->new( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | verbose => $verbose, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | statement_timeout => $statement_timeout, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | ($bind_address_set ? (bind_address => $bind_address) : ()), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | )->run($port); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||