data

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Any

func Any[T any, S ~[]T](a, b S) differs.Data

Any creates data for comparing any type in two slices using utils.Equal.

Since utils.Equal may perform a reflection's deep equal, this may be slower than more specific data comparisons.

func Bytes

func Bytes(a, b []byte) differs.Data

Bytes creates data for comparing bytes in two slices.

func Chars

func Chars(a, b string) differs.Data

Chars creates data for comparing characters in two strings.

Warning: This does not handle escaped utf-8 sequences as a unit, this uses Go's default length and indexing for strings. For full unicode support use the Runes instead.

func Comparable

func Comparable[T comparable, S ~[]T](a, b S) differs.Data

Comparable creates data for comparing comparable data types in two slices.

This can be used for int64, uint64, or any other types that are comparable.

func Ints

func Ints(a, b []int) differs.Data

Ints creates data for comparing integers in two slices.

func New

func New(aCount, bCount int, equals func(aIndex, bIndex int) bool) *imp

New creates a comparer for comparing two collections of data.

The given counts are the size of the A and B data. The given equals function can be called for any index between zero and the count. `aIndex` is the index in the A data between zero and `aCount`. `bIndex` is the index in the B data between zero and `bCount`. The index pairs may be called in any order and multiple times.

func Regex

func Regex[T any](patterns []string, parts []T) differs.Data

Regex creates data for comparing a collection of parts against a collection of regular expressions.

This is designed for checking a set of results which have some variability against expected patterns for the result.

func RuneSlice

func RuneSlice(a, b [][]rune) differs.Data

RuneSlice creates data for comparing rune slices in two slices of slices.

This is similar to Strings except functions for unicode text.

func Runes

func Runes(a, b []rune) differs.Data

Runes creates data for comparing runes in two rune slices.

func Strings

func Strings(a, b []string) differs.Data

Strings creates data for comparing strings in two slices of strings.

This is they typical data used when since typically each string is a single line and the slices represent several lines in a whole document.

Types

This section is empty.

Jump to

Keyboard shortcuts

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