| ... | ... | @@ -418,19 +418,24 @@ test "@intCast comptime_int" { |
| 418 | 418 | } |
| 419 | 419 | |
| 420 | 420 | test "@floatCast comptime_int and comptime_float" { |
| 421 | | const result = @floatCast(f32, 1234); |
| 422 | | assert(@typeOf(result) == f32); |
| 423 | | assert(result == 1234.0); |
| 424 | | |
| 425 | | const result2 = @floatCast(f32, 1234.0); |
| 426 | | assert(@typeOf(result) == f32); |
| 427 | | assert(result == 1234.0); |
| 421 | { |
| 422 | const result = @floatCast(f32, 1234); |
| 423 | assert(@typeOf(result) == f32); |
| 424 | assert(result == 1234.0); |
| 425 | } |
| 426 | { |
| 427 | const result = @floatCast(f32, 1234.0); |
| 428 | assert(@typeOf(result) == f32); |
| 429 | assert(result == 1234.0); |
| 430 | } |
| 428 | 431 | } |
| 429 | 432 | |
| 430 | 433 | test "comptime_int @intToFloat" { |
| 431 | | const result = @intToFloat(f32, 1234); |
| 432 | | assert(@typeOf(result) == f32); |
| 433 | | assert(result == 1234.0); |
| 434 | { |
| 435 | const result = @intToFloat(f32, 1234); |
| 436 | assert(@typeOf(result) == f32); |
| 437 | assert(result == 1234.0); |
| 438 | } |
| 434 | 439 | } |
| 435 | 440 | |
| 436 | 441 | test "@bytesToSlice keeps pointer alignment" { |