utils

package
v0.0.0-...-4cdc79c Latest Latest
Warning

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

Go to latest
Published: May 13, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetNonEmptyLines

func GetNonEmptyLines(output string) []string

GetNonEmptyLines converts given command output string into individual objects according to line breakers, and ignores the empty elements in it.

func GetProjectDir

func GetProjectDir() (string, error)

GetProjectDir will return the directory where the project is It finds the project root by looking for go.mod file

func Run

func Run(cmd *exec.Cmd) (string, error)

Run executes the provided command within this context

Types

type UniquenessTestStats

type UniquenessTestStats struct {
	GeneratedCount int           // Number of items successfully generated (TotalAttempts - ErrorCount).
	UniqueCount    int           // Number of unique items among successfully generated ones.
	DuplicateCount int           // Number of duplicate items found among successfully generated ones.
	ErrorCount     int           // Number of errors encountered during generation.
	ActualDuration time.Duration // Total time taken for the test.
}

UniquenessTestStats holds the results from the PerformUniquenessAndPerformanceTest.

func PerformUniquenessAndPerformanceTest

func PerformUniquenessAndPerformanceTest(
	iterations int,
	generatorFunc func() (string, error),
) UniquenessTestStats

PerformUniquenessAndPerformanceTest - a utility for functions that produce a string with randomly-generated part for uniqueness - runs a generator function multiple times, checks for uniqueness using the sort-and-scan method, counts errors, and measures performance (maybe useful for the future).

Jump to

Keyboard shortcuts

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