Address review findings: const guards, qualifying-count regression test, owned keys
- Add compile-time const assertions (const _: () block, stable on 1.95) for MAX_RQ, MIN_VALID_TIME, TIME_TOLERANCE, TEST_BOWL_FACTOR, and CONCURRENCY_LIMIT so bad constant edits fail the build; remove the stale comment that incorrectly claimed compile-time validation existed - Add regression test for the qualifying-count fix: car with 3 configs where only 2 meet min_count and 2 copies suffice to cover the qualifying ones (previously phantom-wishlisted via overcounting) - Use owned String keys in qualifying_per_guid to decouple the map from guid_to_rid's allocations - Clarify write_improve_csv doc (exactly one row per car), restore the remove.csv test section header, add trailing newline to .gitignore
This commit is contained in:
parent
2ab66a249b
commit
39d1e1d71b
3 changed files with 84 additions and 16 deletions
|
|
@ -46,6 +46,16 @@ pub const TEST_BOWL_FACTOR: f64 = 2000.0;
|
|||
/// since each concurrent permit holder also occupies a `spawn_blocking` thread.
|
||||
pub const CONCURRENCY_LIMIT: usize = 20;
|
||||
|
||||
// Compile-time guards: a bad edit to any constant above fails the build here
|
||||
// instead of producing subtly wrong behavior at runtime.
|
||||
const _: () = {
|
||||
assert!(MAX_RQ > 0);
|
||||
assert!(MIN_VALID_TIME > 0.0);
|
||||
assert!(TIME_TOLERANCE > 0.0);
|
||||
assert!(TEST_BOWL_FACTOR > 0.0);
|
||||
assert!(CONCURRENCY_LIMIT > 0);
|
||||
};
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Core parsing: per-car timing data
|
||||
// ---------------------------------------------------------------------------
|
||||
|
|
@ -736,10 +746,4 @@ mod tests {
|
|||
ctx.best_cars.get(&("Monaco Streets".to_string(), 90, "Wet".to_string())).unwrap();
|
||||
assert_eq!(records[0].config, "323", "bare config should pass through");
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// Constants tests
|
||||
// =======================================================================
|
||||
// Constants are compile-time validated - explicit tests removed as they
|
||||
// check literal values that cannot fail unless the constants themselves are edited
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue