Add interface test for FetchBlockShaByHeight.
This commit adds an interface test for FetchBlockShaByHeight to ensure it returns the same expected hash for each block inserted block height.
This commit is contained in:
parent
670d83a74e
commit
6eebf02183
1 changed files with 13 additions and 0 deletions
|
@ -89,6 +89,19 @@ func testInterface(t *testing.T, dbType string) {
|
|||
return
|
||||
}
|
||||
|
||||
// Ensure the hash returned for the block by its height is the
|
||||
// expected value.
|
||||
hashFromDb, err := db.FetchBlockShaByHeight(height)
|
||||
if err != nil {
|
||||
t.Errorf("FetchBlockShaByHeight: %v", err)
|
||||
return
|
||||
}
|
||||
if !hashFromDb.IsEqual(expectedHash) {
|
||||
t.Errorf("FetchBlockShaByHeight: returned hash does "+
|
||||
"not match expected value - got: %v, want: %v",
|
||||
hashFromDb, expectedHash)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
// TODO(davec): Need to figure out how to handle the special checks
|
||||
|
|
Loading…
Reference in a new issue