aboutsummaryrefslogtreecommitdiffstats
path: root/consensus/ethash/algorithm_test.go
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2018-02-28 00:25:56 +0800
committerPéter Szilágyi <peterke@gmail.com>2018-02-28 00:25:56 +0800
commit17b0e226d3d6b3829a82ee1c142bd125cc9a0109 (patch)
treecbb284467bb1f59d8397c2430ab34722a05c4478 /consensus/ethash/algorithm_test.go
parentb574b5776695eb30e034fd8c7a468b3f03d4c6b9 (diff)
downloaddexon-17b0e226d3d6b3829a82ee1c142bd125cc9a0109.tar
dexon-17b0e226d3d6b3829a82ee1c142bd125cc9a0109.tar.gz
dexon-17b0e226d3d6b3829a82ee1c142bd125cc9a0109.tar.bz2
dexon-17b0e226d3d6b3829a82ee1c142bd125cc9a0109.tar.lz
dexon-17b0e226d3d6b3829a82ee1c142bd125cc9a0109.tar.xz
dexon-17b0e226d3d6b3829a82ee1c142bd125cc9a0109.tar.zst
dexon-17b0e226d3d6b3829a82ee1c142bd125cc9a0109.zip
travis, build, consensus: drop support for Go 1.7
Diffstat (limited to 'consensus/ethash/algorithm_test.go')
-rw-r--r--consensus/ethash/algorithm_test.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/consensus/ethash/algorithm_test.go b/consensus/ethash/algorithm_test.go
index a54f3b582..841e39233 100644
--- a/consensus/ethash/algorithm_test.go
+++ b/consensus/ethash/algorithm_test.go
@@ -30,6 +30,22 @@ import (
"github.com/ethereum/go-ethereum/core/types"
)
+// Tests whether the dataset size calculator works correctly by cross checking the
+// hard coded lookup table with the value generated by it.
+func TestSizeCalculations(t *testing.T) {
+ // Verify all the cache and dataset sizes from the lookup table.
+ for epoch, want := range cacheSizes {
+ if size := calcCacheSize(epoch); size != want {
+ t.Errorf("cache %d: cache size mismatch: have %d, want %d", epoch, size, want)
+ }
+ }
+ for epoch, want := range datasetSizes {
+ if size := calcDatasetSize(epoch); size != want {
+ t.Errorf("dataset %d: dataset size mismatch: have %d, want %d", epoch, size, want)
+ }
+ }
+}
+
// Tests that verification caches can be correctly generated.
func TestCacheGeneration(t *testing.T) {
tests := []struct {