Files
weave-scope/report/string_set_test.go
Tom Wilkie 6b56475766 Use ps.Map for Counters and Sets, remove Metadata in favour of Latest.
Also
- Add more complicated report.json for benchmark
- Break up report/topology.go
- Implement our own DeepEqual for ps.Map
2016-01-22 15:10:32 -08:00

27 lines
614 B
Go

package report_test
import (
"testing"
"github.com/weaveworks/scope/report"
)
func TestStringSetContains(t *testing.T) {
for _, testcase := range []struct {
contents []string
target string
want bool
}{
{nil, "foo", false},
{[]string{}, "foo", false},
{[]string{"a"}, "foo", false},
{[]string{"a", "foo"}, "foo", true},
{[]string{"foo", "b"}, "foo", true},
} {
have := report.MakeStringSet(testcase.contents...).Contains(testcase.target)
if testcase.want != have {
t.Errorf("%+v.Contains(%q): want %v, have %v", testcase.contents, testcase.target, testcase.want, have)
}
}
}