mirror of
https://github.com/tailscale/tailscale.git
synced 2024-12-02 06:25:37 +00:00
25 lines
395 B
Go
25 lines
395 B
Go
|
// Copyright (c) Tailscale Inc & AUTHORS
|
||
|
// SPDX-License-Identifier: BSD-3-Clause
|
||
|
|
||
|
package set
|
||
|
|
||
|
import "testing"
|
||
|
|
||
|
func TestSet(t *testing.T) {
|
||
|
s := Set[int]{}
|
||
|
s.Add(1)
|
||
|
s.Add(2)
|
||
|
if !s.Contains(1) {
|
||
|
t.Error("missing 1")
|
||
|
}
|
||
|
if !s.Contains(2) {
|
||
|
t.Error("missing 2")
|
||
|
}
|
||
|
if s.Contains(3) {
|
||
|
t.Error("shouldn't have 3")
|
||
|
}
|
||
|
if s.Len() != 2 {
|
||
|
t.Errorf("wrong len %d; want 2", s.Len())
|
||
|
}
|
||
|
}
|