common

package
v1.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 2, 2020 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DataSet

type DataSet []FileData

DataSet is a list of FileData instances. It implements sort.Interface, and thus is capable of being sorted by handle.

func (DataSet) Len

func (ds DataSet) Len() int

Len returns the number of elements in the data set.

func (DataSet) Less

func (ds DataSet) Less(i, j int) bool

Less reports whether the element with index i should sort before the element with index j.

func (DataSet) Merge

func (ds DataSet) Merge(other DataSet) (DataSet, DataSet)

Merge is a utility function that merges a list of FileData instances with another FileData list. It ensures that the Count fields are the same and picks an Exec field. It returns the resulting list, along with a list of FileData where Count did not match; the order will match the elements of a first, followed by any elements of b which did not appear in a.

func (DataSet) Reduce

func (ds DataSet) Reduce() DataSet

Reduce is a utility function that reduces a list of FileData instances into a list of FileData instances that only contain counts for packages.

func (DataSet) Sum

func (ds DataSet) Sum() FileData

Sum is a utility function similar to Reduce, but it reduces a list of FileData instances down to a single summarizing FileData.

func (DataSet) Swap

func (ds DataSet) Swap(i, j int)

Swap swaps the two elements with the specified indexes.

type FileData

type FileData struct {
	Package string // Name of the package
	Name    string // Name of the file (basename)
	Count   int64  // Number of statements in the file
	Exec    int64  // Number of statements in the file that were executed
}

FileData contains the summarized data about the file, including its package, its base name, the total number of statements, and the number of executed statements.

func (FileData) Coverage

func (fd FileData) Coverage() float64

Coverage reports the coverage of the file as a float.

func (FileData) Handle

func (fd FileData) Handle() string

Handle reports a handle for the FileData record. This is typically the full file name, including package, but it could be just the package name, or the empty string.

func (FileData) String

func (fd FileData) String() string

String reports the coverage of the entity described by the FileData object.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL