mirror of
https://github.com/bloeys/nset.git
synced 2025-12-29 06:28:19 +00:00
37 lines
526 B
Go
Executable File
37 lines
526 B
Go
Executable File
package nlookup_test
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/bloeys/nlookup"
|
|
)
|
|
|
|
func TestNLookup(t *testing.T) {
|
|
|
|
n := nlookup.NewNLookup[uint]()
|
|
|
|
IsEq(t, 1, cap(n.Data))
|
|
|
|
}
|
|
|
|
func AllTrue(t *testing.T, values ...bool) bool {
|
|
|
|
for i := 0; i < len(values); i++ {
|
|
if !values[i] {
|
|
t.Errorf("Expected 'true' but got 'false'\n")
|
|
}
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
func IsEq[T comparable](t *testing.T, expected, val T) bool {
|
|
|
|
if val == expected {
|
|
return true
|
|
}
|
|
|
|
t.Errorf("Expected '%v' but got '%v'\n", expected, val)
|
|
return false
|
|
}
|