authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2018-06-17 04:32:57-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2018-06-17 04:32:57-04:00
log3c12ba718029adac707eeb6e86399f71b74c892e
tree013d26d427f1e93423b18929c7e872444757d6ca
parent79120612267f55901029dd57290ee90c0a3ec987

update test cases


3 files changed, 8 insertions(+), 8 deletions(-)

test/compare_output.zig+2-2
......@@ -331,8 +331,8 @@ pub fn addCases(cases: *tests.CompareOutputContext) void {
331331 \\ }
332332 \\ const small: f32 = 3.25;
333333 \\ const x: f64 = small;
334 \\ const y = i32(x);
335 \\ const z = f64(y);
334 \\ const y = @floatToInt(i32, x);
335 \\ const z = @intToFloat(f64, y);
336336 \\ _ = c.printf(c"%.2f\n%d\n%.2f\n%.2f\n", x, y, z, f64(-0.4));
337337 \\ return 0;
338338 \\}
test/compile_errors.zig+4-4
......@@ -2931,10 +2931,10 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
29312931 "cast negative value to unsigned integer",
29322932 \\comptime {
29332933 \\ const value: i32 = -1;
2934 \\ const unsigned = u32(value);
2934 \\ const unsigned = @intCast(u32, value);
29352935 \\}
29362936 ,
2937 ".tmp_source.zig:3:25: error: attempt to cast negative value to unsigned integer",
2937 ".tmp_source.zig:3:22: error: attempt to cast negative value to unsigned integer",
29382938 );
29392939
29402940 cases.add(
......@@ -2963,10 +2963,10 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
29632963 "compile-time integer cast truncates bits",
29642964 \\comptime {
29652965 \\ const spartan_count: u16 = 300;
2966 \\ const byte = u8(spartan_count);
2966 \\ const byte = @intCast(u8, spartan_count);
29672967 \\}
29682968 ,
2969 ".tmp_source.zig:3:20: error: cast from 'u16' to 'u8' truncates bits",
2969 ".tmp_source.zig:3:18: error: cast from 'u16' to 'u8' truncates bits",
29702970 );
29712971
29722972 cases.add(
test/runtime_safety.zig+2-2
......@@ -188,7 +188,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void {
188188 \\ if (x == 0) return error.Whatever;
189189 \\}
190190 \\fn shorten_cast(x: i32) i8 {
191 \\ return i8(x);
191 \\ return @intCast(i8, x);
192192 \\}
193193 );
194194
......@@ -201,7 +201,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void {
201201 \\ if (x == 0) return error.Whatever;
202202 \\}
203203 \\fn unsigned_cast(x: i32) u32 {
204 \\ return u32(x);
204 \\ return @intCast(u32, x);
205205 \\}
206206 );
207207