Skip to content

Commit

Permalink
Improved test cases on Attribute facet
Browse files Browse the repository at this point in the history
- Updating the ids-tool.CommandLine to Version=1.0.66 a few errors
  emerged in the test cases and development IDS files.
- Some cases have been marked "invalid" instead of "fail" to highlight
  that the audit tool can spot their problems
- Some restriction types were missing, and have been added.
- Some restriction types have been fixed (e.g.. integer vs double).
  • Loading branch information
CBenghi committed Mar 26, 2024
1 parent 4b1db14 commit bd2162e
Show file tree
Hide file tree
Showing 26 changed files with 50 additions and 48 deletions.
2 changes: 1 addition & 1 deletion Development/IDS_SimpleBIM_examples.ids
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<ids:simpleValue>Name</ids:simpleValue>
</ids:name>
<ids:value>
<xs:restriction>
<xs:restriction base="xs:string">
<xs:enumeration value="first allowed value for room"/>
<xs:enumeration value="second allowed value for room"/>
<xs:enumeration value="third allowed value for room"/>
Expand Down
6 changes: 3 additions & 3 deletions Development/IDS_oma.ids
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<ids:simpleValue>ObjectType</ids:simpleValue>
</ids:name>
<ids:value>
<xs:restriction>
<xs:restriction base="xs:string">
<xs:enumeration value="Assembly"/>
<xs:enumeration value="Ambulatory Health Care"/>
<xs:enumeration value="Educational"/>
Expand Down Expand Up @@ -190,7 +190,7 @@
<ids:simpleValue>PredefinedType</ids:simpleValue>
</ids:name>
<ids:value>
<xs:restriction>
<xs:restriction base="xs:string">
<xs:enumeration value="CONSTRUCTION"/>
<xs:enumeration value="FIRESAFETY"/>
<xs:enumeration value="LIGHTING"/>
Expand Down Expand Up @@ -885,7 +885,7 @@
<ids:simpleValue>OperationType</ids:simpleValue>
</ids:name>
<ids:value>
<xs:restriction>
<xs:restriction base="xs:string">
<xs:enumeration value="LIMIT_RATE_INBOUND"/>
<xs:enumeration value="LIMIT_RATE_OUTBOUND"/>
<xs:enumeration value="NOTDEFINED"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<description>Generated via code automation in the Ids Repository on github.</description>
</info>
<specifications>
<specification name="Dates are treated as strings 1/2" ifcVersion="IFC2X3 IFC4">
<specification name="Dates are treated as strings 1/2" ifcVersion="IFC4">
<applicability maxOccurs="unbounded">
<entity>
<name>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<ids xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://standards.buildingsmart.org/IDS http://standards.buildingsmart.org/IDS/0.9.7/ids.xsd" xmlns="http://standards.buildingsmart.org/IDS">
<info>
<title>Dates are treated as strings 1/2</title>
<title>Dates are treated as strings 2/2</title>
<description>Generated via code automation in the Ids Repository on github.</description>
</info>
<specifications>
<specification name="Dates are treated as strings 1/2" ifcVersion="IFC4">
<specification name="Dates are treated as strings 2/2" ifcVersion="IFC4">
<applicability maxOccurs="unbounded">
<entity>
<name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<simpleValue>RefractionIndex</simpleValue>
</name>
<value>
<xs:restriction base="xs:decimal">
<xs:restriction base="xs:double">
<xs:minInclusive value="42" />
<xs:maxInclusive value="42" />
</xs:restriction>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<simpleValue>RefractionIndex</simpleValue>
</name>
<value>
<xs:restriction base="xs:integer">
<xs:restriction base="xs:double">
<xs:minExclusive value="0" />
<xs:maxExclusive value="10" />
</xs:restriction>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<simpleValue>RefractionIndex</simpleValue>
</name>
<value>
<xs:restriction base="xs:integer">
<xs:restriction base="xs:double">
<xs:minExclusive value="0" />
<xs:maxExclusive value="10" />
</xs:restriction>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<simpleValue>RefractionIndex</simpleValue>
</name>
<value>
<xs:restriction base="xs:integer">
<xs:restriction base="xs:double">
<xs:minInclusive value="0" />
<xs:maxInclusive value="10" />
</xs:restriction>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<ids xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://standards.buildingsmart.org/IDS http://standards.buildingsmart.org/IDS/0.9.7/ids.xsd" xmlns="http://standards.buildingsmart.org/IDS">
<info>
<title>Patterns always fail on any number</title>
<title>Patterns always invalid on any number</title>
<description>Generated via code automation in the Ids Repository on github.</description>
</info>
<specifications>
<specification name="Patterns always fail on any number" ifcVersion="IFC2X3 IFC4">
<specification name="Patterns always invalid on any number" ifcVersion="IFC2X3 IFC4">
<applicability minOccurs="0" maxOccurs="unbounded">
<entity>
<name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<simpleValue>RefractionIndex</simpleValue>
</name>
<value>
<xs:restriction base="xs:integer">
<xs:restriction base="xs:double">
<xs:minInclusive value="0" />
<xs:maxInclusive value="10" />
</xs:restriction>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<simpleValue>RefractionIndex</simpleValue>
</name>
<value>
<xs:restriction base="xs:integer">
<xs:restriction base="xs:double">
<xs:minExclusive value="0" />
<xs:maxExclusive value="10" />
</xs:restriction>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<simpleValue>RefractionIndex</simpleValue>
</name>
<value>
<xs:restriction base="xs:integer">
<xs:restriction base="xs:double">
<xs:minInclusive value="0" />
<xs:maxInclusive value="10" />
</xs:restriction>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<simpleValue>RefractionIndex</simpleValue>
</name>
<value>
<xs:restriction base="xs:integer">
<xs:restriction base="xs:double">
<xs:minInclusive value="0" />
<xs:maxInclusive value="10" />
</xs:restriction>
Expand Down
37 changes: 19 additions & 18 deletions Documentation/testcases/scripts.md
Original file line number Diff line number Diff line change
Expand Up @@ -245,15 +245,16 @@ Attribute: ''IsMilestone'',''FALSE''

