MCPcopy Create free account
hub / github.com/DNAProject/DNA / TestStringSetDeleteMultiples

Function TestStringSetDeleteMultiples

p2pserver/common/set/string_set_test.go:50–71  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

48}
49
50func TestStringSetDeleteMultiples(t *testing.T) {
51 s := StringSet{}
52 s.Insert("a", "b", "c")
53 if len(s) != 3 {
54 t.Errorf("Expected len=3: %d", len(s))
55 }
56
57 s.Delete("a", "c")
58 if len(s) != 1 {
59 t.Errorf("Expected len=1: %d", len(s))
60 }
61 if s.Has("a") {
62 t.Errorf("Unexpected contents: %#v", s)
63 }
64 if s.Has("c") {
65 t.Errorf("Unexpected contents: %#v", s)
66 }
67 if !s.Has("b") {
68 t.Errorf("Missing contents: %#v", s)
69 }
70
71}
72
73func TestNewStringSet(t *testing.T) {
74 s := NewStringSet("a", "b", "c")

Callers

nothing calls this directly

Calls 4

InsertMethod · 0.95
DeleteMethod · 0.95
HasMethod · 0.95
ErrorfMethod · 0.80

Tested by

no test coverage detected