vecmath: Update to zig 0.16.0, harden tests and add test build step

This commit is contained in:
2026-05-12 23:33:33 +02:00
parent 0cce9d9bce
commit 380145a986
27 changed files with 121 additions and 13 deletions

View File

@@ -167,7 +167,11 @@ pub const Vector2 = extern struct {
};
}
pub fn format(self: Vector2, w: *std.io.Writer) !void {
pub fn format(self: Vector2, w: *std.Io.Writer) !void {
try w.print("[{d}, {d}]", .{ self.x, self.y });
}
test "refAllDecls" {
std.testing.refAllDecls(@This());
}
};

View File

@@ -110,10 +110,14 @@ pub const Vector2Int = extern struct {
return self.x * other.y - self.y * other.x;
}
pub fn format(self: Vector2Int, w: *std.io.Writer) !void {
pub fn format(self: Vector2Int, w: *std.Io.Writer) !void {
try w.print("[{X:0>8}, {X:0>8}]", .{
@as(u32, @bitCast(self.x)),
@as(u32, @bitCast(self.y)),
});
}
test "refAllDecls" {
std.testing.refAllDecls(@This());
}
};

View File

@@ -171,4 +171,8 @@ pub const Vector2Int_x8 = struct {
pub inline fn cross(self: Vector2Int_x8, other: Vector2Int_x8) vm.i32x8 {
return self.x * other.y - self.y * other.x;
}
test "refAllDecls" {
std.testing.refAllDecls(@This());
}
};

View File

@@ -231,4 +231,8 @@ pub const Vector2x8 = struct {
.y = self.x * vm.ps(m.iy) + self.y * vm.ps(m.jy),
};
}
test "refAllDecls" {
std.testing.refAllDecls(@This());
}
};

View File

@@ -192,7 +192,11 @@ pub const Vector3 = extern struct {
};
}
pub fn format(self: Vector3, w: *std.io.Writer) !void {
pub fn format(self: Vector3, w: *std.Io.Writer) !void {
try w.print("[{d}, {d}, {d}]", .{ self.x, self.y, self.z });
}
test "refAllDecls" {
std.testing.refAllDecls(@This());
}
};

View File

@@ -117,11 +117,15 @@ pub const Vector3Int = extern struct {
};
}
pub fn format(self: Vector3Int, w: *std.io.Writer) !void {
pub fn format(self: Vector3Int, w: *std.Io.Writer) !void {
try w.print("[{X:0>8}, {X:0>8}, {X:0>8}]", .{
@as(u32, @bitCast(self.x)),
@as(u32, @bitCast(self.y)),
@as(u32, @bitCast(self.z)),
});
}
test "refAllDecls" {
std.testing.refAllDecls(@This());
}
};

View File

@@ -180,4 +180,8 @@ pub const Vector3Int_x8 = struct {
.z = self.x * other.y - self.y * other.x,
};
}
test "refAllDecls" {
std.testing.refAllDecls(@This());
}
};

View File

@@ -258,4 +258,8 @@ pub const Vector3x8 = struct {
.z = v.x * vm.ps(self.iz) + v.y * vm.ps(self.jz) + v.z * vm.ps(self.kz),
};
}
test "refAllDecls" {
std.testing.refAllDecls(@This());
}
};

View File

@@ -147,7 +147,11 @@ pub const Vector4 = extern struct {
};
}
pub fn format(self: Vector4, w: *std.io.Writer) !void {
pub fn format(self: Vector4, w: *std.Io.Writer) !void {
try w.print("[{d}, {d}, {d}, {d}]", .{ self.x, self.y, self.z, self.w });
}
test "refAllDecls" {
std.testing.refAllDecls(@This());
}
};

View File

@@ -112,7 +112,7 @@ pub const Vector4Int = extern struct {
return self.x * other.x + self.y * other.y + self.z * other.z + self.w * other.w;
}
pub fn format(self: Vector4Int, w: *std.io.Writer) !void {
pub fn format(self: Vector4Int, w: *std.Io.Writer) !void {
try w.print("[{X:0>8}, {X:0>8}, {X:0>8}, {X:0>8}]", .{
@as(u32, @bitCast(self.x)),
@as(u32, @bitCast(self.y)),
@@ -120,4 +120,8 @@ pub const Vector4Int = extern struct {
@as(u32, @bitCast(self.w)),
});
}
test "refAllDecls" {
std.testing.refAllDecls(@This());
}
};

View File

@@ -177,4 +177,8 @@ pub const Vector4Int_x8 = struct {
pub inline fn dot(self: Vector4Int_x8, other: Vector4Int_x8) vm.i32x8 {
return self.x * other.x + self.y * other.y + self.z * other.z + self.w * other.w;
}
test "refAllDecls" {
std.testing.refAllDecls(@This());
}
};

View File

@@ -217,4 +217,8 @@ pub const Vector4x8 = struct {
.w = self.x * vm.ps(m.iw) + self.y * vm.ps(m.jw) + self.z * vm.ps(m.kw) + self.w * vm.ps(m.tw),
};
}
test "refAllDecls" {
std.testing.refAllDecls(@This());
}
};