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

Function TestStringSet

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

Source from the content-addressed store, hash-verified

26)
27
28func TestStringSet(t *testing.T) {
29 s := StringSet{}
30 if s.Len() != 0 {
31 t.Errorf("Expected len=0: %d", len(s))
32 }
33 s.Insert("a", "b")
34 if s.Len() != 2 {
35 t.Errorf("Expected len=2: %d", len(s))
36 }
37 s.Insert("c")
38 if s.Has("d") {
39 t.Errorf("Unexpected contents: %#v", s)
40 }
41 if !s.Has("a") {
42 t.Errorf("Missing contents: %#v", s)
43 }
44 s.Delete("a")
45 if s.Has("a") {
46 t.Errorf("Unexpected contents: %#v", s)
47 }
48}
49
50func TestStringSetDeleteMultiples(t *testing.T) {
51 s := StringSet{}

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected