chore: refactor (#2785)

* chore: refactor

* chore: refactor
This commit is contained in:
Kevin Wan
2023-01-13 14:04:37 +08:00
committed by GitHub
parent 00ff50c2cc
commit b2571883ca
2 changed files with 71 additions and 55 deletions

View File

@@ -1021,7 +1021,7 @@ func TestRedis_SortedSetByFloat64(t *testing.T) {
assert.NotNil(t, err)
pairs, err := client.ZRevRangeWithScoresByFloat("key", 0, -1)
assert.Nil(t, err)
assert.EqualValues(t, []PairFloat{
assert.EqualValues(t, []FloatPair{
{
Key: "value2",
Score: 10.346,
@@ -1034,7 +1034,7 @@ func TestRedis_SortedSetByFloat64(t *testing.T) {
pairs, err = client.ZrangeWithScoresByFloat("key", 0, -1)
assert.Nil(t, err)
assert.EqualValues(t, []PairFloat{
assert.EqualValues(t, []FloatPair{
{
Key: "value1",
Score: 10.345,
@@ -1046,9 +1046,9 @@ func TestRedis_SortedSetByFloat64(t *testing.T) {
}, pairs)
_, err = New(client.Addr, badType()).ZrangebyscoreWithScoresByFloat("key", 0, 20)
assert.NotNil(t, err)
pairs, err = client.ZrangebyscoreWithScoresByFloat("key", 0,20)
pairs, err = client.ZrangebyscoreWithScoresByFloat("key", 0, 20)
assert.Nil(t, err)
assert.EqualValues(t, []PairFloat{
assert.EqualValues(t, []FloatPair{
{
Key: "value1",
Score: 10.345,
@@ -1063,7 +1063,7 @@ func TestRedis_SortedSetByFloat64(t *testing.T) {
assert.NotNil(t, err)
pairs, err = client.ZrangebyscoreWithScoresByFloatAndLimit("key", 10.1, 12.2, 1, 1)
assert.Nil(t, err)
assert.EqualValues(t, []PairFloat{
assert.EqualValues(t, []FloatPair{
{
Key: "value2",
Score: 10.346,
@@ -1073,7 +1073,7 @@ func TestRedis_SortedSetByFloat64(t *testing.T) {
assert.NotNil(t, err)
pairs, err = client.ZrevrangebyscoreWithScoresByFloat("key", 10, 12)
assert.Nil(t, err)
assert.EqualValues(t, []PairFloat{
assert.EqualValues(t, []FloatPair{
{
Key: "value2",
Score: 10.346,
@@ -1088,7 +1088,7 @@ func TestRedis_SortedSetByFloat64(t *testing.T) {
assert.NotNil(t, err)
pairs, err = client.ZrevrangebyscoreWithScoresByFloatAndLimit("key", 10, 12, 1, 1)
assert.Nil(t, err)
assert.EqualValues(t, []PairFloat{
assert.EqualValues(t, []FloatPair{
{
Key: "value1",
Score: 10.345,
@@ -1101,16 +1101,16 @@ func TestRedis_IncrbyFloat(t *testing.T) {
runOnRedis(t, func(client *Redis) {
incrVal, err := client.IncrbyFloat("key", 0.002)
assert.Nil(t, err)
assert.Equal(t, 0.002,incrVal)
assert.Equal(t, 0.002, incrVal)
incrVal2, err := client.IncrbyFloat("key", -0.001)
assert.Nil(t, err)
assert.Equal(t, 0.001,incrVal2)
hincrVal ,err := client.HincrbyFloat("hkey","i",0.002)
assert.Equal(t, 0.001, incrVal2)
hincrVal, err := client.HincrbyFloat("hkey", "i", 0.002)
assert.Nil(t, err)
assert.Equal(t, 0.002,hincrVal)
hincrVal2 ,err := client.HincrbyFloat("hkey","i",-0.001)
assert.Equal(t, 0.002, hincrVal)
hincrVal2, err := client.HincrbyFloat("hkey", "i", -0.001)
assert.Nil(t, err)
assert.Equal(t, 0.001,hincrVal2)
assert.Equal(t, 0.001, hincrVal2)
})
}
func TestRedis_Pipelined(t *testing.T) {