summary_row(ModuleGroup, [], [Preds,CovPreds,IntPreds,Clauses,CovClauses,IntClauses]) :-
PercentageClauses1 is CovClauses*100/(Clauses-IntClauses),
RoundedClauses is round(PercentageClauses1*10),
PercentageClauses is RoundedClauses/10,
(PercentageClauses > 100 -> junit_coverage_report_error(coverage_tables,'Covered more than 100% of all Clauses') ; true),
PercentagePreds1 is CovPreds*100/(Preds-IntPreds),
RoundedPreds is round(PercentagePreds1*10),
PercentagePreds is RoundedPreds/10,
(PercentagePreds > 100 -> junit_coverage_report_error(coverage_tables,'Covered more than 100% of all Clauses') ; true),
add_row(ModuleGroup, [summary,Clauses,CovClauses,IntClauses,PercentageClauses,Preds,CovPreds,IntPreds,PercentagePreds], [bold]),
assertz(summary_row(ModuleGroup,Clauses,CovClauses,IntClauses,PercentageClauses,Preds,CovPreds,IntPreds,PercentagePreds)).
summary_row(ModuleGroup, [file_data(File,Preds,CovPreds,Clauses,CovClauses,CoveredLines,_,_)|T],[CPreds,CCovPreds,CFailPreds,CClauses,CCovClauses,CFailClauses]) :-
allowed_file(File), !,
get_modulename_filename(File, Module),
(get_module_info(Module, group, ModuleGroupFile) ; ModuleGroupFile = other),
( ModuleGroup = ModuleGroupFile ->
( NCPreds is CPreds + Preds,
NCCovPreds is CCovPreds + CovPreds,
NCClauses is CClauses + Clauses,
NCCovClauses is CCovClauses + CovClauses,
uncoverable_preds(File,IntPreds),
uncoverable_clauses(File,IntClauses,CoveredLines),
NCFailPreds is IntPreds + CFailPreds,
NCFailClauses is IntClauses + CFailClauses,
summary_row(ModuleGroup,T,[NCPreds,NCCovPreds,NCFailPreds,NCClauses,NCCovClauses,NCFailClauses])
)
; summary_row(ModuleGroup,T,[CPreds,CCovPreds,CFailPreds,CClauses,CCovClauses,CFailClauses])
).
summary_row(ModuleGroup, [_H|T],[CPreds,CCovPreds,CFailPreds,CClauses,CCovClauses,CFailClauses]) :-
summary_row(ModuleGroup,T,[CPreds,CCovPreds,CFailPreds,CClauses,CCovClauses,CFailClauses]).