From 3514b4fe9695eaa5a567efbc92467b5ccbf55c4c Mon Sep 17 00:00:00 2001 From: Philippe Pittoli Date: Wed, 18 Jan 2023 01:46:42 +0100 Subject: [PATCH] Switch: tests pass. --- zig-impl/src/switch.zig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zig-impl/src/switch.zig b/zig-impl/src/switch.zig index 6233622..71b2447 100644 --- a/zig-impl/src/switch.zig +++ b/zig-impl/src/switch.zig @@ -197,11 +197,11 @@ test "creation and display" { try print_eq("{ (5,6)(6,5) }", .{switchdb}); } -fn successful_in (_: i32, mcontent: [*]const u8, mlen: *u32) CBEventType { +fn successful_in (_: i32, mcontent: [*]u8, mlen: *u32) CBEventType { var m = Message.init(8, std.heap.c_allocator, "coucou") catch unreachable; defer m.deinit(); - var fbs = std.io.fixedBufferStream(mcontent); + var fbs = std.io.fixedBufferStream(mcontent[0..mlen.*]); var writer = fbs.writer(); _ = m.write (writer) catch unreachable; mlen.* = @truncate(u32, m.payload.len);