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/slice.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/slice.zig')
| -rw-r--r-- | test/behavior/slice.zig | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/test/behavior/slice.zig b/test/behavior/slice.zig index ae5fbf0951..fcbae214ac 100644 --- a/test/behavior/slice.zig +++ b/test/behavior/slice.zig @@ -138,10 +138,10 @@ fn memFree(comptime T: type, memory: []T) void { test "slice of hardcoded address to pointer" { const S = struct { fn doTheTest() !void { - const pointer = @intToPtr([*]u8, 0x04)[0..2]; + const pointer = @ptrFromInt([*]u8, 0x04)[0..2]; try comptime expect(@TypeOf(pointer) == *[2]u8); const slice: []const u8 = pointer; - try expect(@ptrToInt(slice.ptr) == 4); + try expect(@intFromPtr(slice.ptr) == 4); try expect(slice.len == 2); } }; @@ -197,13 +197,13 @@ test "slicing pointer by length" { } } -const x = @intToPtr([*]i32, 0x1000)[0..0x500]; +const x = @ptrFromInt([*]i32, 0x1000)[0..0x500]; const y = x[0x100..]; test "compile time slice of pointer to hard coded address" { - try expect(@ptrToInt(x) == 0x1000); + try expect(@intFromPtr(x) == 0x1000); try expect(x.len == 0x500); - try expect(@ptrToInt(y) == 0x1400); + try expect(@intFromPtr(y) == 0x1400); try expect(y.len == 0x400); } @@ -838,13 +838,13 @@ test "empty slice ptr is non null" { const empty_slice: []u8 = &[_]u8{}; const p: [*]u8 = empty_slice.ptr + 0; const t = @ptrCast([*]i8, p); - try expect(@ptrToInt(t) == @ptrToInt(empty_slice.ptr)); + try expect(@intFromPtr(t) == @intFromPtr(empty_slice.ptr)); } { const empty_slice: []u8 = &.{}; const p: [*]u8 = empty_slice.ptr + 0; const t = @ptrCast([*]i8, p); - try expect(@ptrToInt(t) == @ptrToInt(empty_slice.ptr)); + try expect(@intFromPtr(t) == @intFromPtr(empty_slice.ptr)); } } |