``` ids attribute/fail-dates_are_treated_as_strings_1_2.ids
Dates are treated as strings 1/2
IFC4
Entity: ''IFCCLASSIFICATION''
Requirements:
Attribute: ''EditionDate'',''2022-01-01''
```

### Dates are treated as strings 1/2
### Dates are treated as strings 2/2

``` ids attribute/pass-dates_are_treated_as_strings_1_2.ids
Dates are treated as strings 1/2
``` ids attribute/pass-dates_are_treated_as_strings_2_2.ids
Dates are treated as strings 2/2
IFC4
Entity: ''IFCCLASSIFICATION''
Requirements:
Expand Down Expand Up @@ -510,7 +511,7 @@ Attribute: Pattern(''NumberOfRiser(s)?''),''42.3''
Strict numeric checking may be done with a bounds restriction
Entity: ''IFCSURFACESTYLEREFRACTION''
Requirements:
Attribute: ''RefractionIndex'',xs:decimal MinInclusive(''42'') MaxInclusive(''42'')
Attribute: ''RefractionIndex'',xs:double MinInclusive(''42'') MaxInclusive(''42'')
```

### Typecast checking may also occur within enumeration restrictions
Expand All @@ -529,7 +530,7 @@ Attribute: ''RefractionIndex'',xs:double Enumeration(''42'',''43'')

### Value checks always fail for lists

``` ids attribute/fail-value_checks_always_fail_for_lists.ids
``` ids attribute/invalid-value_checks_always_fail_for_lists.ids
Value checks always fail for lists
Entity: ''IFCCARTESIANPOINT''
Requirements:
Expand All @@ -538,7 +539,7 @@ Attribute: ''Coordinates'',''Foobar''

### Value checks always fail for objects

``` ids attribute/fail-value_checks_always_fail_for_objects.ids
``` ids attribute/invalid-value_checks_always_fail_for_objects.ids
Value checks always fail for objects
IFC4
Entity: ''IFCTASK''
Expand All @@ -548,7 +549,7 @@ Attribute: ''TaskTime'',''Foobar''

### Value checks always fail for selects

``` ids attribute/fail-value_checks_always_fail_for_selects.ids
``` ids attribute/invalid-value_checks_always_fail_for_selects.ids
Value checks always fail for selects
Entity: ''IFCSURFACESTYLERENDERING''
Requirements:
Expand Down Expand Up @@ -2449,7 +2450,7 @@ Property: ''Pset_WallCommon'',''FireRating'',IFCLABEL,Pattern(''(-|[0-9]{2,3})\/
A bound can be inclusive 1/3
Entity: ''IFCSURFACESTYLEREFRACTION''
Requirements:
Attribute: ''RefractionIndex'',xs:integer MinExclusive(''0'') MaxExclusive(''10'')
Attribute: ''RefractionIndex'',xs:double MinExclusive(''0'') MaxExclusive(''10'')
```

