From b46d53c18e16396bbe4b554d6c0935f3f9f1925a Mon Sep 17 00:00:00 2001 From: Dale Rahn Date: Thu, 1 Aug 2013 15:03:26 -0400 Subject: [PATCH] Test NewestSha() --- sqlite3/operational_test.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/sqlite3/operational_test.go b/sqlite3/operational_test.go index 8569ae15..b7208f97 100644 --- a/sqlite3/operational_test.go +++ b/sqlite3/operational_test.go @@ -140,6 +140,20 @@ out: t.Errorf("height mismatch expect %v returned %v", height, newheight) break out } + + newSha, blkid, err := db.NewestSha() + if err != nil { + t.Errorf("failed to obtain latest sha %v %v", height, err) + } + + if blkid != height { + t.Errorf("height doe not match latest block height %v %v", blkid, height, err) + } + + blkSha, _ := block.Sha() + if *newSha != *blkSha { + t.Errorf("Newest block sha does not match freshly inserted one %v %v ", newSha, blkSha, err) + } } switch mode {