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

Function TestGetTwoOnlyTwoQuick

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

Source from the content-addressed store, hash-verified

383}
384
385func TestGetTwoOnlyTwoQuick(t *testing.T) {
386 kms.Unittest = true
387 utils.RemoveAll(testStorePath + "*")
388 kms.ResetBucket()
389
390 x, _ := InitConsistent(testStorePath, new(KMSStorage), false)
391 defer utils.RemoveAll(testStorePath + "*")
392 x.Add(NewNodeFromString("0000000000000000000000000000000000000000000000000000000000000000"))
393 x.Add(NewNodeFromString("1111111111111111111111111111111111111111111111111111111111111111"))
394 f := func(s string) bool {
395 a, b, err := x.GetTwoNeighbors(s)
396 if err != nil {
397 t.Logf("error: %v", err)
398 return false
399 }
400 if a.ID == b.ID {
401 t.Log("a.ID == b.ID")
402 return false
403 }
404 if a.ID != "0000000000000000000000000000000000000000000000000000000000000000" && a.ID != "1111111111111111111111111111111111111111111111111111111111111111" {
405 t.Logf("invalid a: %v", a)
406 return false
407 }
408
409 if b.ID != "0000000000000000000000000000000000000000000000000000000000000000" && b.ID != "1111111111111111111111111111111111111111111111111111111111111111" {
410 t.Logf("invalid b: %v", b)
411 return false
412 }
413 return true
414 }
415 if err := quick.Check(f, nil); err != nil {
416 t.Fatal(err)
417 }
418}
419
420func TestGetTwoOnlyOneInCircle(t *testing.T) {
421 kms.Unittest = true

Callers

nothing calls this directly

Calls 8

RemoveAllFunction · 0.92
ResetBucketFunction · 0.92
InitConsistentFunction · 0.85
NewNodeFromStringFunction · 0.85
GetTwoNeighborsMethod · 0.80
FatalMethod · 0.80
CheckMethod · 0.65
AddMethod · 0.45

Tested by

no test coverage detected