use arris_debug::corpus::{self, CorpusError};
use arris_debug::fixtures;
fn run(name: &str) {
let dir = fixtures::corpus_root().join(name);
let fixture = fixtures::load(&dir).unwrap();
for variant in fixture.recipe.variant_names() {
if let Err(e) = corpus::run(&dir, &variant) {
panic!("{name} [{variant}]: {e}");
}
}
}
fn run_variant(name: &str, variant: &str) {
let dir = fixtures::corpus_root().join(name);
if let Err(e) = corpus::run(&dir, variant) {
panic!("{name} [{variant}]: {e}");
}
}
#[test]
fn primitive_box() {
run("primitive/box");
}
#[test]
fn primitive_cylinder() {
run("primitive/cylinder");
}
#[test]
fn transform_posed_cylinder() {
run("transform/posed-cylinder");
}
#[test]
fn transform_moved_hollow_ring() {
run("transform/moved-hollow-ring");
}
#[test]
fn boolean_through_hole() {
run("boolean/through-hole");
}
#[test]
fn boolean_blind_hole() {
run("boolean/blind-hole");
}
#[test]
fn boolean_probe_through_hole_m() {
run("boolean/probe-through-hole-m");
}
#[test]
fn boolean_probe_blind_hole_m() {
run("boolean/probe-blind-hole-m");
}
#[test]
fn boolean_probe_flush_union_m() {
run("boolean/probe-flush-union-m");
}
#[test]
fn boolean_bolt_pattern_8() {
run("boolean/bolt-pattern-8");
}
#[test]
fn boolean_flush_union() {
run("boolean/flush-union");
}
#[test]
fn boolean_corner_union() {
run("boolean/corner-union");
}
#[test]
fn boolean_corner_common() {
run("boolean/corner-common");
}
#[test]
fn boolean_corner_cut() {
run("boolean/corner-cut");
}
#[test]
fn boolean_flush_common() {
run("boolean/flush-common");
}
#[test]
fn boolean_disjoint_cut() {
run("boolean/disjoint-cut");
}
#[test]
fn boolean_frame_cut() {
run("boolean/frame-cut");
}
#[test]
fn boolean_swallow_cut() {
run("boolean/swallow-cut");
}
#[test]
fn boolean_split_cut() {
run("boolean/split-cut");
}
#[test]
fn boolean_enclosed_cavity() {
run("boolean/enclosed-cavity");
}
#[test]
fn boolean_disjoint_fuse() {
run("boolean/disjoint-fuse");
}
#[test]
fn boolean_cavity_cylinder() {
run("boolean/cavity-cylinder");
}
#[test]
fn boolean_lump_in_cavity() {
run("boolean/lump-in-cavity");
}
#[test]
fn boolean_edge_touching_fuse() {
run("boolean/edge-touching-fuse");
}
#[test]
fn boolean_boss() {
run("boolean/boss");
}
#[test]
fn boolean_boss_flush() {
run("boolean/boss-flush");
}
#[test]
fn boolean_coaxial_fuse() {
run("boolean/coaxial-fuse");
}
#[test]
fn boolean_oblique_hole() {
run("boolean/oblique-hole");
}
#[test]
fn boolean_tangent_outside_cut() {
run("boolean/tangent-outside-cut");
}
#[test]
fn boolean_tangent_hole() {
run("boolean/tangent-hole");
}
#[test]
fn boolean_posed_through_hole() {
run("boolean/posed-through-hole");
}
#[test]
fn boolean_coaxial_cut() {
run("boolean/coaxial-cut");
}
#[test]
fn boolean_disjoint_common() {
run("boolean/disjoint-common");
}
#[test]
fn boolean_sliver_common() {
run("boolean/sliver-common");
}
#[test]
fn boolean_cross_cylinders_common() {
run("boolean/cross-cylinders-common");
}
#[test]
fn boolean_cross_cylinders_fuse() {
run("boolean/cross-cylinders-fuse");
}
#[test]
fn boolean_cross_cylinders_cut() {
run("boolean/cross-cylinders-cut");
}
#[test]
fn boolean_oblique_cross_common() {
run("boolean/oblique-cross-common");
}
#[test]
fn boolean_seam_through_crossing_common() {
run("boolean/seam-through-crossing-common");
}
#[test]
fn boolean_seam_beside_crossing_fuse() {
run("boolean/seam-beside-crossing-fuse");
}
#[test]
fn boolean_seam_a_tolerance_from_crossing_fuse() {
run("boolean/seam-a-tolerance-from-crossing-fuse");
}
#[test]
fn boolean_flush_union_band_ends() {
run("boolean/flush-union-band-ends");
}
#[test]
fn boolean_boss_flush_band_ends() {
run("boolean/boss-flush-band-ends");
}
#[test]
fn boolean_pin_in_bore_fuse_band_ends() {
run("boolean/pin-in-bore-fuse-band-ends");
}
#[test]
fn boolean_coaxial_fuse_band_ends() {
run("boolean/coaxial-fuse-band-ends");
}
#[test]
fn boolean_coaxial_cut_band_ends() {
run("boolean/coaxial-cut-band-ends");
}
#[test]
fn boolean_tangent_cylinders_cut_band_ends() {
run("boolean/tangent-cylinders-cut-band-ends");
}
#[test]
fn boolean_tangent_hole_band_ends() {
run("boolean/tangent-hole-band-ends");
}
#[test]
fn boolean_tangent_hole_a_quarter_off() {
run("boolean/tangent-hole-a-quarter-off");
}
#[test]
fn boolean_tangent_outside_cut_band_ends() {
run("boolean/tangent-outside-cut-band-ends");
}
#[test]
fn boolean_pipe_elbow_fuse_band_ends() {
run("boolean/pipe-elbow-fuse-band-ends");
}
#[test]
fn boolean_edge_touching_band_ends() {
run("boolean/edge-touching-band-ends");
}
#[test]
fn boolean_flush_union_four_into() {
run("boolean/flush-union-four-into");
}
#[test]
fn boolean_boss_flush_four_into() {
run("boolean/boss-flush-four-into");
}
#[test]
fn boolean_pin_in_bore_four_out() {
run("boolean/pin-in-bore-four-out");
}
#[test]
fn boolean_coaxial_fuse_four_off() {
run("boolean/coaxial-fuse-four-off");
}
#[test]
fn boolean_coaxial_fuse_four_off_back() {
run("boolean/coaxial-fuse-four-off-back");
}
#[test]
fn boolean_tangent_cylinders_a_quarter_off() {
run("boolean/tangent-cylinders-a-quarter-off");
}
#[test]
fn boolean_tangent_outside_a_quarter_off() {
run("boolean/tangent-outside-a-quarter-off");
}
#[test]
fn boolean_edge_touching_four_into() {
run("boolean/edge-touching-four-into");
}
#[test]
fn boolean_edge_touching_tilted_cut() {
run("boolean/edge-touching-tilted-cut");
}
#[test]
#[ignore = "L4, a loop of zero signed area: the sliver face between the seam's two crossings and the crossing vertex, three vertices a few tolerances apart, is kept and its (u, v) polygon does not resolve it (docs/BACKLOG.md, material a tolerance or two thick)"]
fn regression_seam_two_tolerances_from_crossing_common() {
run("regression/seam-two-tolerances-from-crossing-common");
}
#[test]
#[ignore = "OpError::Degenerate, Reason::NonManifold naming the singular vertex: the main wall's two pieces meet only there, pinched between the drill's exits, a shell touching itself at a point that a manifold Solid does not hold; the desired body is a General one (docs/BACKLOG.md, a shell touching itself at a vertex)"]
fn regression_singular_bore_cut() {
run("regression/singular-bore-cut");
}
#[test]
#[ignore = "Reason::BesideSingularity, a section passes the sphere's pole without running through it, nearer than the face's (u, v) resolves (docs/BACKLOG.md, polygons by span and chords in length)"]
fn regression_ball_beside_pole_slice_cut() {
run("regression/ball-beside-pole-slice-cut");
}
#[test]
#[ignore = "Fault::Split EmptySubEdge, Fault::CommonBlock, Fault::Split Turn, and plane against plane Unsupported a hair off parallel (docs/BACKLOG.md, ADR-0022)"]
fn regression_flush_union_a_tolerance_off() {
run("regression/flush-union-a-tolerance-off");
}
#[test]
#[ignore = "plane against plane Unsupported a hair off parallel; beyond it Fault::Split, a section edge ends at a node nothing else reaches (docs/BACKLOG.md, ADR-0022)"]
fn regression_boss_flush_tilted() {
run("regression/boss-flush-tilted");
}
#[test]
#[ignore = "plane against plane Unsupported a hair off parallel once posed; the survey built the same pair into a union that fails the checker (docs/BACKLOG.md, ADR-0022)"]
fn regression_boss_flush_posed_gap_fuse() {
run("regression/boss-flush-posed-gap-fuse");
}
#[test]
#[ignore = "Fault::Split Dangling and NoInterior, and a union that fails the checker (docs/BACKLOG.md, ADR-0022)"]
fn regression_pin_in_bore_a_tolerance_off() {
run("regression/pin-in-bore-a-tolerance-off");
}
#[test]
#[ignore = "Fault::CommonBlock, Fault::Split NoInterior and Dangling, Fault::Builder EdgeUses, circle against plane Unsupported (docs/BACKLOG.md, ADR-0022)"]
fn regression_coaxial_fuse_a_tolerance_off() {
run("regression/coaxial-fuse-a-tolerance-off");
}
#[test]
#[ignore = "Fault::Seam, a section edge crosses a seam without a pave there (docs/BACKLOG.md, ADR-0022)"]
fn regression_coaxial_fuse_tilted_seam() {
run("regression/coaxial-fuse-tilted-seam");
}
#[test]
#[ignore = "Fault::Geometry, a degenerate cylinder surface with a non-finite frame (docs/BACKLOG.md, ADR-0022)"]
fn regression_coaxial_fuse_tilted_frame() {
run("regression/coaxial-fuse-tilted-frame");
}
#[test]
#[ignore = "Fault::Split, a section edge ends at a node nothing else reaches (docs/BACKLOG.md, ADR-0022)"]
fn regression_tangent_cylinders_a_tolerance_in() {
run("regression/tangent-cylinders-a-tolerance-in");
}
#[test]
#[ignore = "the common fails the checker, a panic in a debug build: L4, sliver loops of zero signed area, where the desired is a refusal (docs/BACKLOG.md, ADR-0022)"]
fn regression_tangent_cylinders_overlap_common() {
run("regression/tangent-cylinders-overlap-common");
}
#[test]
#[ignore = "Fault::Lumps, two shells of the result meet, where the desired is TangentContact (docs/BACKLOG.md, ADR-0022)"]
fn regression_tangent_cylinders_tilted_fuse() {
run("regression/tangent-cylinders-tilted-fuse");
}
#[test]
#[ignore = "Fault::Builder EdgeUses, where the desired is TangentContact (docs/BACKLOG.md, ADR-0022)"]
fn regression_tangent_hole_fuse() {
run("regression/tangent-hole-fuse");
}
#[test]
#[ignore = "Fault::Split NoInterior and Dangling, plane against cylinder Unsupported, where the desired is TangentContact (docs/BACKLOG.md, ADR-0022)"]
fn regression_tangent_hole_a_tolerance_out() {
run("regression/tangent-hole-a-tolerance-out");
}
#[test]
#[ignore = "a body where TangentContact is desired, which S5 refuses: two faces intersect away from their shared edges (docs/BACKLOG.md, ADR-0022)"]
fn regression_tangent_hole_tilted_posed_cut() {
run("regression/tangent-hole-tilted-posed-cut");
}
#[test]
#[ignore = "Fault::Split NoInterior and Dangling, and a section fit that still deviates at its most spans (docs/BACKLOG.md, ADR-0022)"]
fn regression_tangent_outside_a_tolerance_in() {
run("regression/tangent-outside-a-tolerance-in");
}
#[test]
#[ignore = "Fault::Split Hole, where the desired is a refusal (docs/BACKLOG.md, ADR-0022)"]
fn regression_tangent_outside_grown_common() {
run("regression/tangent-outside-grown-common");
}
#[test]
#[ignore = "a body where a refusal is desired, which B1 refuses: no outer shell (docs/BACKLOG.md, ADR-0022)"]
fn regression_tangent_outside_tilted_posed_common() {
run("regression/tangent-outside-tilted-posed-common");
}
#[test]
#[ignore = "Fault::Geometry, the section fit still deviates by 1.7e-7 (at step 1 the ellipse section off its surfaces by 1.2e-7), where the desired is TangentContact (docs/BACKLOG.md, ADR-0022)"]
fn regression_tangent_outside_tilted_posed_fuse() {
run("regression/tangent-outside-tilted-posed-fuse");
}
#[test]
#[ignore = "Fault::CommonBlock, Fault::Split Turn, torus sections called degenerate (Fault::Geometry), plane against plane and circle against plane Unsupported (docs/BACKLOG.md, ADR-0022)"]
fn regression_pipe_elbow_a_tolerance_off() {
run("regression/pipe-elbow-a-tolerance-off");
}
#[test]
#[ignore = "Fault::Split, a cycle does not turn once; the survey built the same pair into a fit whose normal equations are singular (docs/BACKLOG.md, ADR-0022)"]
fn regression_pipe_elbow_posed_fuse() {
run("regression/pipe-elbow-posed-fuse");
}
#[test]
#[ignore = "one vertex too many (10/14): the edges cross at a grazing angle and the crossing's hits, scattered along the edge by the rounding over it, are two vertices (docs/BACKLOG.md, a hair off parallel; ADR-0022)"]
fn regression_edge_touching_tilted_posed_cut() {
run("regression/edge-touching-tilted-posed-cut");
}
#[test]
fn boolean_tee_fuse() {
run("boolean/tee-fuse");
}
#[test]
fn boolean_tee_unequal_fuse() {
run("boolean/tee-unequal-fuse");
}
#[test]
fn boolean_tee_unequal_cut() {
run("boolean/tee-unequal-cut");
}
#[test]
fn boolean_tee_unequal_common() {
run("boolean/tee-unequal-common");
}
#[test]
fn boolean_skew_hole_cut() {
run("boolean/skew-hole-cut");
}
#[test]
fn boolean_skew_bore_cut() {
run("boolean/skew-bore-cut");
}
#[test]
fn boolean_tee_unequal_slot_cut() {
run("boolean/tee-unequal-slot-cut");
}
#[test]
fn boolean_tee_unequal_drill_cut() {
run("boolean/tee-unequal-drill-cut");
}
#[test]
fn boolean_parallel_cylinders_cut() {
run("boolean/parallel-cylinders-cut");
}
#[test]
fn boolean_parallel_cylinders_common() {
run("boolean/parallel-cylinders-common");
}
#[test]
fn boolean_parallel_cylinders_fuse() {
run("boolean/parallel-cylinders-fuse");
}
#[test]
fn boolean_parallel_cylinders_seam() {
run("boolean/parallel-cylinders-seam");
}
#[test]
fn boolean_tangent_cylinders_cut() {
run("boolean/tangent-cylinders-cut");
}
#[test]
fn boolean_tangent_cylinders_fuse() {
run("boolean/tangent-cylinders-fuse");
}
#[test]
fn boolean_pin_in_bore_fuse() {
run("boolean/pin-in-bore-fuse");
}
#[test]
fn boolean_pin_in_bore_cut() {
run("boolean/pin-in-bore-cut");
}
#[test]
fn boolean_short_cross_cylinders_fuse() {
run("boolean/short-cross-cylinders-fuse");
}
#[test]
fn boolean_elliptic_operand_cut() {
run("boolean/elliptic-operand-cut");
}
#[test]
fn boolean_elliptic_cross_fuse() {
run("boolean/elliptic-cross-fuse");
}
#[test]
fn boolean_frustum_oblique_cut() {
run("boolean/frustum-oblique-cut");
}
#[test]
fn boolean_frustum_slot_cut() {
run("boolean/frustum-slot-cut");
}
#[test]
fn boolean_frustum_cross_drill_cut() {
run("boolean/frustum-cross-drill-cut");
}
#[test]
fn boolean_chamfered_boss_slot_cut() {
run("boolean/chamfered-boss-slot-cut");
}
#[test]
fn boolean_ball_corner_cut() {
run("boolean/ball-corner-cut");
}
#[test]
fn boolean_ball_offset_drill_cut() {
run("boolean/ball-offset-drill-cut");
}
#[test]
fn boolean_ball_polar_drill_cut() {
run("boolean/ball-polar-drill-cut");
}
#[test]
fn boolean_ball_ball_common() {
run("boolean/ball-ball-common");
}
#[test]
fn boolean_ring_slab_common() {
run("boolean/ring-slab-common");
}
#[test]
fn boolean_ring_corner_common() {
run("boolean/ring-corner-common");
}
#[test]
fn boolean_ring_pin_cut() {
run("boolean/ring-pin-cut");
}
#[test]
fn boolean_filleted_boss_drill_cut() {
run("boolean/filleted-boss-drill-cut");
}
#[test]
fn boolean_filleted_corner_notch_cut() {
run("boolean/filleted-corner-notch-cut");
}
#[test]
fn boolean_cone_apex_slice_cut() {
run("boolean/cone-apex-slice-cut");
}
#[test]
fn boolean_ball_pole_slice_cut() {
run("boolean/ball-pole-slice-cut");
}
#[test]
fn boolean_pole_slice_beside_seam_cut() {
run("boolean/pole-slice-beside-seam-cut");
}
#[test]
fn boolean_frustum_stub_cut_then_fuse() {
run("boolean/frustum-stub-cut-then-fuse");
}
#[test]
fn boolean_grazing_ball_bar_cut() {
run("boolean/grazing-ball-bar-cut");
}
#[test]
fn boolean_ball_pole_drill_cut() {
run("boolean/ball-pole-drill-cut");
}
#[test]
fn boolean_pipe_elbow_fuse() {
run("boolean/pipe-elbow-fuse");
}
#[test]
fn boolean_ball_in_bore_cut() {
run("boolean/ball-in-bore-cut");
}
#[test]
fn boolean_ball_on_apex_common() {
run("boolean/ball-on-apex-common");
}
#[test]
fn sweep_extrude_plate_with_hole() {
run("sweep/extrude-plate-with-hole");
}
#[test]
fn sweep_extrude_slot() {
run("sweep/extrude-slot");
}
#[test]
fn sweep_extrude_downward() {
run("sweep/extrude-downward");
}
#[test]
fn sweep_extrude_ellipse() {
run("sweep/extrude-ellipse");
}
#[test]
fn sweep_extrude_elliptic_slot() {
run("sweep/extrude-elliptic-slot");
}
#[test]
fn sweep_extrude_plate_elliptic_hole() {
run("sweep/extrude-plate-elliptic-hole");
}
#[test]
fn sweep_revolve_tube() {
run("sweep/revolve-tube");
}
#[test]
fn sweep_revolve_quarter() {
run("sweep/revolve-quarter");
}
#[test]
fn sweep_revolve_l_profile() {
run("sweep/revolve-l-profile");
}
#[test]
fn sweep_revolve_hollow_ring() {
run("sweep/revolve-hollow-ring");
}
#[test]
fn sweep_revolve_onto_axis() {
run("sweep/revolve-onto-axis");
}
#[test]
fn sweep_probe_revolve_onto_axis_m() {
run("sweep/probe-revolve-onto-axis-m");
}
#[test]
fn sweep_revolve_notch_to_axis() {
run("sweep/revolve-notch-to-axis");
}
#[test]
fn sweep_revolve_frustum() {
run("sweep/revolve-frustum");
}
#[test]
fn sweep_revolve_barrel() {
run("sweep/revolve-barrel");
}
#[test]
fn sweep_revolve_ring() {
run("sweep/revolve-ring");
}
#[test]
fn sweep_revolve_ellipse() {
run("sweep/revolve-ellipse");
}
#[test]
fn blend_box_edge_fillet() {
run("blend/box-edge-fillet");
}
#[test]
fn blend_box_cap_edge_fillet() {
run("blend/box-cap-edge-fillet");
}
#[test]
fn blend_box_posed_edge_fillet() {
run("blend/box-posed-edge-fillet");
}
#[test]
fn blend_box_oblique_end() {
run("blend/box-oblique-end");
}
#[test]
fn blend_l_inner_edge() {
run("blend/l-inner-edge");
}
#[test]
fn blend_box_four_verticals() {
run("blend/box-four-verticals");
}
#[test]
fn blend_box_edge_chamfer() {
run("blend/box-edge-chamfer");
}
#[test]
fn blend_box_four_vertical_chamfers() {
run("blend/box-four-vertical-chamfers");
}
#[test]
fn blend_box_corner_chamfers() {
run("blend/box-corner-chamfers");
}
#[test]
fn blend_second_fillet() {
run("blend/second-fillet");
}
#[test]
fn blend_probe_second_fillet_m() {
run("blend/probe-second-fillet-m");
}
#[test]
fn blend_probe_cap_and_vertical_fillet_m() {
run("blend/probe-cap-and-vertical-fillet-m");
}
#[test]
fn blend_tangent_chain_cap_edge() {
run("blend/tangent-chain-cap-edge");
}
#[test]
fn blend_five_edge_vertex() {
run("blend/five-edge-vertex");
}
#[test]
fn blend_box_corner_three_fillets() {
run("blend/box-corner-three-fillets");
}
#[test]
fn blend_box_all_edges_fillet() {
run("blend/box-all-edges-fillet");
}
#[test]
fn blend_box_corner_three_chamfers() {
run("blend/box-corner-three-chamfers");
}
#[test]
fn blend_fillet_miter() {
run("blend/fillet-miter");
}
#[test]
fn blend_d_chord_edge() {
run("blend/d-chord-edge");
}
#[test]
fn blend_rib_root_edge() {
run("blend/rib-root-edge");
}
#[test]
fn blend_hole_rim_fillet() {
run("blend/hole-rim-fillet");
}
#[test]
fn blend_hole_rim_chamfer() {
run("blend/hole-rim-chamfer");
}
#[test]
fn blend_boss_base_fillet() {
run("blend/boss-base-fillet");
}
#[test]
fn provenance_bolt_pattern_rebuild() {
run_variant("provenance/bolt-pattern-rebuild", "default");
}
#[test]
fn provenance_bolt_pattern_rebuild_thicker_wider() {
run_variant("provenance/bolt-pattern-rebuild", "thicker-wider");
}
#[test]
fn provenance_bolt_pattern_rebuild_tighter() {
run_variant("provenance/bolt-pattern-rebuild", "tighter");
}
#[test]
fn provenance_split_bar_cut() {
run_variant("provenance/split-bar-cut", "default");
}
#[test]
fn provenance_split_bar_cut_left() {
run_variant("provenance/split-bar-cut", "left");
}
#[test]
fn provenance_split_bar_cut_right() {
run_variant("provenance/split-bar-cut", "right");
}
#[test]
fn provenance_split_bar_cut_narrow() {
run_variant("provenance/split-bar-cut", "narrow");
}
#[test]
fn provenance_split_frame_cut() {
run_variant("provenance/split-frame-cut", "default");
}
#[test]
fn provenance_split_frame_cut_left() {
run_variant("provenance/split-frame-cut", "left");
}
#[test]
fn provenance_split_frame_cut_right() {
run_variant("provenance/split-frame-cut", "right");
}
#[test]
fn provenance_split_frame_cut_narrow() {
run_variant("provenance/split-frame-cut", "narrow");
}
#[test]
fn provenance_split_cylinder_seam() {
run_variant("provenance/split-cylinder-seam", "default");
}
#[test]
fn provenance_split_cylinder_seam_turned_back() {
run_variant("provenance/split-cylinder-seam", "turned-back");
}
#[test]
fn provenance_split_cylinder_seam_turned_on() {
run_variant("provenance/split-cylinder-seam", "turned-on");
}
#[test]
fn provenance_split_cylinder_seam_narrow() {
run_variant("provenance/split-cylinder-seam", "narrow");
}
#[test]
fn provenance_split_cross_common() {
run_variant("provenance/split-cross-common", "default");
}
#[test]
fn provenance_split_cross_common_larger() {
run_variant("provenance/split-cross-common", "larger");
}
#[test]
fn provenance_split_cross_common_longer() {
run_variant("provenance/split-cross-common", "longer");
}
#[test]
fn provenance_split_cross_common_turned() {
run_variant("provenance/split-cross-common", "turned");
}
#[test]
fn provenance_split_edge_notch() {
run_variant("provenance/split-edge-notch", "default");
}
#[test]
fn provenance_split_edge_notch_slid() {
run_variant("provenance/split-edge-notch", "slid");
}
#[test]
fn provenance_split_edge_notch_apart() {
run_variant("provenance/split-edge-notch", "apart");
}
#[test]
fn provenance_split_edge_notch_narrow() {
run_variant("provenance/split-edge-notch", "narrow");
}
#[test]
fn an_unknown_variant_fails_with_its_name() {
let dir = fixtures::corpus_root().join("primitive/box");
let err = corpus::run(&dir, "nope").unwrap_err();
assert!(
matches!(&err, CorpusError::Variant { variant, .. } if variant == "nope"),
"{err}"
);
}
#[test]
fn a_dump_that_differs_by_one_id_fails_with_the_diff() {
let scratch = tempdir("dump-diff");
let from = fixtures::corpus_root().join("primitive/cylinder");
for file in ["fixture.json", "expected.json"] {
std::fs::copy(from.join(file), scratch.join(file)).unwrap();
}
let err = corpus::run(&scratch, "default").unwrap_err();
assert!(
matches!(&err, CorpusError::Dump { what, .. } if what.contains("not committed")),
"{err}"
);
let dump = std::fs::read_to_string(from.join("dump.txt")).unwrap();
assert!(dump.contains("coedge +e1 "), "the seam walked up");
std::fs::write(
scratch.join("dump.txt"),
dump.replacen("coedge +e1 ", "coedge +e7 ", 1),
)
.unwrap();
let err = corpus::run(&scratch, "default").unwrap_err();
match &err {
CorpusError::Dump { what, .. } => {
let committed = what
.lines()
.any(|l| l.starts_with('-') && l.contains("coedge +e7"));
let built = what
.lines()
.any(|l| l.starts_with('+') && l.contains("coedge +e1"));
assert!(committed && built, "{what}");
}
other => panic!("{other}"),
}
std::fs::write(scratch.join("dump.txt"), &dump).unwrap();
corpus::run(&scratch, "default").unwrap();
}
fn tempdir(tag: &str) -> std::path::PathBuf {
let dir = std::env::temp_dir().join(format!("arris-corpus-{tag}-{}", std::process::id()));
let _ = std::fs::remove_dir_all(&dir);
std::fs::create_dir_all(&dir).unwrap();
dir
}