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

Function TestGetNextVerifier

sqlchain/storageproof_test.go:82–103  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

80}
81
82func TestGetNextVerifier(t *testing.T) {
83 verifier, err := getNextVerifier(previousBlock, currentBlock)
84 if err != nil {
85 t.Error(err)
86 }
87 wantedVerifier := int32(hash.FNVHash32uint([]byte(previousBlock.ID))) % int32(len(currentBlock.Nodes))
88 if verifier != wantedVerifier {
89 t.Errorf("the next verifier is %d, should be %d", verifier, wantedVerifier)
90 }
91
92 // void previousBlock
93 verifier, err = getNextVerifier(voidBlock, currentBlock)
94 if err == nil {
95 t.Errorf("verifier is %d, but should be failed", verifier)
96 }
97
98 // void currentBlock
99 verifier, err = getNextVerifier(previousBlock, voidBlock)
100 if err == nil {
101 t.Errorf("verifier is %d, but should be failed", verifier)
102 }
103}
104
105func TestSelectRecord(t *testing.T) {
106 if strings.Compare(selectRecord(0), "hello world") != 0 {

Callers

nothing calls this directly

Calls 4

FNVHash32uintFunction · 0.92
getNextVerifierFunction · 0.85
ErrorMethod · 0.80
ErrorfMethod · 0.80

Tested by

no test coverage detected