Skip to content

Commit

Permalink
pvtstore pkg -- consistently use testify/require (#1439)
Browse files Browse the repository at this point in the history
Signed-off-by: senthil <cendhu@gmail.com>
  • Loading branch information
cendhu authored Jun 23, 2020
1 parent d74a116 commit 0c67955
Show file tree
Hide file tree
Showing 3 changed files with 156 additions and 156 deletions.
26 changes: 13 additions & 13 deletions core/ledger/pvtdatastorage/kv_encoding_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ import (
math "math"
"testing"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)

func TestDataKeyEncoding(t *testing.T) {
dataKey1 := &dataKey{nsCollBlk: nsCollBlk{ns: "ns1", coll: "coll1", blkNum: 2}, txNum: 5}
datakey2, err := decodeDatakey(encodeDataKey(dataKey1))
assert.NoError(t, err)
assert.Equal(t, dataKey1, datakey2)
require.NoError(t, err)
require.Equal(t, dataKey1, datakey2)
}

func TestDatakeyRange(t *testing.T) {
Expand All @@ -44,10 +44,10 @@ func TestDatakeyRange(t *testing.T) {
txNum: txNum,
},
)
assert.Equal(t, bytes.Compare(keyOfPreviousBlock, startKey), -1)
assert.Equal(t, bytes.Compare(keyOfBlock, startKey), 1)
assert.Equal(t, bytes.Compare(keyOfBlock, endKey), -1)
assert.Equal(t, bytes.Compare(keyOfNextBlock, endKey), 1)
require.Equal(t, bytes.Compare(keyOfPreviousBlock, startKey), -1)
require.Equal(t, bytes.Compare(keyOfBlock, startKey), 1)
require.Equal(t, bytes.Compare(keyOfBlock, endKey), -1)
require.Equal(t, bytes.Compare(keyOfNextBlock, endKey), 1)
}
}

Expand All @@ -74,10 +74,10 @@ func TestEligibleMissingdataRange(t *testing.T) {
isEligible: true,
},
)
assert.Equal(t, bytes.Compare(keyOfNextBlock, startKey), -1)
assert.Equal(t, bytes.Compare(keyOfBlock, startKey), 1)
assert.Equal(t, bytes.Compare(keyOfBlock, endKey), -1)
assert.Equal(t, bytes.Compare(keyOfPreviousBlock, endKey), 1)
require.Equal(t, bytes.Compare(keyOfNextBlock, startKey), -1)
require.Equal(t, bytes.Compare(keyOfBlock, startKey), 1)
require.Equal(t, bytes.Compare(keyOfBlock, endKey), -1)
require.Equal(t, bytes.Compare(keyOfPreviousBlock, endKey), 1)
}
}

Expand All @@ -103,7 +103,7 @@ func testEncodeDecodeMissingdataKey(t *testing.T, blkNum uint64) {
decodedKey := decodeMissingDataKey(
encodeMissingDataKey(key),
)
assert.Equal(t, key, decodedKey)
require.Equal(t, key, decodedKey)
},
)

Expand All @@ -113,7 +113,7 @@ func testEncodeDecodeMissingdataKey(t *testing.T, blkNum uint64) {
decodedKey := decodeMissingDataKey(
encodeMissingDataKey(key),
)
assert.Equal(t, key, decodedKey)
require.Equal(t, key, decodedKey)
},
)
}
Expand Down
Loading

0 comments on commit 0c67955

Please sign in to comment.