### A bound can be inclusive 1/4
Expand All @@ -2458,7 +2459,7 @@ Attribute: ''RefractionIndex'',xs:integer MinExclusive(''0'') MaxExclusive(''10'
A bound can be inclusive 1/4
Entity: ''IFCSURFACESTYLEREFRACTION''
Requirements:
Attribute: ''RefractionIndex'',xs:integer MinInclusive(''0'') MaxInclusive(''10'')
Attribute: ''RefractionIndex'',xs:double MinInclusive(''0'') MaxInclusive(''10'')
```

### A bound can be inclusive 2/3
Expand All @@ -2467,7 +2468,7 @@ Attribute: ''RefractionIndex'',xs:integer MinInclusive(''0'') MaxInclusive(''10'
A bound can be inclusive 2/3
Entity: ''IFCSURFACESTYLEREFRACTION''
Requirements:
Attribute: ''RefractionIndex'',xs:integer MinExclusive(''0'') MaxExclusive(''10'')
Attribute: ''RefractionIndex'',xs:double MinExclusive(''0'') MaxExclusive(''10'')
```

### A bound can be inclusive 2/4
Expand All @@ -2476,7 +2477,7 @@ Attribute: ''RefractionIndex'',xs:integer MinExclusive(''0'') MaxExclusive(''10'
A bound can be inclusive 2/4
Entity: ''IFCSURFACESTYLEREFRACTION''
Requirements:
Attribute: ''RefractionIndex'',xs:integer MinInclusive(''0'') MaxInclusive(''10'')
Attribute: ''RefractionIndex'',xs:double MinInclusive(''0'') MaxInclusive(''10'')
```

### A bound can be inclusive 3/3
Expand All @@ -2485,7 +2486,7 @@ Attribute: ''RefractionIndex'',xs:integer MinInclusive(''0'') MaxInclusive(''10'
A bound can be inclusive 3/3
Entity: ''IFCSURFACESTYLEREFRACTION''
Requirements:
Attribute: ''RefractionIndex'',xs:integer MinExclusive(''0'') MaxExclusive(''10'')
Attribute: ''RefractionIndex'',xs:double MinExclusive(''0'') MaxExclusive(''10'')
```

### A bound can be inclusive 3/4
Expand All @@ -2494,7 +2495,7 @@ Attribute: ''RefractionIndex'',xs:integer MinExclusive(''0'') MaxExclusive(''10'
A bound can be inclusive 3/4
Entity: ''IFCSURFACESTYLEREFRACTION''
Requirements:
Attribute: ''RefractionIndex'',xs:integer MinInclusive(''0'') MaxInclusive(''10'')
Attribute: ''RefractionIndex'',xs:double MinInclusive(''0'') MaxInclusive(''10'')
```

### A bound can be inclusive 4/4
Expand All @@ -2503,7 +2504,7 @@ Attribute: ''RefractionIndex'',xs:integer MinInclusive(''0'') MaxInclusive(''10'
A bound can be inclusive 4/4
Entity: ''IFCSURFACESTYLEREFRACTION''
Requirements:
Attribute: ''RefractionIndex'',xs:integer MinInclusive(''0'') MaxInclusive(''10'')
Attribute: ''RefractionIndex'',xs:double MinInclusive(''0'') MaxInclusive(''10'')
```

### An enumeration matches case sensitively 1/3
Expand Down Expand Up @@ -2596,10 +2597,10 @@ Requirements:
Attribute: ''Name'',MinLength(''2'') MaxLength(''3'')
```

### Patterns always fail on any number
### Patterns always invalid on any number

``` ids restriction/fail-patterns_always_fail_on_any_number.ids
Patterns always fail on any number
``` ids restriction/invalid-patterns_always_fail_on_any_number.ids
Patterns always invalid on any number
Optional
Entity: ''IFCSURFACESTYLEREFRACTION''
Requirements:
Expand All @@ -2608,7 +2609,7 @@ Attribute: ''RefractionIndex'',Pattern(''.*'')

### Patterns only work on strings and nothing else

``` ids restriction/fail-patterns_only_work_on_strings_and_nothing_else.ids
``` ids restriction/invalid-patterns_only_work_on_strings_and_nothing_else.ids
Patterns only work on strings and nothing else
Entity: ''IFCSURFACESTYLEREFRACTION''
Requirements:
Expand Down
25 changes: 13 additions & 12 deletions SchemaProject/program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,16 +115,6 @@ private static void RegenIDS()
buffer.AppendLine(line);
}
}

// extra IDSs
foreach (var item in allIDSs.Except(newIDSs))
{
string t = IdsHelpers.CreateDiffReportHtml(item);
var reportFileName = Path.ChangeExtension(item, "html");
File.WriteAllText(reportFileName, t);
Console.WriteLine($"Extra IDS report generated: {reportFileName}");
}

// extra ifcs
foreach (var item in testCasesFolder.GetFiles("*.ifc", SearchOption.AllDirectories))
{
Expand All @@ -134,15 +124,26 @@ private static void RegenIDS()
var invalidFileName = item.FullName.Replace("fail-", "invalid-");
if (missingIfcFileNames.Contains(invalidFileName))
{
// File.Move(item.FullName, invalidFileName);
Console.WriteLine("A matching invalid IFC is required, should you rename this?");
File.Move(item.FullName, invalidFileName);
// Console.WriteLine("A matching invalid IFC is required, should you rename this?");
}
//else if (allIfcFound)
//{
// // item.Delete();
//}
}
}

// extra IDSs
foreach (var item in allIDSs.Except(newIDSs))
{
string t = IdsHelpers.CreateDiffReportHtml(item);
var reportFileName = Path.ChangeExtension(item, "html");
File.WriteAllText(reportFileName, t);
Console.WriteLine($"Extra IDS report generated: {reportFileName}");
}


if (allIfcFound)
{
Message("All scripting IFC files found", ConsoleColor.Green);
Expand Down
2 changes: 1 addition & 1 deletion build/_build.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

<ItemGroup>
<PackageReference Include="Nuke.Common" Version="6.3.0" />
<PackageReference Include="ids-tool.CommandLine" Version="1.0.64" />
<PackageReference Include="ids-tool.CommandLine" Version="1.0.66" />
<PackageDownload Include="dotnet-xscgen" Version="[2.1.1094]" />
</ItemGroup>

Expand Down

0 comments on commit bd2162e

Please sign in to comment.