MCPcopy Create free account
hub / github.com/ByteStorage/FlyDB / TestSetStructure_exists

Function TestSetStructure_exists

structure/set_test.go:969–1032  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

967}
968
969func TestSetStructure_exists(t *testing.T) {
970 tests := []struct {
971 name string
972 setup func(*SetStructure)
973 key string
974 members []string
975 found bool
976 }{
977 {
978 name: "test when empty Set",
979 setup: func(s *SetStructure) {},
980 key: "testKey",
981 members: []string{"key1", "key2"},
982 found: false,
983 },
984 {
985 name: "test Set with no members found",
986 setup: func(s *SetStructure) {
987 _ = s.SAdds("testKey", 0, "non1", "non2")
988 },
989 key: "testKey",
990 members: []string{"key1", "key2"},
991 found: false,
992 },
993 {
994 name: "test Set with partial members found",
995 setup: func(s *SetStructure) {
996 _ = s.SAdds("testKey", 0, "key1", "non2")
997 },
998 key: "testKey",
999 members: []string{"key1", "key2"},
1000 found: false,
1001 },
1002 {
1003 name: "test Set with all members found",
1004 setup: func(s *SetStructure) {
1005 _ = s.SAdds("testKey", 0, "key1", "non2", "key2")
1006 },
1007 key: "testKey",
1008 members: []string{"key1", "key2"},
1009 found: true,
1010 },
1011 {
1012 name: "test Set key empty",
1013 setup: func(s *SetStructure) {
1014 _ = s.SAdds("testKey", 0, "key1", "non2", "key2")
1015 },
1016 key: "",
1017 members: []string{"key1", "key2"},
1018 found: false,
1019 },
1020 }
1021 for _, tt := range tests {
1022 t.Run(tt.name, func(t *testing.T) {
1023 s, _ := initTestSetDb()
1024 tt.setup(s)
1025 if tt.found {
1026 assert.True(t, s.exists(tt.key, tt.members...))

Callers

nothing calls this directly

Calls 3

initTestSetDbFunction · 0.85
SAddsMethod · 0.65
existsMethod · 0.45

Tested by

no test coverage detected