Documentation ¶
Index ¶
- func ShouldAllFollow(actual interface{}, expected ...interface{}) string
- func ShouldAllPrecede(actual interface{}, expected ...interface{}) string
- func ShouldOccurWithFrequency(actual interface{}, expected ...interface{}) string
- func ShouldSequence(actual interface{}, expected ...interface{}) string
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.
Click to show internal directories.
Click to hide internal directories.