Skip to content

Test cases for restrictions on bounded properties (#371) - #451

Open
BIMvoice wants to merge 2 commits into
buildingSMART:developmentfrom
BIMvoice:propose/ids-371-bounded-value-restriction
Open

Test cases for restrictions on bounded properties (#371)#451
BIMvoice wants to merge 2 commits into
buildingSMART:developmentfrom
BIMvoice:propose/ids-371-bounded-value-restriction

Conversation

@BIMvoice

@BIMvoice BIMvoice commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Addresses the restriction half of #371.

What this measures

Searching the whole Documentation/ImplementersDocumentation/TestCases tree, no existing .ids file combines an IFCPROPERTYBOUNDEDVALUE fixture with an xs:restriction requirement. The restriction/ folder only exercises the Attribute facet, and property/'s bounded value fixtures only exercise equality via simpleValue. Restriction against a bounded property's bounds was completely untested.

That gap is not academic. IfcOpenShell's IfcTester had a real bug here: its restriction handling for IfcPropertyBoundedValue did not distinguish LowerBoundValue from UpperBoundValue from SetPointValue, and did not fail when a bound the restriction depends on was missing. We fixed it in IfcOpenShell#9250, and it shipped unnoticed for as long as it did because no official test case would have caught it. Running this PR's cases against IfcTester before that fix, 3 of the 6 give the wrong verdict, all wrongly passing where they should fail. After the fix, all 6 are correct.

What is covered, per the thread's agreed decision

@atomczak (2024-11-06): "Let's ignore SetPointValue then and focus on Bounds only... the bounds in IFC should be within the IDS min/max."

@andyward (2024-11-06): "Agreed we should ignore SetPointValue", with his table for minInclusive="20": Lower=20/Upper=40 pass, Lower=15/Upper=40 fail, Lower=25/empty pass, empty/Upper=40 fail.

Two families under property/, both restricted to bounds only:

  1. a_restriction_on_a_bounded_property_requires_both_bounds_within_range (1-3): two-sided minExclusive="20" maxInclusive="40". Both bounds inside passes; the lower bound sitting exactly on the excluded minimum fails; the upper bound sitting exactly on the included maximum passes.
  2. a_one_sided_restriction_on_a_bounded_property_requires_the_matching_bound (1-3): one-sided minInclusive="20", mirroring the table directly. The third case has only SetPointValue set and no bounds, which fails, since the required bound is absent and SetPointValue is not considered.

Pass and fail cases share the same specification, so a pass alone cannot be mistaken for not-checked-at-all.

Deliberately not covered: equality

The equality half of #371 is still open. @andyward's last comment ends on "Feels like this may be a 1.1 change vs retrospective 1.0?", and the shipped v1.0 fixture pass-any_matching_value_in_a_bounded_property_will_pass_3_4 currently passes only because SetPointValue participates in equality matching. Adding a case there would take a side in an argument the thread has not closed.

How these were built

Correction: I originally wrote that CreateTestCases could not be run. That was wrong. The build needs the .NET 8 runtime specifically, because Nuke uses BinaryFormatter, which .NET 9 removed. With that installed it runs in about a second. These .ids files are still hand-authored; I am happy to regenerate them through the official build on request. Validation, unchanged: all six are XSD-valid against Schema/ids.xsd, and all six give the correct verdict against fixed IfcTester.

@atomczak @andyward, flagging for your review since you two worked out the agreed behaviour in the thread. Happy to adjust naming, add boundary cases, or split the families differently.

This PR was created with the assistance of an AI coding tool.

Addresses the restriction half of buildingSMART#371: no official fixture exercised
a restriction facet (minInclusive/maxInclusive/minExclusive/maxExclusive)
against an IfcPropertyBoundedValue before this change.

Adds two families under Documentation/ImplementersDocumentation/TestCases/property:
- a two sided restriction, checking both bounds against an inclusive
  and an exclusive end
- a one sided restriction, checking that only the constrained bound
  is required and that SetPointValue alone does not satisfy it

Hand authored to match the format produced by CreateTestCases, since
the .NET build could not be run locally. Validated against Schema/ids.xsd
and against a fixed IfcTester implementation.

AI-assisted with Claude Code.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

1 participant