Ai
1 Star 0 Fork 0

idsutong/gqlgen

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
float_test.go 518 Bytes
一键复制 编辑 原始数据 按行查看 历史
Adam Scarr 提交于 2018-11-26 11:14 +08:00 . Increase float precision
package graphql
import (
"bytes"
"testing"
"github.com/stretchr/testify/assert"
)
func TestFloat(t *testing.T) {
assert.Equal(t, "123", m2s(MarshalFloat(123)))
assert.Equal(t, "1.2345678901", m2s(MarshalFloat(1.2345678901)))
assert.Equal(t, "1.2345678901234567", m2s(MarshalFloat(1.234567890123456789)))
assert.Equal(t, "1.2e+20", m2s(MarshalFloat(1.2e+20)))
assert.Equal(t, "1.2e-20", m2s(MarshalFloat(1.2e-20)))
}
func m2s(m Marshaler) string {
var b bytes.Buffer
m.MarshalGQL(&b)
return b.String()
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/idsutong/gqlgen.git
git@gitee.com:idsutong/gqlgen.git
idsutong
gqlgen
gqlgen
master

搜索帮助