This commit is contained in:
Roy Crihfield 2022-02-24 22:56:27 +08:00
parent f6d9fa992d
commit 08614e0941

View File

@ -17,10 +17,8 @@ func TestMakePaths(t *testing.T) {
for i := 0; i < 4; i++ { for i := 0; i < 4; i++ {
nbins := uint(1) << i nbins := uint(1) << i
paths := iter.MakePaths(prefix, nbins) paths := iter.MakePaths(prefix, nbins)
t.Log(paths)
if len(paths) != int(nbins) { if len(paths) != int(nbins) {
t.Logf("failed: TestMakePaths") t.Errorf("wrong number of paths; expected %d, have %d", nbins, len(paths))
t.Error("wrong number of paths", len(paths))
} }
} }
} }
@ -83,8 +81,7 @@ func TestIterator(t *testing.T) {
iters := iter.SubtrieIterators(tree, nbins) iters := iter.SubtrieIterators(tree, nbins)
ix := 0 ix := 0
for b := uint(0); b < nbins; b++ { for b := uint(0); b < nbins; b++ {
it := iters[b] for it := iters[b]; it.Next(true); ix++ {
for ; it.Next(true); ix++ {
if !bytes.Equal(allPaths[ix], it.Path()) { if !bytes.Equal(allPaths[ix], it.Path()) {
t.Fatalf("wrong path value\nexpected:\t%v\nactual:\t\t%v", t.Fatalf("wrong path value\nexpected:\t%v\nactual:\t\t%v",
allPaths[ix], it.Path()) allPaths[ix], it.Path())