Skip to content

Commit 932457e

Browse files
committed
chore(values): adds unit test on wrapping float types
1 parent eb2be16 commit 932457e

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

pkg/values/value_test.go

+16
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,22 @@ func Test_IntTypes(t *testing.T) {
281281
}
282282
}
283283

284+
func Test_FloatTypes(t *testing.T) {
285+
testCases := []struct {
286+
name string
287+
test func(tt *testing.T)
288+
}{
289+
{name: "wrap float64 as float64", test: func(tt *testing.T) { wrappableTest[float64, float64](tt, float64(100.01)) }},
290+
{name: "wrap float32 as float64", test: func(tt *testing.T) { wrappableTest[float32, float64](tt, float32(100.01)) }},
291+
}
292+
293+
for _, tc := range testCases {
294+
t.Run(tc.name, func(st *testing.T) {
295+
tc.test(st)
296+
})
297+
}
298+
}
299+
284300
func Test_StructWrapUnwrap(t *testing.T) {
285301
// TODO: https://smartcontract-it.atlassian.net/browse/KS-439 decimal.Decimal is broken when encoded.
286302
type sStruct struct {

0 commit comments

Comments
 (0)