Commit 26cc9b6
test(geometry): close four fixtures that cannot fail for the reason they exist (#3081)
* test(geometry): close four fixtures that share a symmetry with the bug they guard
Each of these passed with the production line it exists to guard deleted or
inverted. Every claim below was checked by applying the mutation and running
the suite, not by reading.
1. `test_mirrored_profile_uses_derived_operator` mirrored a 2.0 x 4.0
IfcRectangleProfileDef about its own Y axis. The corner SET maps onto
itself, and the four assertions were `contains()`, which is order-blind, so
`mirror_profile_about_y_axis` was unguarded end to end: with
`p.x = -p.x` replaced by `p.x = p.x` and `profile.outer.reverse()` deleted,
the whole ifc-lite-geometry lib suite stayed green (718 passed), as did
`issue_828_sectioned_solid_horizontal`, the only other in-crate
IfcMirroredProfileDef coverage. The test's name was also wrong: IFC4
redeclares Operator as derived on the subtype, and
`process_derived_with_depth` short-circuits before ever reading attribute 3.
Replaced with an L-shaped outer contour plus an off-centre hole, asserting
pointwise that x negates and the order reverses, and that both contours keep
their chirality (the compensating `reverse()` is what stops earcut emitting
inside-out triangles). A second test pins the short-circuit with an Operator
that would visibly move the profile if it were applied. Five mutations now
die: dropping the outer negation, the hole negation, either `reverse()`, and
dropping the subtype short-circuit.
2. Every material-layer fixture in the repository is `[0.05, 0.20, 0.05]` of
materials `[200, 201, 200]` at `offset = -0.15` on a 0.30-thick centred
profile: a palindrome in both thickness and material, centred on the
reference line, and `.AXIS2., .POSITIVE.` throughout. Reversing the layer
stack in `build_layer_planes` leaves the cumulative interface distances
(0.05, 0.25) and the asserted `vec![200, 201, 200]` unchanged, and replacing
the authored offset with a hard-coded `-total/2` is numerically the
identity. Both survived all seven pre-existing tests in the file; the
reversal also survived `material_layers_local_frame_test`.
Added a 50/250/100 mm buildup of three distinct materials on a profile
shifted +50 mm in local Y, so `offset = -0.15 != -total/2`, and asserted
each slab's band along the layer axis rather than only its material id.
Added the first `.NEGATIVE.` fixture in the tree: `direction_sense` was 1.0
everywhere, so both of its uses in `build_layer_planes` and the
`NEGATIVE => -1.0` arm of `resolve_layer_set_usage` were unreachable.
Hard-coding `direction_sense = 1.0` now fails.
3. All five `projection_outline` tests pass `ProjectionAxis::Y`, and the only
other in-crate caller passes `Z`. The `X` arm of `project`/`axis_coord` —
sections looking along world X — had no test: swapping it to `(p[1], p[2])`
left the lib suite green (720 passed). `ProjectionAxis::from_u8`, the WASM
boundary decode, was untested too, so exchanging its 0 and 2 arms was
invisible. Added one box with three distinct extents covering X and Z
against each other, a check that flipping leaves V alone, and a from_u8
table test.
4. Every `IfcAxis2Placement3D` unit test in `transform.rs` has EITHER a
non-zero Location OR a non-identity rotation, never both, so
`transform[(_, 3)] = R * location` instead of `location` is the identity to
all four of them (R*t == t at the identity, R*0 == 0 anywhere). It survived
718 of the crate's 719 other lib tests as well, dying only incidentally in
an unrelated half-space test. Pinned in `tests/axis2_placement_frame.rs`
(`transform.rs` is at its module-size ratchet budget) with a 90-degree
placement at (10, 20, 30).
No production code changed and no assertion was weakened. No ratchet budget was
raised and the allowlist digest is untouched.
Verification: ifc-lite-geometry --lib 721 passed / 0 failed / 1 ignored (718
before), full `-p ifc-lite-geometry --no-fail-fast` 0 failures,
`module_size_ratchet` 5 passed, `cargo clippy -p ifc-lite-geometry --all-targets
-D warnings` clean.
* test(geometry): name the test that DOES catch the rotated-translation mutant
The header said the mutation leaves "718 of the crate's 719 other lib tests"
green. Two problems.
The count is stale: main runs 721 today, and a number that shifts with every
added test is a poor thing to record in a comment.
Worse, the parenthetical hides which test fails. One does:
`processors::tests::test_polygonal_bounded_half_space_respects_boundary`, whose
placement is Location (0,0,5) with Axis (0,1,0), so `R * location` is (0,5,0)
and the clip plane moves off the top face.
It is not a substitute for this test, and the header now says why: it reaches
`build_axis2_matrix` through `processors/helpers.rs`'s own attribute-extraction
fork, one of five sharing that builder, and fails with "the clipped strip should
be removed" -- pointing at a boolean, not a placement.
Verified with the mutation the header names, `R * location`, not an adjacent
one. A tx/ty swap leaves that test GREEN and reds 12 others, so it would not
have supported this claim.
* test(geometry): desymmetrise the projection fixture, and correct four claims
Pre-flight review found a test that cannot fail INSIDE the PR whose purpose is
closing tests that cannot fail.
`each_projection_axis_picks_its_own_two_drawing_coordinates` used z in [-1,1].
Under axis=X that is u, and it is symmetric about zero, so the mirror assertion
read (-1 + 1) == 0 and (1 + -1) == 0 with flipping DELETED. Proven: replacing
`[if flipped { -u } else { u }, v]` with `[u, v]` left the test green.
The fixture comment claimed "no extent equals another's negation" -- true, and
the wrong property. It needed "no extent equals ITS OWN negation". z is now
[-1,2] and the same mutation reds it: "flip must mirror u: -1..2 vs -1..2".
Three factual corrections, each re-measured rather than reasoned:
- "the one test that does catch it" was wrong. At FULL crate scope SIX existing
tests fail on the R*location mutant. I measured with `cargo test --lib`, which
excludes `tests/` -- the directory the new test is in -- so five of the six
were invisible to the scope the claim was made at. Header now lists them and
gives the real reason to keep the test: they all fail downstream of a boolean
and point at a CSG result, this one reads the translation column.
- "one of five sharing that matrix builder" is six: transform.rs:60 and :272,
profile_extractor.rs:642, processors/helpers.rs:78 and :202,
router/transforms/parsers.rs:56.
- "transform.rs is at its module-size ratchet budget" is 513 lines against a
budget of 525. The placement decision stands, the stated reason did not.
Also dropped a "718 passed" count for the property it was evidence for. It was
718 when written and is 724 now.
724 passed, 0 failed. clippy --all-targets -D warnings clean.
---------
Co-authored-by: Louis Trümpler <78563314+louistrue@users.noreply.github.com>1 parent 6e51909 commit 26cc9b6
3 files changed
Lines changed: 320 additions & 17 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
351 | 351 | | |
352 | 352 | | |
353 | 353 | | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
354 | 400 | | |
355 | | - | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
356 | 486 | | |
357 | | - | |
358 | | - | |
359 | | - | |
360 | | - | |
361 | | - | |
362 | | - | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
363 | 499 | | |
364 | | - | |
365 | 500 | | |
366 | 501 | | |
367 | 502 | | |
368 | | - | |
369 | | - | |
370 | | - | |
371 | | - | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
372 | 509 | | |
373 | 510 | | |
374 | | - | |
375 | | - | |
376 | | - | |
377 | | - | |
378 | | - | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
379 | 527 | | |
380 | 528 | | |
381 | 529 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
305 | 305 | | |
306 | 306 | | |
307 | 307 | | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
308 | 389 | | |
309 | 390 | | |
310 | 391 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
0 commit comments