const std = @import("std"); // Minimal c namespace that wraps the C mock functions // This would normally come from @cImport but we provide it manually for testing pub const c = struct { pub extern fn SDL_CreateGPUDevice(debug_mode: bool) ?*anyopaque; }; // Now we can include the generated bindings which expect a c.zig module // We'll manually inline them for this test since they're simple pub const GPUDevice = opaque {}; pub const GPUPrimitiveType = enum(c_int) { primitivetypeTrianglelist, primitivetypeTrianglestrip, }; pub inline fn createGPUDevice(debug_mode: bool) ?*GPUDevice { return @ptrCast(c.SDL_CreateGPUDevice(debug_mode)); } // Tests demonstrating the mock compilation and linkage works test "can call createGPUDevice with debug enabled" { const device = createGPUDevice(true); try std.testing.expect(device == null); // Mock returns null } test "can call createGPUDevice with debug disabled" { const device = createGPUDevice(false); try std.testing.expect(device == null); // Mock returns null } test "enum values compile and are distinct" { const triangleList: GPUPrimitiveType = .primitivetypeTrianglelist; const triangleStrip: GPUPrimitiveType = .primitivetypeTrianglestrip; try std.testing.expect(triangleList == .primitivetypeTrianglelist); try std.testing.expect(triangleStrip == .primitivetypeTrianglestrip); try std.testing.expect(triangleList != triangleStrip); } test "opaque type has correct size" { // Opaque types should be pointer-sized const ptr: ?*GPUDevice = null; try std.testing.expect(@sizeOf(@TypeOf(ptr)) == @sizeOf(?*anyopaque)); }