diff options
| author | Eric Joldasov <bratishkaerik@getgoogleoff.me> | 2023-06-15 13:14:16 +0600 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2023-06-19 12:34:42 -0700 |
| commit | 50339f595aa6ec96760b1cd9f8d0e0bfc3f167fc (patch) | |
| tree | 9e2b95d8e111e905e00511962dfd32c8e5bb3245 /test/behavior/bool.zig | |
| parent | a6c8ee5231230947c928bbe1c6a39eb6e1bb9c5b (diff) | |
| download | zig-50339f595aa6ec96760b1cd9f8d0e0bfc3f167fc.tar.gz zig-50339f595aa6ec96760b1cd9f8d0e0bfc3f167fc.zip | |
all: zig fmt and rename "@XToY" to "@YFromX"
Signed-off-by: Eric Joldasov <bratishkaerik@getgoogleoff.me>
Diffstat (limited to 'test/behavior/bool.zig')
| -rw-r--r-- | test/behavior/bool.zig | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/test/behavior/bool.zig b/test/behavior/bool.zig index a2636ecf42..50a098c111 100644 --- a/test/behavior/bool.zig +++ b/test/behavior/bool.zig @@ -13,22 +13,22 @@ test "cast bool to int" { const t = true; const f = false; - try expectEqual(@as(u32, 1), @boolToInt(t)); - try expectEqual(@as(u32, 0), @boolToInt(f)); - try expectEqual(-1, @bitCast(i1, @boolToInt(t))); - try expectEqual(0, @bitCast(i1, @boolToInt(f))); - try expectEqual(u1, @TypeOf(@boolToInt(t))); - try expectEqual(u1, @TypeOf(@boolToInt(f))); - try nonConstCastBoolToInt(t, f); + try expectEqual(@as(u32, 1), @intFromBool(t)); + try expectEqual(@as(u32, 0), @intFromBool(f)); + try expectEqual(-1, @bitCast(i1, @intFromBool(t))); + try expectEqual(0, @bitCast(i1, @intFromBool(f))); + try expectEqual(u1, @TypeOf(@intFromBool(t))); + try expectEqual(u1, @TypeOf(@intFromBool(f))); + try nonConstCastIntFromBool(t, f); } -fn nonConstCastBoolToInt(t: bool, f: bool) !void { - try expectEqual(@as(u32, 1), @boolToInt(t)); - try expectEqual(@as(u32, 0), @boolToInt(f)); - try expectEqual(@as(i1, -1), @bitCast(i1, @boolToInt(t))); - try expectEqual(@as(i1, 0), @bitCast(i1, @boolToInt(f))); - try expectEqual(u1, @TypeOf(@boolToInt(t))); - try expectEqual(u1, @TypeOf(@boolToInt(f))); +fn nonConstCastIntFromBool(t: bool, f: bool) !void { + try expectEqual(@as(u32, 1), @intFromBool(t)); + try expectEqual(@as(u32, 0), @intFromBool(f)); + try expectEqual(@as(i1, -1), @bitCast(i1, @intFromBool(t))); + try expectEqual(@as(i1, 0), @bitCast(i1, @intFromBool(f))); + try expectEqual(u1, @TypeOf(@intFromBool(t))); + try expectEqual(u1, @TypeOf(@intFromBool(f))); } test "bool cmp" { |
