1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
|
package integration
import (
"strconv"
"testing"
"time"
)
func assertDateSet(t *testing.T, compared *time.Time) {
emptyTime := time.Time{}
if compared == nil || *compared == emptyTime {
t.Errorf("Expected date to be set, got %v", compared)
}
}
func assertSliceContains[T comparable](t *testing.T, slice []T, target T) {
for _, v := range slice {
if v == target {
return
}
}
t.Fatalf("value %v not found in slice", target)
}
func minInt(a, b int) int {
if a < b {
return a
}
return b
}
// return the current nanosecond in string type as a unique text.
func getUniqueText() string {
return strconv.FormatInt(time.Now().UnixNano(), 10)
}
|