diff options
author | Gustav Simonsson <gustav.simonsson@gmail.com> | 2015-09-09 06:26:18 +0800 |
---|---|---|
committer | Gustav Simonsson <gustav.simonsson@gmail.com> | 2015-09-09 06:26:18 +0800 |
commit | bf879ef230b33f3cff4c075c205dbaeb8f09d820 (patch) | |
tree | f16e67ddab45ee67800c4ff61b76f7effe54dff0 | |
parent | 004ed786b424ef3d6491ce46c3d893d8ecac3cc2 (diff) | |
download | go-tangerine-bf879ef230b33f3cff4c075c205dbaeb8f09d820.tar go-tangerine-bf879ef230b33f3cff4c075c205dbaeb8f09d820.tar.gz go-tangerine-bf879ef230b33f3cff4c075c205dbaeb8f09d820.tar.bz2 go-tangerine-bf879ef230b33f3cff4c075c205dbaeb8f09d820.tar.lz go-tangerine-bf879ef230b33f3cff4c075c205dbaeb8f09d820.tar.xz go-tangerine-bf879ef230b33f3cff4c075c205dbaeb8f09d820.tar.zst go-tangerine-bf879ef230b33f3cff4c075c205dbaeb8f09d820.zip |
core/state: test formatting adhering to Go convention
-rw-r--r-- | core/state/state_test.go | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/core/state/state_test.go b/core/state/state_test.go index 35cf53e3e..60836738e 100644 --- a/core/state/state_test.go +++ b/core/state/state_test.go @@ -170,7 +170,7 @@ func TestSnapshot2(t *testing.T) { so0Restored := state.GetStateObject(stateobjaddr0) so1Restored := state.GetStateObject(stateobjaddr1) // non-deleted is equal (restored) - compareStateObjects(so0, so0Restored, t) + compareStateObjects(so0Restored, so0, t) // deleted should be nil, both before and after restore of state copy if so1Restored != nil { t.Fatalf("deleted object not nil after restoring snapshot") @@ -179,45 +179,45 @@ func TestSnapshot2(t *testing.T) { func compareStateObjects(so0, so1 *StateObject, t *testing.T) { if so0.address != so1.address { - t.Fatalf("\nexpected %v\ngot %v", so0.address, so1.address) + t.Fatalf("Address mismatch: have %v, want %v", so0.address, so1.address) } if so0.balance.Cmp(so1.balance) != 0 { - t.Fatalf("\nexpected %v\ngot %v", so0.balance, so1.balance) + t.Fatalf("Balance mismatch: have %v, want %v", so0.balance, so1.balance) } if so0.nonce != so1.nonce { - t.Fatalf("\nexpected %v\ngot %v", so0.nonce, so1.nonce) + t.Fatalf("Nonce mismatch: have %v, want %v", so0.nonce, so1.nonce) } if !bytes.Equal(so0.codeHash, so1.codeHash) { - t.Fatalf("\nexpected %v\ngot %v", so0.codeHash, so1.codeHash) + t.Fatalf("CodeHash mismatch: have %v, want %v", so0.codeHash, so1.codeHash) } if !bytes.Equal(so0.code, so1.code) { - t.Fatalf("\nexpected %v\ngot %v", so0.code, so1.code) + t.Fatalf("Code mismatch: have %v, want %v", so0.code, so1.code) } if !bytes.Equal(so0.initCode, so1.initCode) { - t.Fatalf("\nexpected %v\ngot %v", so0.initCode, so1.initCode) + t.Fatalf("InitCode mismatch: have %v, want %v", so0.initCode, so1.initCode) } - for k, v := range so0.storage { - if so1.storage[k] != v { - t.Fatalf("\nstorage key %s:\nexpected %v\ngot %v", k, v, so1.storage[k]) - } - } for k, v := range so1.storage { if so0.storage[k] != v { - t.Fatalf("\nunexpected k,v : %v, %v", k, v) + t.Fatalf("Storage key %s mismatch: have %v, want %v", k, so0.storage[k], v) + } + } + for k, v := range so0.storage { + if so1.storage[k] != v { + t.Fatalf("Storage key %s mismatch: have %v, want none.", k, v) } } if so0.gasPool.Cmp(so1.gasPool) != 0 { - t.Fatalf("\nexpected %v\ngot %v", so0.gasPool, so1.gasPool) + t.Fatalf("GasPool mismatch: have %v, want %v", so0.gasPool, so1.gasPool) } if so0.remove != so1.remove { - t.Fatalf("\nexpected %v\ngot %v", so0.remove, so1.remove) + t.Fatalf("Remove mismatch: have %v, want %v", so0.remove, so1.remove) } if so0.deleted != so1.deleted { - t.Fatalf("\nexpected %v\ngot %v", so0.deleted, so1.deleted) + t.Fatalf("Deleted mismatch: have %v, want %v", so0.deleted, so1.deleted) } if so0.dirty != so1.dirty { - t.Fatalf("\nexpected %v\ngot %v", so0.dirty, so1.dirty) + t.Fatalf("Dirty mismatch: have %v, want %v", so0.dirty, so1.dirty) } } |