-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added and improved tests of plan types
- Loading branch information
1 parent
1bc1af7
commit 26a7427
Showing
3 changed files
with
1,082 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package types | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestDefaultGenesisState(t *testing.T) { | ||
var ( | ||
state GenesisState | ||
) | ||
|
||
state = DefaultGenesisState() | ||
require.Equal(t, GenesisState(nil), state) | ||
} | ||
|
||
func TestNewGenesisState(t *testing.T) { | ||
var ( | ||
plans GenesisPlans | ||
state GenesisState | ||
) | ||
|
||
state = NewGenesisState(nil) | ||
require.Nil(t, state) | ||
require.Len(t, state, 0) | ||
|
||
state = NewGenesisState(plans) | ||
require.Equal(t, GenesisState(nil), state) | ||
require.Len(t, state, 0) | ||
|
||
plans = append(plans, | ||
GenesisPlan{}, | ||
) | ||
state = NewGenesisState(plans) | ||
require.Equal(t, GenesisState(plans), state) | ||
require.Len(t, state, 1) | ||
|
||
plans = append(plans, | ||
GenesisPlan{}, | ||
) | ||
state = NewGenesisState(plans) | ||
require.Equal(t, GenesisState(plans), state) | ||
require.Len(t, state, 2) | ||
} |
Oops, something went wrong.