coverage

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BinaryProfile

type BinaryProfile map[PkgFile][]*BlockStats

BinaryProfile represents results generated dynamically it is named binary to distinguish with the original string-formatted profile.

func (BinaryProfile) Checksum

func (c BinaryProfile) Checksum() string

func (BinaryProfile) Clone

func (c BinaryProfile) Clone() BinaryProfile

func (BinaryProfile) ForeachBlock

func (c BinaryProfile) ForeachBlock(fn func(pkgFile string, data *BlockStats) bool)

func (BinaryProfile) Labels

func (c BinaryProfile) Labels() []string

func (BinaryProfile) MergeSameLoad

func (c BinaryProfile) MergeSameLoad(b BinaryProfile) error

before calling MergeSameLoad, you should call StaticChecksum to compare if two profiles have have the same static structure.

func (BinaryProfile) SortAll

func (c BinaryProfile) SortAll()

func (BinaryProfile) StaticChecksum

func (c BinaryProfile) StaticChecksum() string

StaticChecksum return's the profile's block info checksum, discarding dynamic counters. It can be used to check if two profile have the same static checksum to safely perform merge operation.

func (BinaryProfile) StaticChecksum_Col8bits

func (c BinaryProfile) StaticChecksum_Col8bits() string

StaticChecksum_Col8bits this is a temporary util method, for bugfix.

func (BinaryProfile) StaticFileChecksum

func (c BinaryProfile) StaticFileChecksum() map[string]string

StaticFileChecksum return's the profile's block info checksum, grouping by file

func (BinaryProfile) ToBlockProfile

func (c BinaryProfile) ToBlockProfile() BlockProfile

type BlockData

type BlockData struct {
	Block *model.Block
	Data  interface{}
}

BlockData provide a general way to process block stats.

func (*BlockData) GetBlock

func (c *BlockData) GetBlock() *model.Block

type BlockProfile

type BlockProfile map[PkgFile][]*BlockData

BlockProfile a general way to organize block

func (BlockProfile) Append

func (c BlockProfile) Append(pkgFile string, data *BlockData)

func (BlockProfile) ForeachBlock

func (c BlockProfile) ForeachBlock(fn func(pkgFile string, data *BlockData) bool)

func (BlockProfile) LeftJoin

func (c BlockProfile) LeftJoin(b BlockProfile, joint func(a interface{}, b interface{}) (r interface{}, ok bool)) BlockProfile

LeftJoin perform join operation on two profiles, identifying blocks are based on a. joint: if a,b not nil, they are joined together.

func (BlockProfile) MakeBlockMapping

func (c BlockProfile) MakeBlockMapping() map[PkgFile]map[model.Block]*BlockData

func (BlockProfile) SortAll

func (c BlockProfile) SortAll()

type BlockStats

type BlockStats struct {
	*model.Block

	// Count times execution reached
	Count map[string]int64 `json:"count"` // including empty label

}

func (*BlockStats) Add

func (c *BlockStats) Add(b merge.Counter) merge.Counter

Add implements merge.Counter

func (*BlockStats) Clone

func (c *BlockStats) Clone() *BlockStats

func (*BlockStats) GetBlock

func (c *BlockStats) GetBlock() *model.Block

func (*BlockStats) MergeBlockStats

func (c *BlockStats) MergeBlockStats(b *BlockStats) *BlockStats

MergeBlockStats add labels

type BlockStatsSlice

type BlockStatsSlice []*BlockStats

func (BlockStatsSlice) SortCopy

func (c BlockStatsSlice) SortCopy() BlockStatsSlice

type Detail

type Detail struct {
	// default
	Total       *Item `json:"total,omitempty"`
	Incrimental *Item `json:"incrimental,omitempty"` // typo, cannot easily be removed
	Incremental *Item `json:"incremental,omitempty"`
}

type Item

type Item struct {
	Value         string           `json:"value"`
	ValueNum      float64          `json:"valueNum"`
	Pass          bool             `json:"pass"`
	Total         int              `json:"total"`
	Covered       int              `json:"covered"`
	Threshold     string           `json:"threshold"`
	UncoveredList []*UncoveredItem `json:"uncoveredList"`
}

type Mode

type Mode string
const (
	Mode_Line    Mode = "line"
	Mode_Block   Mode = "block"
	Mode_Stmt    Mode = "stmt"
	Mode_Func    Mode = "func"
	Mode_File    Mode = "file"
	Mode_Package Mode = "package"
)

type PkgFile

type PkgFile = string // <PkgPath>/<ShortFilename>

type PkgPath

type PkgPath = string

type ShortFilename

type ShortFilename = string // xxx.go

type Summary

type Summary struct {
	// the default coverage
	*Detail

	Details map[Mode]*Detail `json:"details,omitempty"`
}

type UncoveredItem

type UncoveredItem struct {
	File string `json:"file"`
	Line int    `json:"line"`
	Func string `json:"func"`
}

Jump to

Keyboard shortcuts

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