diff --git a/src/aro/Preprocessor.zig b/src/aro/Preprocessor.zig index 63bf0858..8e3f535a 100644 --- a/src/aro/Preprocessor.zig +++ b/src/aro/Preprocessor.zig @@ -271,7 +271,7 @@ fn clearBuffers(pp: *Preprocessor) void { pub fn expansionSlice(pp: *Preprocessor, tok: Tree.TokenIndex) []Source.Location { const S = struct { fn orderTokenIndex(context: Tree.TokenIndex, item: Tree.TokenIndex) std.math.Order { - return std.math.order(item, context); + return std.math.order(context, item); } }; diff --git a/src/aro/Tokenizer.zig b/src/aro/Tokenizer.zig index f703940f..7ab33103 100644 --- a/src/aro/Tokenizer.zig +++ b/src/aro/Tokenizer.zig @@ -2151,12 +2151,13 @@ test "C23 keywords" { } test "Tokenizer fuzz test" { + return std.testing.fuzz(testTokenizerFuzz, .{}); +} + +fn testTokenizerFuzz(input_bytes: []const u8) anyerror!void { var comp = Compilation.init(std.testing.allocator, std.fs.cwd()); defer comp.deinit(); - const input_bytes = std.testing.fuzzInput(.{}); - if (input_bytes.len == 0) return; - const source = try comp.addSourceFromBuffer("fuzz.c", input_bytes); var tokenizer: Tokenizer = .{