Skip to content

Commit affe211

Browse files
committed
Align comparison fixture with integrated route certificates
1 parent 8ab56f2 commit affe211

1 file changed

Lines changed: 18 additions & 10 deletions

File tree

‎problemreductions-cli/tests/cli_tests.rs‎

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ fn path_text_preserves_variant_conversion_steps() {
5151

5252
#[test]
5353
fn polynomial_comparison_default_layout_and_opt_in_proofs() {
54-
// The feedback-arc route adds a quadratic-size candidate; retain both equivalent set-packing routes.
54+
// The first two clique routes are equivalent; set-packing and feedback-arc routes add comparisons.
5555
let args = ["path", "MIS", "QUBO", "--compare", "--limit", "4"];
5656
let output = pred().args(args).output().unwrap();
5757
assert!(output.status.success());
@@ -64,14 +64,14 @@ fn polynomial_comparison_default_layout_and_opt_in_proofs() {
6464
assert!(text.contains("Path 1") && text.contains("num_vars"));
6565
assert!(!text.contains("[upper bound]") && !text.contains("[exact]"));
6666
assert!(text[pairs..unresolved]
67-
.contains("1 dominated, 1 equivalent, 4 proven incomparable, 0 unresolved"));
67+
.contains("2 dominated, 1 equivalent, 3 proven incomparable, 0 unresolved"));
6868
assert!(!text.contains("worst case:") && !text.contains("Generic candidate front"));
69-
assert!(text.contains("Paths 1, 2: proven incomparable"));
70-
assert!(text.contains("Paths 2, 4: Path 2 ≡ Path 4"));
69+
assert!(text.contains("Paths 1, 3: proven incomparable"));
70+
assert!(text.contains("Paths 1, 2: Path 1 ≡ Path 2"));
7171
assert!(
7272
text.contains("Ignores exact-cancellation families") && text.contains("bounded strata")
7373
);
74-
assert!(text.contains("4 proven incomparable, 0 unresolved"));
74+
assert!(text.contains("3 proven incomparable, 0 unresolved"));
7575
assert!(
7676
!text.contains("Field proofs") && !text.contains("Witness {") && !text.contains("f/g → ∞")
7777
);
@@ -80,8 +80,8 @@ fn polynomial_comparison_default_layout_and_opt_in_proofs() {
8080
assert!(output.status.success());
8181
let text = String::from_utf8(output.stdout).unwrap();
8282
assert!(
83-
text.contains("Paths 1, 2: proven incomparable")
84-
&& text.contains("Paths 2, 4: Path 2 ≡ Path 4")
83+
text.contains("Paths 1, 3: proven incomparable")
84+
&& text.contains("Paths 1, 2: Path 1 ≡ Path 2")
8585
);
8686
assert!(text.contains("Field proofs") && text.contains("f/g → ∞"));
8787
assert!(text.contains("f ≡ g after expansion"));
@@ -90,17 +90,25 @@ fn polynomial_comparison_default_layout_and_opt_in_proofs() {
9090
let output = pred().args(args).arg("--json").output().unwrap();
9191
assert!(output.status.success());
9292
let json: serde_json::Value = serde_json::from_slice(&output.stdout).unwrap();
93+
for (route, step, name) in [
94+
(0, 0, "MaximumClique"),
95+
(1, 1, "MaximumClique"),
96+
(2, 1, "MaximumSetPacking"),
97+
(3, 2, "MinimumFeedbackArcSet"),
98+
] {
99+
assert_eq!(json["paths"][route]["path"][step]["to"]["name"], name);
100+
}
93101
let view = &json["polynomial_comparison"];
94102
assert_eq!(view["schema_version"], 5);
95103
assert_eq!(view["mode"], "generic");
96-
assert_eq!(view["counts"]["Incomparable"], 4);
104+
assert_eq!(view["counts"]["Incomparable"], 3);
97105
assert!(view.get("generic_counts").is_none());
98106
assert!(view.get("generic_candidate_front").is_none());
99107
assert!(view["pairs"][0]["fields"]["num_vars"]["forward"]["certificate"].is_object());
100-
let identity = &view["pairs"][4]["fields"]["num_vars"]["forward"]["certificate"];
108+
let identity = &view["pairs"][0]["fields"]["num_vars"]["forward"]["certificate"];
101109
assert_eq!(identity["kind"], "identity");
102110
assert_eq!(identity.as_object().unwrap().len(), 1);
103-
assert!(view["pairs"][4]["fields"]["num_vars"]
111+
assert!(view["pairs"][0]["fields"]["num_vars"]
104112
.get("generic")
105113
.is_none());
106114
let output = pred()

0 commit comments

Comments
 (0)