MCPcopy Create free account
hub / github.com/CovenantSQL/CovenantSQL / TestNewBlockNode

Function TestNewBlockNode

sqlchain/blockindex_test.go:53–73  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

51}
52
53func TestNewBlockNode(t *testing.T) {
54 parent := newBlockNode(0, testBlocks[0], nil)
55
56 if parent == nil {
57 t.Fatal("unexpected result: nil")
58 } else if parent.parent != nil {
59 t.Fatalf("unexpected parent: %v", parent.parent)
60 } else if parent.count != 0 {
61 t.Fatalf("unexpected height: %d", parent.count)
62 }
63
64 child := newBlockNode(1, testBlocks[1], parent)
65
66 if child == nil {
67 t.Fatal("unexpected result: nil")
68 } else if child.parent != parent {
69 t.Fatalf("unexpected parent: %v", child.parent)
70 } else if child.count != parent.count+1 {
71 t.Fatalf("unexpected height: %d", child.count)
72 }
73}
74
75func TestInitBlockNode(t *testing.T) {
76 parent := newBlockNode(0, testBlocks[0], nil)

Callers

nothing calls this directly

Calls 3

FatalMethod · 0.80
FatalfMethod · 0.80
newBlockNodeFunction · 0.70

Tested by

no test coverage detected