phist

package
v0.0.0-...-2658fe7 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2017 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ShouldAllFollow

func ShouldAllFollow(actual interface{}, expected ...interface{}) string

Same semantics as `ShouldAllPrecede`, in the opposite direction:

So(
	[]{"a", "b", "b", "b"},
	ShouldAllFollow,
	"b", "a",
) => true

func ShouldAllPrecede

func ShouldAllPrecede(actual interface{}, expected ...interface{}) string

Checks that all instances of an element occur before the first incident of another:

So(
	[]{"a", "a", "a", "b"},
	ShouldAllPrecede,
	"a", "b",
) => true

So(
	[]{"a", "a", "b", "a"},
	ShouldAllPrecede,
	"a", "b",
) => false

func ShouldOccurWithFrequency

func ShouldOccurWithFrequency(actual interface{}, expected ...interface{}) string

Checks that an element occurs $n times:

So(
	[]{"a", "c", "b", "c"},
	ShouldOccurWithFrequency,
	"c", 2,
) => true

func ShouldSequence

func ShouldSequence(actual interface{}, expected ...interface{}) string

Any slice which contains the elements in correct sequence passes:

So(
	[]{"a", "c", "b"},
	ShouldSequence,
	"a", "b",
) => true

Elements in an incorrect order fail:

So(
	[]{"b", "a", "c"},
	ShouldSequence,
	"a", "b",
) => false

When elements recur, as long as they could be pairwise ordered, they pass:

So(
	[]{"a", "c", "a", "b", "b"},
	ShouldSequence,
	"a", "b",
) => true

So(
	[]{"a", "c", "b", "b", "a"},
	ShouldSequence,
	"a", "b",
) => false

When elements recur, they must have the latter half at least as often as the first half:

So(
	[]{"a", "c", "a", "b", "e"},
	ShouldSequence,
	"a", "b",
) => false

Types

This section is empty.

Jump to

Keyboard shortcuts

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