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

Function TestStringGet

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

Source from the content-addressed store, hash-verified

106}
107
108func TestStringGet(t *testing.T) {
109 setValue(t, TestExistKey, value)
110 tests := []struct {
111 name string
112 key []byte
113 value []byte
114 want []byte
115 }{
116 {
117 name: "TestString_GetExitKey",
118 key: TestExistKey,
119 value: value,
120 want: value,
121 },
122 {
123 name: "TestString_GetNoExitKey",
124 key: TestNoExistKey,
125 value: nil,
126 want: nil,
127 },
128 }
129 for _, tt := range tests {
130 t.Run(tt.name, func(t *testing.T) {
131 callFunc := func(txn *Transaction) {
132 s, err := GetString(txn, tt.key)
133 assert.NoError(t, err)
134 got, err := s.Get()
135 assert.Equal(t, got, tt.want)
136 }
137 MockTest(t, callFunc)
138 })
139 }
140}
141
142func TestStringSet(t *testing.T) {
143 var exp = []int64{int64(2 * time.Second)}

Callers

nothing calls this directly

Calls 4

setValueFunction · 0.85
GetStringFunction · 0.85
MockTestFunction · 0.85
GetMethod · 0.80

Tested by

no test coverage detected