diff --git a/src/main.zig b/src/main.zig index 84d0897..a6b00a8 100644 --- a/src/main.zig +++ b/src/main.zig @@ -86,7 +86,7 @@ fn fenGame(str: []const u8, alloc: std.mem.Allocator) [*c]c.game { if (pos > 64) { if (chr == ' ') space += 1; if (space == 1 and chr == 'b') g.whiteToMove = false; - if (space == 1 and chr == 'w') g.whiteToMove = false; + if (space == 1 and chr == 'w') g.whiteToMove = true; continue; } if (std.ascii.isDigit(chr)) pos += @truncate(chr - '0'); @@ -154,6 +154,7 @@ test "uci position" { defer alloc.destroy(game); const out = uci("position startpos", game, alloc); + defer alloc.destroy(out.game); try std.testing.expect(out == .game); - alloc.destroy(out.game); + try std.testing.expect(out.game.whiteToMove == true); }