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

Function TestGetTwo

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

Source from the content-addressed store, hash-verified

309}
310
311func TestGetTwo(t *testing.T) {
312 kms.Unittest = true
313 utils.RemoveAll(testStorePath + "*")
314 kms.ResetBucket()
315
316 x, _ := InitConsistent(testStorePath, new(KMSStorage), false)
317 defer utils.RemoveAll(testStorePath + "*")
318 x.Add(NewNodeFromString("0000000000000000000000000000000000000000000000000000000000000000"))
319 x.Add(NewNodeFromString("1111111111111111111111111111111111111111111111111111111111111111"))
320 x.Add(NewNodeFromString("2222222222222222222222222222222222222222222222222222222222222222"))
321 a, b, err := x.GetTwoNeighbors("9999999999999999999999999999999999999999999999999999999999999999")
322 if err != nil {
323 t.Fatal(err)
324 }
325 if a.ID == b.ID {
326 t.Error("a shouldn't equal b")
327 }
328 if a.ID != "0000000000000000000000000000000000000000000000000000000000000000" {
329 t.Errorf("wrong a: %v", a)
330 }
331 if b.ID != "1111111111111111111111111111111111111111111111111111111111111111" {
332 t.Errorf("wrong b: %v", b)
333 }
334}
335
336func TestGetTwoEmpty(t *testing.T) {
337 kms.Unittest = true

Callers

nothing calls this directly

Calls 9

RemoveAllFunction · 0.92
ResetBucketFunction · 0.92
InitConsistentFunction · 0.85
NewNodeFromStringFunction · 0.85
GetTwoNeighborsMethod · 0.80
FatalMethod · 0.80
ErrorMethod · 0.80
ErrorfMethod · 0.80
AddMethod · 0.45

Tested by

no test coverage detected