set/set_test.go

22 lines
523 B
Go

package set
import (
"testing"
"code.wmdillon.com/wmdillon/set/simpleset"
"code.wmdillon.com/wmdillon/set/threadsafeset"
)
func TestNew(t *testing.T) {
wantThreadsafe := false
set := New[string](wantThreadsafe)
if _, ok := set.(*simpleset.Set[string]); !ok {
t.Fatalf("error: wanted *simpleset.Set[string]; got %T\n", set)
}
wantThreadsafe = true
set = New[string](wantThreadsafe)
if _, ok := set.(*threadsafeset.Set[string]); !ok {
t.Fatalf("error: wanted *threadsafeset.Set[string]; got %T\n", set)
}
}