Fix float64 formatting.

This commit is contained in:
QLeelulu 2013-03-05 17:27:22 +08:00 committed by Vladimir Mihailenco
parent 2a4280a905
commit ef0cc25b9b
2 changed files with 7 additions and 1 deletions

View File

@ -5,7 +5,7 @@ import (
) )
func formatFloat(f float64) string { func formatFloat(f float64) string {
return strconv.FormatFloat(f, 'f', -1, 32) return strconv.FormatFloat(f, 'f', -1, 64)
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------

View File

@ -953,6 +953,12 @@ func (t *RedisTest) TestIncrByFloat(c *C) {
c.Assert(incrByFloat.Val(), Equals, float64(5200)) c.Assert(incrByFloat.Val(), Equals, float64(5200))
} }
func (t *RedisTest) TestIncrByFloatOverflow(c *C) {
incrByFloat := t.client.IncrByFloat("key", 996945661)
c.Assert(incrByFloat.Err(), IsNil)
c.Assert(incrByFloat.Val(), Equals, float64(996945661))
}
func (t *RedisTest) TestStringsMSetMGet(c *C) { func (t *RedisTest) TestStringsMSetMGet(c *C) {
mSet := t.client.MSet("key1", "hello1", "key2", "hello2") mSet := t.client.MSet("key1", "hello1", "key2", "hello2")
c.Assert(mSet.Err(), IsNil) c.Assert(mSet.Err(), IsNil)