-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Alessio Treglia
committed
Mar 5, 2021
1 parent
b9d0418
commit 3bbda14
Showing
8 changed files
with
117 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package types_test | ||
|
||
import ( | ||
"github.com/cosmos/cosmos-sdk/x/ibc/core/02-client/types" | ||
ibctmtypes "github.com/cosmos/cosmos-sdk/x/ibc/light-clients/07-tendermint/types" | ||
) | ||
|
||
func (suite *TypesTestSuite) TestMarshalHeader() { | ||
|
||
cdc := suite.chainA.App.AppCodec() | ||
h := &ibctmtypes.Header{ | ||
TrustedHeight: types.NewHeight(4, 100), | ||
} | ||
|
||
// marshal header | ||
bz, err := types.MarshalHeader(cdc, h) | ||
suite.Require().NoError(err) | ||
|
||
// unmarshal header | ||
newHeader, err := types.UnmarshalHeader(cdc, bz) | ||
suite.Require().NoError(err) | ||
|
||
suite.Require().Equal(h, newHeader) | ||
|
||
// use invalid bytes | ||
invalidHeader, err := types.UnmarshalHeader(cdc, []byte("invalid bytes")) | ||
suite.Require().Error(err) | ||
suite.Require().Nil(invalidHeader) | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters