From f59ea26941ba53a0ee02406787cb8800c2ca53dc Mon Sep 17 00:00:00 2001 From: dauTT Date: Sat, 18 Jul 2020 19:23:37 +0200 Subject: [PATCH] Merge PR #6774: x/auth/simulation/params.go: add unit tests --- x/auth/simulation/params_test.go | 37 ++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 x/auth/simulation/params_test.go diff --git a/x/auth/simulation/params_test.go b/x/auth/simulation/params_test.go new file mode 100644 index 0000000000..b8fb384a80 --- /dev/null +++ b/x/auth/simulation/params_test.go @@ -0,0 +1,37 @@ +package simulation_test + +import ( + "math/rand" + "testing" + + "github.com/stretchr/testify/require" + + "github.com/cosmos/cosmos-sdk/x/auth/simulation" +) + +func TestParamChanges(t *testing.T) { + s := rand.NewSource(1) + r := rand.New(s) + + expected := []struct { + composedKey string + key string + simValue string + subspace string + }{ + {"auth/MaxMemoCharacters", "MaxMemoCharacters", "\"181\"", "auth"}, + {"auth/TxSigLimit", "TxSigLimit", "\"7\"", "auth"}, + {"auth/TxSizeCostPerByte", "TxSizeCostPerByte", "\"12\"", "auth"}, + } + + paramChanges := simulation.ParamChanges(r) + + require.Len(t, paramChanges, 3) + + for i, p := range paramChanges { + require.Equal(t, expected[i].composedKey, p.ComposedKey()) + require.Equal(t, expected[i].key, p.Key()) + require.Equal(t, expected[i].simValue, p.SimValue()(r)) + require.Equal(t, expected[i].subspace, p.Subspace()) + } +}