good morning!!!!

Skip to content
Snippets Groups Projects
Commit 58e4311e authored by Shivam Sharma's avatar Shivam Sharma
Browse files

Minor change

parent 904f8b52
No related branches found
No related tags found
No related merge requests found
...@@ -59,32 +59,28 @@ func TestChain2HeadEvent(t *testing.T) { ...@@ -59,32 +59,28 @@ func TestChain2HeadEvent(t *testing.T) {
Removed []common.Hash Removed []common.Hash
} }
// To use in fatal log, indicates the readEvent which failed the test.
i := 0
readEvent := func(expect *eventTest) { readEvent := func(expect *eventTest) {
select { select {
case ev := <-chain2HeadCh: case ev := <-chain2HeadCh:
i++
if ev.Type != expect.Type { if ev.Type != expect.Type {
t.Fatalf("%d : type mismatch", i) t.Fatal("Type mismatch")
} }
if len(ev.NewChain) != len(expect.Added) { if len(ev.NewChain) != len(expect.Added) {
t.Fatalf("%d : Newchain and Added Array Size don't match", i) t.Fatal("Newchain and Added Array Size don't match")
} }
if len(ev.OldChain) != len(expect.Removed) { if len(ev.OldChain) != len(expect.Removed) {
t.Fatalf("%d : Oldchain and Removed Array Size don't match", i) t.Fatal("Oldchain and Removed Array Size don't match")
} }
for j := 0; j < len(ev.OldChain); j++ { for j := 0; j < len(ev.OldChain); j++ {
if ev.OldChain[j].Hash() != expect.Removed[j] { if ev.OldChain[j].Hash() != expect.Removed[j] {
t.Fatalf("%d : Oldchain hashes Does Not Match", i) t.Fatal("Oldchain hashes Do Not Match")
} }
} }
for j := 0; j < len(ev.NewChain); j++ { for j := 0; j < len(ev.NewChain); j++ {
if ev.NewChain[j].Hash() != expect.Added[j] { if ev.NewChain[j].Hash() != expect.Added[j] {
t.Fatalf("%d : Newchain hashes Does Not Match", i) t.Fatal("Newchain hashes Do Not Match")
} }
} }
case <-time.After(2 * time.Second): case <-time.After(2 * time.Second):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment