1 // Copyright 2012 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
11 type lookupStrings struct {
14 n int // bytes consumed from input
17 type LookupTest struct {
18 lookup []lookupStrings
23 var lookupTests = []LookupTest{{
108 func lookup(c *ContractTrieSet, nnode int, s []uint8) (i, n int) {
109 scan := c.scanner(0, nnode, s)
114 func TestLookupContraction(t *testing.T) {
115 for i, tt := range lookupTests {
116 cts := ContractTrieSet(tt.tries)
117 for j, lu := range tt.lookup {
119 for _, s := range []string{str, str + "X"} {
120 const msg = `%d:%d: %s of "%s" %v; want %v`
121 offset, n := lookup(&cts, tt.n, []byte(s))
122 if offset != lu.offset {
123 t.Errorf(msg, i, j, "offset", s, offset, lu.offset)
126 t.Errorf(msg, i, j, "bytes consumed", s, n, len(str))