From 307ecd54e2f47b295e4d91dec0a56f540c99985e Mon Sep 17 00:00:00 2001 From: rhuairahrighairigh Date: Tue, 28 Apr 2020 01:26:48 +0100 Subject: [PATCH] remove unecessary codec tests --- x/committee/types/proposal_test.go | 57 -------------------------- x/committee/types/test_test.go | 64 ------------------------------ 2 files changed, 121 deletions(-) delete mode 100644 x/committee/types/proposal_test.go delete mode 100644 x/committee/types/test_test.go diff --git a/x/committee/types/proposal_test.go b/x/committee/types/proposal_test.go deleted file mode 100644 index 0b6ab0e4..00000000 --- a/x/committee/types/proposal_test.go +++ /dev/null @@ -1,57 +0,0 @@ -package types - -import ( - "time" - - "github.com/cosmos/cosmos-sdk/codec" - sdk "github.com/cosmos/cosmos-sdk/types" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" -) - -func (suite *TypesTestSuite) TestCommitteeChangeProposalMarshals() { - - ccp := CommitteeChangeProposal{ - Title: "A Title", - Description: "A description for this committee.", - NewCommittee: Committee{ - ID: 12, - Description: "This committee is for testing.", - Members: nil, - Permissions: []Permission{ParamChangePermission{}}, - VoteThreshold: d("0.667"), - ProposalDuration: time.Hour * 24 * 7, - }, - } - - appCdc := codec.New() - // register sdk types in case their needed - sdk.RegisterCodec(appCdc) - codec.RegisterCrypto(appCdc) - codec.RegisterEvidences(appCdc) - // register committee types - RegisterCodec(appCdc) - - var ppModuleCdc PubProposal - suite.NotPanics(func() { - ModuleCdc.MustUnmarshalBinaryBare( - ModuleCdc.MustMarshalBinaryBare(PubProposal(ccp)), - &ppModuleCdc, - ) - }) - - var ppAppCdc PubProposal - suite.NotPanics(func() { - appCdc.MustUnmarshalBinaryBare( - appCdc.MustMarshalBinaryBare(PubProposal(ccp)), - &ppAppCdc, - ) - }) - - var ppGovCdc govtypes.Content - suite.NotPanics(func() { - govtypes.ModuleCdc.MustUnmarshalBinaryBare( - govtypes.ModuleCdc.MustMarshalBinaryBare(govtypes.Content(ccp)), - &ppGovCdc, - ) - }) -} diff --git a/x/committee/types/test_test.go b/x/committee/types/test_test.go deleted file mode 100644 index 3234a830..00000000 --- a/x/committee/types/test_test.go +++ /dev/null @@ -1,64 +0,0 @@ -package types - -import ( - "fmt" - "testing" - - "github.com/cosmos/cosmos-sdk/codec" -) - -type InterA interface { - GetTitle() string -} - -type InterB InterA - -// interface { -// GetDescription() string -// } - -type Prop1 struct{} - -func (p Prop1) GetTitle() string { return "prop1 title" } -func (p Prop1) GetDescription() string { return "prop1 description" } - -type Prop2 struct{} - -func (p Prop2) GetTitle() string { return "prop2 title" } -func (p Prop2) GetDescription() string { return "prop2 description" } - -func TestTest(t *testing.T) { - /* - register content, register new pubproposal - register concrete types (should satisfy both of them) - - try marshalling and unmarshalling all 4 combinations - */ - cdc := codec.New() - - cdc.RegisterInterface((*InterA)(nil), nil) - cdc.RegisterConcrete(Prop1{}, "test/prop1", nil) - cdc.RegisterInterface((*InterB)(nil), nil) - cdc.RegisterConcrete(Prop2{}, "test/prop2", nil) - - p1ia := InterA(Prop1{}) - p2ia := InterA(Prop2{}) - p1ib := InterB(Prop1{}) - p2ib := InterB(Prop2{}) - - var iap1 InterA - cdc.MustUnmarshalBinaryBare(cdc.MustMarshalBinaryBare(p1ia), &iap1) - fmt.Printf("%T, %T\n", p1ia, iap1) - - var iap2 InterA - cdc.MustUnmarshalBinaryBare(cdc.MustMarshalBinaryBare(p2ia), &iap2) - fmt.Printf("%T, %T\n", p2ia, iap2) - - var ibp1 InterB - cdc.MustUnmarshalBinaryBare(cdc.MustMarshalBinaryBare(p1ib), &ibp1) - fmt.Printf("%T, %T\n", p1ib, ibp1) - - var ibp2 InterB - cdc.MustUnmarshalBinaryBare(cdc.MustMarshalBinaryBare(p2ib), &ibp2) - fmt.Printf("%T, %T\n", p2ib, ibp2) -}