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:
Dave Collins 2013-10-13 22:03:50 -05:00
parent 670d83a74e
commit 6eebf02183

View file

@ -89,6 +89,19 @@ func testInterface(t *testing.T, dbType string) {
return 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 // TODO(davec): Need to figure out how to handle the special checks