MCPcopy Index your code
hub / github.com/CovenantSQL/CovenantSQL / TestGetMultipleRemove

Function TestGetMultipleRemove

consistent/consistent_test.go:255–284  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

253}
254
255func TestGetMultipleRemove(t *testing.T) {
256 kms.Unittest = true
257 utils.RemoveAll(testStorePath + "*")
258 kms.ResetBucket()
259
260 x, _ := InitConsistent(testStorePath, new(KMSStorage), false)
261 defer utils.RemoveAll(testStorePath + "*")
262 x.Add(NewNodeFromString("0000000000000000000000000000000000000000000000000000000000000000"))
263 x.Add(NewNodeFromString("1111111111111111111111111111111111111111111111111111111111111111"))
264 x.Add(NewNodeFromString("2222222222222222222222222222222222222222222222222222222222222222"))
265 for i, v := range rtestsBefore {
266 result, err := x.GetNeighbor(v.in)
267 if err != nil {
268 t.Fatal(err)
269 }
270 if string(result.ID) != v.out {
271 t.Errorf("%d. got %v, expected %v before rm", i, result, v.out)
272 }
273 }
274 x.Remove("1111111111111111111111111111111111111111111111111111111111111111")
275 for i, v := range rtestsAfter {
276 result, err := x.GetNeighbor(v.in)
277 if err != nil {
278 t.Fatal(err)
279 }
280 if string(result.ID) != v.out {
281 t.Errorf("%d. got %v, expected %v after rm", i, result, v.out)
282 }
283 }
284}
285
286func TestGetMultipleRemoveQuick(t *testing.T) {
287 kms.Unittest = true

Callers

nothing calls this directly

Calls 9

RemoveAllFunction · 0.92
ResetBucketFunction · 0.92
InitConsistentFunction · 0.85
NewNodeFromStringFunction · 0.85
GetNeighborMethod · 0.80
FatalMethod · 0.80
ErrorfMethod · 0.80
AddMethod · 0.45
RemoveMethod · 0.45

Tested by

no test coverage detected