Skip to content
Snippets Groups Projects
Commit 867249e8 authored by Richard T. Carback III's avatar Richard T. Carback III
Browse files

Partially fix TestLoadKnownRounds to set the correct size.

parent 648f3979
No related branches found
No related tags found
No related merge requests found
......@@ -47,8 +47,11 @@ func TestLoadKnownRounds(t *testing.T) {
}
// Check rounds in the buffer and save the key value store
expectedKR.rounds.Check(id.Round(0))
for i := 0; i < (size * 64); i++ {
if i%7 == 0 {
t.Errorf("%+v",
expectedKR.rounds)
expectedKR.rounds.Check(id.Round(i))
}
}
......@@ -57,15 +60,19 @@ func TestLoadKnownRounds(t *testing.T) {
t.Fatalf("Error saving KnownRounds: %v", err)
}
kr, err := LoadKnownRounds(rootKv, expectedKR.key, size)
// *63 here instead of *64 because the calculation on the initializer
// in primitives is weird, and we need the exact size for DeepEqual
kr, err := LoadKnownRounds(rootKv, expectedKR.key, size*63)
if err != nil {
t.Errorf("LoadKnownRounds() returned an error."+
"\n\texpected: %v\n\treceived: %v", nil, err)
"\n\texpected: %v\n\treceived: %+v", nil, err)
}
if !reflect.DeepEqual(expectedKR, kr) {
t.Errorf("LoadKnownRounds() returned an incorrect KnownRounds."+
"\n\texpected: %+v\n\treceived: %+v", expectedKR, kr)
t.Errorf("%+v != \n%+v",
expectedKR.rounds, kr.rounds)
}
}
......@@ -124,7 +131,7 @@ func TestKnownRounds_load(t *testing.T) {
}
}
kr := &KnownRounds{
rounds: knownRounds.NewKnownRound(size),
rounds: knownRounds.NewKnownRound(size * 64),
kv: expectedKR.kv,
key: expectedKR.key,
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment