Skip to content

Commit 61db3c7

Browse files
GiggleLiuclaude
andcommitted
fix: update CBM CLI rejection test for new wire format
The CI Test job for #1065 failed because cli_tests.rs:445 still asserted the old "num_cols must match matrix column count" error. Under the new serde definition, extra num_rows/num_cols fields in the JSON are silently ignored (serde's default behavior for unknown fields when not using deny_unknown_fields), so the previous JSON now deserializes successfully and the CLI no longer rejects it. Switch the test to exercise the actual remaining input validation — ragged-matrix rejection — which is what `validate_matrix_dimensions` guards against and what the in-tree unit test now also covers. Rename the test accordingly. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent c08cbd7 commit 61db3c7

1 file changed

Lines changed: 4 additions & 6 deletions

File tree

problemreductions-cli/tests/cli_tests.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -423,17 +423,15 @@ fn test_evaluate_sat() {
423423
}
424424

425425
#[test]
426-
fn test_evaluate_consecutive_block_minimization_rejects_inconsistent_dimensions() {
426+
fn test_evaluate_consecutive_block_minimization_rejects_ragged_matrix() {
427427
let problem_json = r#"{
428428
"type": "ConsecutiveBlockMinimization",
429429
"data": {
430-
"matrix": [[true]],
431-
"num_rows": 1,
432-
"num_cols": 2,
430+
"matrix": [[true, false], [true]],
433431
"bound": 1
434432
}
435433
}"#;
436-
let tmp = std::env::temp_dir().join("pred_test_eval_cbm_invalid_dims.json");
434+
let tmp = std::env::temp_dir().join("pred_test_eval_cbm_ragged_matrix.json");
437435
std::fs::write(&tmp, problem_json).unwrap();
438436

439437
let output = pred()
@@ -442,7 +440,7 @@ fn test_evaluate_consecutive_block_minimization_rejects_inconsistent_dimensions(
442440
.unwrap();
443441
assert!(!output.status.success());
444442
let stderr = String::from_utf8_lossy(&output.stderr);
445-
assert!(stderr.contains("num_cols must match matrix column count"));
443+
assert!(stderr.contains("same length"));
446444
assert!(!stderr.contains("panicked at"), "stderr: {stderr}");
447445
std::fs::remove_file(&tmp).ok();
448446
}

0 commit comments

Comments
 (0)