MCPcopy Create free account
hub / github.com/distributedio/titan / TestStringExist

Function TestStringExist

db/string_test.go:247–278  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

245}
246
247func TestStringExist(t *testing.T) {
248 setValue(t, TestExistKey, value)
249 // write exist string
250 tests := []struct {
251 name string
252 key []byte
253 want bool
254 }{
255 {
256 name: "Exist",
257 key: TestExistKey,
258 want: true,
259 },
260 {
261 name: "NoExist",
262 key: TestNoExistKey,
263 want: false,
264 },
265 }
266 for _, tt := range tests {
267 t.Run(tt.name, func(t *testing.T) {
268 callFunc := func(txn *Transaction) {
269 s, err := GetString(txn, tt.key)
270 assert.NoError(t, err)
271 got := s.Exist()
272 assert.Equal(t, tt.want, got)
273 }
274 MockTest(t, callFunc)
275 })
276 }
277
278}
279
280func TestStringAppend(t *testing.T) {
281 setValue(t, TestExistKey, value)

Callers

nothing calls this directly

Calls 4

setValueFunction · 0.85
GetStringFunction · 0.85
MockTestFunction · 0.85
ExistMethod · 0.65

Tested by

no test coverage detected