github.com/gochain-io/gochain@v2.2.26+incompatible/ethdb/db_test.go (about) 1 package ethdb_test 2 3 import ( 4 "testing" 5 6 "github.com/gochain-io/gochain/common" 7 "github.com/gochain-io/gochain/ethdb" 8 ) 9 10 func TestStaticPartitioner_Partition(t *testing.T) { 11 p := ethdb.StaticPartitioner{Name: "TEST"} 12 if v := p.Partition([]byte("foo")); v != "TEST" { 13 t.Fatalf("unexpected partition: %v", v) 14 } else if v := p.Partition([]byte("bar")); v != "TEST" { 15 t.Fatalf("unexpected partition: %v", v) 16 } 17 } 18 19 func TestBlockNumberPartitioner_Partition(t *testing.T) { 20 p := ethdb.NewBlockNumberPartitioner(100) 21 if v := p.Partition(numHashKey('t', 1234, common.Hash{})); v != `00000000000004b0` { 22 t.Fatalf("unexpected partition: %v", v) 23 } 24 }