glcov/coverage
Types
pub type FileCoverage {
FileCoverage(
module: String,
source: String,
lines: List(#(Int, Bool)),
functions: List(FunctionCoverage),
)
}
Constructors
-
FileCoverage( module: String, source: String, lines: List(#(Int, Bool)), functions: List(FunctionCoverage), )
pub type FunctionCoverage {
FunctionCoverage(
name: String,
arity: Int,
line: Int,
calls: Int,
)
}
Constructors
-
FunctionCoverage(name: String, arity: Int, line: Int, calls: Int)
pub type Report {
Report(files: List(FileCoverage))
}
Constructors
-
Report(files: List(FileCoverage))
Values
pub fn covered_functions(report: Report) -> Int
pub fn covered_lines(report: Report) -> Int
pub fn file_covered_count(lines: List(#(Int, Bool))) -> Int
pub fn file_percentage_bp(lines: List(#(Int, Bool))) -> Int
pub fn file_percentage_string(
lines: List(#(Int, Bool)),
) -> String
pub fn format_counts(covered: Int, total: Int) -> String
pub fn from_modules(
modules: List(#(String, String, List(#(Int, Bool)))),
) -> Report
Build a report from {module, source, [{line, covered}]} entries.
Sources are already relative to the project root by the time they reach this function; empty sources are dropped and all other files are sorted for deterministic output.
pub fn from_modules_with_functions(
modules: List(#(String, String, List(#(Int, Bool)))),
function_rows: List(#(String, String, Int, Int, Int)),
) -> Report
Build a report with line and function coverage.
Function rows are {source, name, line, arity, calls}.
pub fn from_source_lines(
sources: List(#(String, List(#(Int, Bool)))),
) -> Report
pub fn line_count(lines: List(#(Int, Bool))) -> Int
pub fn meets_minimum(report: Report, min_bp: Int) -> Bool
Exact comparison, independent of floating point rounding.
pub fn percentage_bp(report: Report) -> Int
Total coverage in basis points, rounded down. 0 when there is no data.
pub fn percentage_string(report: Report) -> String
pub fn total_functions(report: Report) -> Int
pub fn total_lines(report: Report) -> Int
pub fn uncovered_lines(report: Report) -> Int