github.com/fibonacci-chain/fbc@v0.0.0-20231124064014-c7636198c1e9/x/erc20/types/params_test.go (about) 1 package types 2 3 import ( 4 "testing" 5 6 "github.com/stretchr/testify/require" 7 ) 8 9 func Test_validateIsUint64(t *testing.T) { 10 type args struct { 11 i interface{} 12 } 13 tests := []struct { 14 name string 15 args args 16 wantErr bool 17 }{ 18 {"invalid type", args{"a"}, true}, 19 {"correct IBC timeout", args{DefaultIbcTimeout}, false}, 20 } 21 for _, tt := range tests { 22 tt := tt 23 t.Run(tt.name, func(t *testing.T) { 24 require.Equal(t, tt.wantErr, validateUint64(tt.args.i) != nil) 25 }) 26 } 27 } 28 29 func Test_validateIsBool(t *testing.T) { 30 type args struct { 31 i interface{} 32 } 33 tests := []struct { 34 name string 35 args args 36 wantErr bool 37 }{ 38 {"invalid bool", args{"a"}, true}, 39 {"correct bool", args{true}, false}, 40 {"correct bool", args{false}, false}, 41 } 42 for _, tt := range tests { 43 tt := tt 44 t.Run(tt.name, func(t *testing.T) { 45 require.Equal(t, tt.wantErr, validateBool(tt.args.i) != nil) 46 }) 47 } 48 }