MCPcopy
hub / github.com/canopy-network/canopy / newTestNode

Function newTestNode

store/smt_test.go:2068–2084  ·  view source on GitHub ↗

newTestNode creates a new node with the given key, value, left and right child keys

(k string, value []byte, leftChildKey, rightChildKey string)

Source from the content-addressed store, hash-verified

2066
2067// newTestNode creates a new node with the given key, value, left and right child keys
2068func newTestNode(k string, value []byte, leftChildKey, rightChildKey string) *node {
2069 // create the key bytes for the left child
2070 leftKey := keyBytesFromStr(leftChildKey)
2071 // create the key bytes for the right child
2072 rightKey := keyBytesFromStr(rightChildKey)
2073 // create the node
2074 return &node{
2075 Key: &key{
2076 key: keyBytesFromStr(k),
2077 },
2078 Node: lib.Node{
2079 Value: value,
2080 LeftChildKey: leftKey,
2081 RightChildKey: rightKey,
2082 },
2083 }
2084}
2085
2086// keyBytesFromStr converts a string of binary bits to a byte slice
2087// CONTRACT: str must be < than 8 bits

Callers 4

TestSetFunction · 0.85
TestDeleteFunction · 0.85
TestTraverseFunction · 0.85
TestStoreProofFunction · 0.85

Calls 1

keyBytesFromStrFunction · 0.85

Tested by

no test coverage detected