plan
tests
=> 7;
my
$project_path
= path(
$Bin
,
'data'
,
'chapter3'
);
my
$results_path
= path(
$project_path
,
'amcpresults'
);
unlink
$results_path
if
-e
$results_path
;
my
$am
= Algorithm::AM->new(
$project_path
,
commas
=>
'no'
,
gangs
=>
'no'
);
$am
->classify();
my
$results
= read_file(
$results_path
);
unlike_string(
$results
,
qr/\sx\s/
,
q{'-gangs => no' doesn't list gangs}
)
or diag
$results
;
unlink
$results_path
if
-e
$results_path
;
$am
->classify(
gangs
=>
'summary'
);
$results
= read_file(
$results_path
);
unlike_string(
$results
,
qr/3 1 0\s+myFirstCommentHere/
,
q{'-gangs => summary' doesn't list gang exemplars}
)
or diag
$results
;
like_string(
$results
,
qr/ 61.538%\s+8\s+3 1 2/
,
q{'-gangs => summary' lists gang effects}
)
or diag
$results
;
unlink
$results_path
if
-e
$results_path
;
$am
->classify(
gangs
=>
'yes'
);
$results
= read_file(
$results_path
);
like_string(
$results
,
qr/3 1 1\s+myFifthCommentHere/
,
q{'-gangs => summary' lists gang exemplars}
)
or diag
$results
;
like_string(
$results
,
qr/\s*23.077%\s+3\s+3 1 2/
,
q{'-gangs => summary' lists gang effects}
)
or diag
$results
;
unlink
$results_path
if
-e
$results_path
;
warning_is {
Algorithm::AM->new(
$project_path
,
commas
=>
'no'
,
gangs
=>
'whatever'
);
} {
carped
=>
q<Failed to specify option 'gangs' correctly>
},
q<warning for bad 'gangs' parameter>
;