OSDN Git Service

Fix format verbs in tests (#1239)
authorHAOYUatHZ <37070449+HAOYUatHZ@users.noreply.github.com>
Wed, 8 Aug 2018 02:10:14 +0000 (10:10 +0800)
committerPaladz <yzhu101@uottawa.ca>
Wed, 8 Aug 2018 02:10:14 +0000 (10:10 +0800)
consensus/server_flag_test.go
netsync/block_keeper_test.go
wallet/unconfirmed_test.go

index 996e0a2..c121594 100644 (file)
@@ -32,7 +32,7 @@ func TestIsEnable(t *testing.T) {
 
        for i, c := range cases {
                if c.baseFlag.IsEnable(c.checkFlage) != c.result {
-                       t.Errorf("test case #%b got %b, want %b", i, c.baseFlag.IsEnable(c.checkFlage), c.result)
+                       t.Errorf("test case #%d got %t, want %t", i, c.baseFlag.IsEnable(c.checkFlage), c.result)
                }
        }
 }
index 57f2c7b..fa3b6ff 100644 (file)
@@ -194,7 +194,7 @@ func TestFastBlockSync(t *testing.T) {
                for i := uint64(0); i <= a.chain.BestBlockHeight(); i++ {
                        block, err := a.chain.GetBlockByHeight(i)
                        if err != nil {
-                               t.Error("case %d got err %v", err)
+                               t.Errorf("case %d got err %v", i, err)
                        }
                        got = append(got, block)
                }
@@ -452,7 +452,7 @@ func TestRegularBlockSync(t *testing.T) {
                for i := uint64(0); i <= a.chain.BestBlockHeight(); i++ {
                        block, err := a.chain.GetBlockByHeight(i)
                        if err != nil {
-                               t.Error("case %d got err %v", err)
+                               t.Errorf("case %d got err %v", i, err)
                        }
                        got = append(got, block)
                }
index 92ab081..d4a264c 100644 (file)
@@ -81,26 +81,26 @@ func TestWalletUnconfirmedTxs(t *testing.T) {
        gotTxs, err := w.GetUnconfirmedTxs("")
        for i, want := range wantTxs {
                if !testutil.DeepEqual(gotTxs[i].ID, want.ID) {
-                       t.Errorf(`the NO %i transaction, tx got=%#v; want=%#v`, i, gotTxs[i].ID.String(), want.ID.String())
+                       t.Errorf(`the NO %d transaction, tx got=%#v; want=%#v`, i, gotTxs[i].ID.String(), want.ID.String())
                }
 
                for j, input := range want.Inputs {
                        if !testutil.DeepEqual(gotTxs[i].Inputs[j].AccountID, input.AccountID) {
-                               t.Errorf(`the NO %i transaction input, accountID got=%#v; want=%#v`, j, gotTxs[i].Inputs[j].AccountID, input.AccountID)
+                               t.Errorf(`the NO %d transaction input, accountID got=%#v; want=%#v`, j, gotTxs[i].Inputs[j].AccountID, input.AccountID)
                        }
 
                        if !testutil.DeepEqual(gotTxs[i].Inputs[j].AssetID, input.AssetID) {
-                               t.Errorf(`the NO %i transaction input, assetID got=%#v; want=%#v`, j, gotTxs[i].Inputs[j].AssetID, input.AssetID)
+                               t.Errorf(`the NO %d transaction input, assetID got=%#v; want=%#v`, j, gotTxs[i].Inputs[j].AssetID, input.AssetID)
                        }
                }
 
                for k, output := range want.Outputs {
                        if !testutil.DeepEqual(gotTxs[i].Outputs[k].AccountID, output.AccountID) {
-                               t.Errorf(`the NO %i transaction input, accountID got=%#v; want=%#v`, k, gotTxs[i].Inputs[k].AccountID, output.AccountID)
+                               t.Errorf(`the NO %d transaction input, accountID got=%#v; want=%#v`, k, gotTxs[i].Inputs[k].AccountID, output.AccountID)
                        }
 
                        if !testutil.DeepEqual(gotTxs[i].Outputs[k].AssetID, output.AssetID) {
-                               t.Errorf(`the NO %i transaction input, assetID got=%#v; want=%#v`, k, gotTxs[i].Inputs[k].AssetID, output.AssetID)
+                               t.Errorf(`the NO %d transaction input, assetID got=%#v; want=%#v`, k, gotTxs[i].Inputs[k].AssetID, output.AssetID)
                        }
                }
        }