@@ -1040,6 +1040,39 @@ func (suite *GlideTestSuite) TestHStrLen_WithNotExistingField() {
10401040 })
10411041}
10421042
1043+ func (suite * GlideTestSuite ) TestHIncrByFloat_WithExistingField () {
1044+ suite .runWithDefaultClients (func (client api.BaseClient ) {
1045+ key := uuid .NewString ()
1046+ field := uuid .NewString ()
1047+ fieldValueMap := map [string ]string {field : "10" }
1048+
1049+ hsetResult , err := client .HSet (key , fieldValueMap )
1050+ assert .Nil (suite .T (), err )
1051+ assert .Equal (suite .T (), int64 (1 ), hsetResult .Value ())
1052+
1053+ hincrByFloatResult , hincrByFloatErr := client .HIncrByFloat (key , field , 1.5 )
1054+ assert .Nil (suite .T (), hincrByFloatErr )
1055+ assert .Equal (suite .T (), float64 (11.5 ), hincrByFloatResult .Value ())
1056+ })
1057+ }
1058+
1059+ func (suite * GlideTestSuite ) TestHIncrByFloat_WithNonExistingField () {
1060+ suite .runWithDefaultClients (func (client api.BaseClient ) {
1061+ key := uuid .NewString ()
1062+ field := uuid .NewString ()
1063+ field2 := uuid .NewString ()
1064+ fieldValueMap := map [string ]string {field2 : "1" }
1065+
1066+ hsetResult , err := client .HSet (key , fieldValueMap )
1067+ assert .Nil (suite .T (), err )
1068+ assert .Equal (suite .T (), int64 (1 ), hsetResult .Value ())
1069+
1070+ hincrByFloatResult , hincrByFloatErr := client .HIncrByFloat (key , field , 1.5 )
1071+ assert .Nil (suite .T (), hincrByFloatErr )
1072+ assert .Equal (suite .T (), float64 (1.5 ), hincrByFloatResult .Value ())
1073+ })
1074+ }
1075+
10431076func (suite * GlideTestSuite ) TestLPushLPop_WithExistingKey () {
10441077 suite .runWithDefaultClients (func (client api.BaseClient ) {
10451078 list := []string {"value4" , "value3" , "value2" , "value1" }
0 commit comments