From 634bc12fb17e0f8d7638ab9eacad58a60ed06aeb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Laurent=20Saint-F=C3=A9lix?= Date: Tue, 25 Jan 2022 10:04:04 +0100 Subject: [PATCH] Tests: Use strconv to cast float to string for comparison --- internal/build/cmd/generate/commands/gentests/model.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/build/cmd/generate/commands/gentests/model.go b/internal/build/cmd/generate/commands/gentests/model.go index 5ec1335fc2..d124d84f6d 100644 --- a/internal/build/cmd/generate/commands/gentests/model.go +++ b/internal/build/cmd/generate/commands/gentests/model.go @@ -667,7 +667,7 @@ default: var specialCase string if strings.HasSuffix(key, "from") || strings.HasSuffix(key, "to") { specialCase = `else if floatValue, err := actual.(encjson.Number).Float64(); err == nil { - actual = fmt.Sprintf("%d", int(floatValue)) + actual = strconv.FormatFloat(floatValue, 'f', -1, 64) } ` }