Skip to content
This repository was archived by the owner on Oct 11, 2024. It is now read-only.

Commit c6d6046

Browse files
committed
Adjust tests for off-by-one TreeRevision starts at 1 now
1 parent 7f664f9 commit c6d6046

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

core/tree/sparse/common.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ func NodeValues(mapID int64, hasher hashers.MapHasher, bindex string, value []by
4747
levels := len(bindex) + 1
4848
steps := len(bindex)
4949
nodeValues := make([]Hash, levels)
50-
index, depth := tree.InvertBitString(bindex)
51-
nodeValues[0] = hasher.HashLeaf(mapID, index, depth, value)
50+
index, _ := tree.InvertBitString(bindex)
51+
nodeValues[0] = hasher.HashLeaf(mapID, index, value)
5252
// assert len(nbrValues) == levels - 1
5353
for i := 0; i < steps; i++ {
5454
// Is the last node 0 or 1?

core/tree/sparse/common_test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ package sparse
1616

1717
import (
1818
"testing"
19+
20+
"github.com/google/trillian/merkle/coniks"
1921
)
2022

2123
func TestComputeNodeValues(t *testing.T) {
@@ -27,7 +29,7 @@ func TestComputeNodeValues(t *testing.T) {
2729
}{
2830
{"0100", []byte(""), make([]Hash, 4), []string{"0100", "010", "01", "0", ""}},
2931
} {
30-
actual := NodeValues(0, CONIKSHasher, tc.bindex, tc.leafHash, tc.neighbors)
32+
actual := NodeValues(0, coniks.Default, tc.bindex, tc.leafHash, tc.neighbors)
3133
if got, want := len(actual), len(tc.expected); got != want {
3234
t.Errorf("len(%v)=%v, want %v", actual, got, want)
3335
}

integration/client_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ func TestListHistory(t *testing.T) {
249249
}
250250

251251
if got := sortHistory(resp); !reflect.DeepEqual(got, tc.wantHistory) {
252-
t.Errorf("ListHistory(%v, %v): \n%v, want \n%v", tc.start, tc.end, got, tc.wantHistory)
252+
t.Errorf("ListHistory(%v, %v): %x, want %x", tc.start, tc.end, got, tc.wantHistory)
253253
}
254254
}
255255
}
@@ -263,7 +263,7 @@ func (e *Env) setupHistory(ctx context.Context, userID string, signers []signatu
263263
// Note that profile 5 is submitted twice by the user to test that
264264
// filtering case.
265265
for i, p := range [][]byte{
266-
nil, nil, cp(1), cp(2), nil, nil, cp(3), nil,
266+
nil, cp(1), cp(2), nil, nil, cp(3), nil,
267267
cp(4), cp(5), cp(5), nil, nil, nil, nil, cp(6),
268268
nil, cp(5), cp(7), nil,
269269
} {

0 commit comments

Comments
 (0)