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

Function TestInitBlockNode

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

Source from the content-addressed store, hash-verified

73}
74
75func TestInitBlockNode(t *testing.T) {
76 parent := newBlockNode(0, testBlocks[0], nil)
77 if parent == nil {
78 t.Fatal("unexpected result: nil")
79 } else if parent.parent != nil {
80 t.Fatalf("unexpected parent: %v", parent.parent)
81 } else if parent.count != 0 {
82 t.Fatalf("unexpected height: %d", parent.count)
83 }
84
85 child := newBlockNode(1, testBlocks[1], parent)
86 if child == nil {
87 t.Fatal("unexpected result: nil")
88 } else if child.parent != parent {
89 t.Fatalf("unexpected parent: %v", child.parent)
90 } else if child.count != parent.count+1 {
91 t.Fatalf("unexpected height: %d", child.count)
92 }
93}
94
95func TestAncestor(t *testing.T) {
96 index := newBlockIndex()

Callers

nothing calls this directly

Calls 3

FatalMethod · 0.80
FatalfMethod · 0.80
newBlockNodeFunction · 0.70

Tested by

no test coverage detected