Skip to content

graff — a fast agentic coding harness in Zig: multi-provider, MCP, workflows, DGM evolution loop, TS/Python SDKs

Python

test: compare xAI remaining percent approximately

Rach Pradhan4348567c2506
diff --git a/src/plan_usage.zig b/src/plan_usage.zig
index 50aa8046..a25a1b1b 100644
--- a/src/plan_usage.zig
+++ b/src/plan_usage.zig
@@ -228,6 +228,6 @@ test "xAI header remaining is remaining/limit" {
defer arena_state.deinit();
const report = try parseRateLimitHeaders(arena_state.allocator(), "58", "100", "80", "100");
try std.testing.expectEqual(@as(usize, 2), report.windows.len);
- try std.testing.expectEqual(@as(f64, 58), report.windows[0].remaining_percent);
- try std.testing.expectEqual(@as(f64, 80), report.windows[1].remaining_percent);
+ try std.testing.expectApproxEqAbs(@as(f64, 58), report.windows[0].remaining_percent, 1e-9);
+ try std.testing.expectApproxEqAbs(@as(f64, 80), report.windows[1].remaining_percent, 1e-9);
}