Skip to content

Commit

Permalink
Remove tests of platform-dependent float conversions
Browse files Browse the repository at this point in the history
From the spec:

> In all non-constant conversions involving floating-point or complex
> values, if the result type cannot represent the value the conversion
> succeeds but the result value is implementation-dependent.

Fixes #108
  • Loading branch information
benhoyt committed May 11, 2022
1 parent 8f901d5 commit 8b7500c
Showing 1 changed file with 16 additions and 17 deletions.
33 changes: 16 additions & 17 deletions interp/interp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,6 @@ BEGIN {
{`BEGIN { print sprintf("%d") }`, "", "", "format error: got 0 args, expected 1", "not enough arg"},
{`BEGIN { print sprintf("%d", 12, 34) }`, "", "12\n", "", ""},
{`BEGIN { print sprintf("% 5d", 42) }`, "", " 42\n", "", ""},
{`BEGIN { print sprintf("%u", -1) }`, "", "18446744073709551615\n", "", ""},
{`BEGIN { print sprintf("%*s %.*s", 5, "abc", 5, "abcdefghi") }`, "", " abc abcde\n", "", ""},
{`BEGIN { print substr("food", 1) }`, "", "food\n", "", ""},
{`BEGIN { print substr("food", 1, 2) }`, "", "fo\n", "", ""},
Expand Down Expand Up @@ -1008,29 +1007,29 @@ BEGIN {
print
print bool(), bool(0), bool(1), bool(""), bool("0"), bool("x")
print i(), i(42), i(-5), i(3.75), i(-3.75)
print i8(), i8(42), i8(-5.6), i8(127), i8(128), i8(255), i8(256)
print i16(), i16(42), i16(-5.6), i16(32767), i16(32768), i16(65535), i16(65536)
print i32(), i32(42), i32(-5.6), i32(2147483647), i32(2147483648), i32(4294967295), i32(4294967296)
print i8(), i8(42), i8(-5.6), i8(127), i8(-128)
print i16(), i16(42), i16(-5.6), i16(32767), i16(-32768)
print i32(), i32(42), i32(-5.6), i32(2147483647), i32(-2147483648)
print i64(), i64(42), i64(-5.6), i64(2147483647000), i64(-2147483647000)
print u(), u(42), u(-1)
print u8(), u8(42), u8(-5.6), u8(127), u8(128), u8(255), u8(256)
print u16(), u16(42), u16(-1), u16(65535), u16(65536)
print u32(), u32(42), u32(-1), u32(4294967295), u32(4294967296)
print u64(), u64(42), u64(-1), u64(4294967296), u64(2147483647000)
print u(), u(42), u(0), u(1)
print u8(), u8(42), u8(-5.6), u8(127), u8(128), u8(255)
print u16(), u16(42), u16(-1), u16(65535)
print u32(), u32(42), u32(-1), u32(4294967295)
print u64(), u64(42), u64(1), u64(4294967296), u64(2147483647000)
print s() "." s("") "." s("Foo bar") "." s(1234)
print b() "." b("") "." b("Foo bar") "." b(1234)
}`, "", `
0 0 1 0 1 1
0 42 -5 3 -3
0 42 -5 127 -128 -1 0
0 42 -5 32767 -32768 -1 0
0 42 -5 2147483647 -2147483648 -2147483648 -2147483648
0 42 -5 127 -128
0 42 -5 32767 -32768
0 42 -5 2147483647 -2147483648
0 42 -5 2147483647000 -2147483647000
0 42 1.84467e+19
0 42 251 127 128 255 0
0 42 65535 65535 0
0 42 4294967295 4294967295 0
0 42 1.84467e+19 4294967296 2147483647000
0 42 0 1
0 42 251 127 128 255
0 42 65535 65535
0 42 4294967295 4294967295
0 42 1 4294967296 2147483647000
..Foo bar.1234
..Foo bar.1234
`, "",
Expand Down

0 comments on commit 8b7500c

Please sign in to comment.