remove decimal requirement

This commit is contained in:
finley
2023-06-20 22:22:18 +08:00
parent 91eb6495eb
commit 1a3b32d2d2
7 changed files with 25 additions and 41 deletions

View File

@@ -5,6 +5,7 @@ import (
"github.com/hdt3213/godis/lib/utils"
"github.com/hdt3213/godis/redis/protocol"
"github.com/hdt3213/godis/redis/protocol/asserts"
"math"
"strconv"
"testing"
)
@@ -259,7 +260,7 @@ func TestIncr(t *testing.T) {
t.Error(err)
return
}
if int(val) != expected {
if math.Abs(val-float64(expected)) > 1e-4 {
t.Errorf("expect %d, actual: %d", expected, int(val))
return
}