test

package
v0.0.0-...-1708c0c Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2021 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckAllOccurrences

func CheckAllOccurrences(t *testing.T, x, p string, occ []int) bool

CheckAllOccurrences Tests if string p occurrs at all indices in occ. Reports an error to t otherwise

func CheckOccurrenceAt

func CheckOccurrenceAt(t *testing.T, x, p string, i int) bool

CheckOccurrenceAt tests if string p occurrs at index i in string x and reports an error to t otherwise

func CheckSAIndices

func CheckSAIndices(t *testing.T, x string, sa []int32) bool

CheckSAIndices checks that the suffix array sa has all the indices in x (plus one for the sentinel if len(sa) == len(x) + 1). Reports an error to t otherwise

func CheckSASorted

func CheckSASorted(t *testing.T, x string, sa []int32) bool

CheckSASorted checks if a suffix array sa actually represents the sorted suffix in the string x. Reports errors to t.

func CheckSuffixArray

func CheckSuffixArray(t *testing.T, x string, sa []int32) bool

CheckSuffixArray runs all the consistency checks for suffix array sa over string x, reporting errors to t.

func FibonacciString

func FibonacciString(n int) string

FibonacciString returns the n'th Fibonacci string.

func GenerateRandomTestStrings

func GenerateRandomTestStrings(
	min, max int,
	rng *rand.Rand,
	callback func(x string))

GenerateRandomTestStrings generates strings of length between min and max and calls callback with them.

func GenerateSingletonTestStrings

func GenerateSingletonTestStrings(
	min, max int,
	rng *rand.Rand,
	callback func(x string))

GenerateSingletonTestStrings generate singeton strings with length between min and max

func GenerateTestStrings

func GenerateTestStrings(
	min, max int,
	rng *rand.Rand,
	callback func(x string))

GenerateTestStrings generates strings of length between min and max and calls callback with them.

func GenerateTestStringsAndPatterns

func GenerateTestStringsAndPatterns(min, max int, rng *rand.Rand, callback func(x, p string))

GenerateTestStringsAndPatterns generates a set of strings (x, p) where x is a string to search in and p is a string to search for.

func IntArraysEqual

func IntArraysEqual(a, b []int) bool

IntArraysEqual tests if arrays a and b are equal.

func IsPrefix

func IsPrefix(x, y string) bool

IsPrefix tests if string x is a prefix of y

func NewRandomSeed

func NewRandomSeed(tb testing.TB) *rand.Rand

NewRandomSeed creates a new random number generator

func OccurrenceAt

func OccurrenceAt(x, p string, i int) bool

OccurrenceAt returns if string p occurrs at index i in string x.

func PickRandomPrefix

func PickRandomPrefix(x string, rng *rand.Rand) string

PickRandomPrefix returns a random prefix of the string x.

func PickRandomSubstring

func PickRandomSubstring(x string, rng *rand.Rand) string

PickRandomSubstring returns a random substring of the string x.

func PickRandomSuffix

func PickRandomSuffix(x string, rng *rand.Rand) string

PickRandomSuffix returns a random sufix of the string x.

func RandomStringN

func RandomStringN(n int, alpha string, rng *rand.Rand) string

RandomStringN constructs a random string of length in n, over the alphabet alpha.

func RandomStringRange

func RandomStringRange(min, max int, alpha string, rng *rand.Rand) string

RandomStringRange constructs a random string of length in [min, max), over the alphabet alpha.

func SingletonString

func SingletonString(n int, a byte) string

SingletonString generates a string of length n consisting only of the letter a

Types

This section is empty.

Jump to

Keyboard shortcuts

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