Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added some tests to increase coverage #263

Merged
merged 2 commits into from
Apr 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?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>A prohibited classification reference returns the opposite of a required facet</title>
<description>Generated via code automation in the Ids Repository on github.</description>
</info>
<specifications>
<specification name="A prohibited classification reference returns the opposite of a required facet" ifcVersion="IFC2X3 IFC4">
<applicability maxOccurs="unbounded">
<entity>
<name>
<simpleValue>IFCSLAB</simpleValue>
</name>
</entity>
</applicability>
<requirements>
<classification cardinality="prohibited">
<value>
<simpleValue>1</simpleValue>
</value>
<system>
<simpleValue>Foobar</simpleValue>
</system>
</classification>
</requirements>
</specification>
</specifications>
</ids>
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
ISO-10303-21;
HEADER;
FILE_DESCRIPTION(('ViewDefinition [CoordinationView]'),'2;1');
FILE_NAME('','2022-10-07T13:48:42',(),(),'IfcOpenShell v0.7.0-dc67287d','IfcOpenShell v0.7.0-dc67287d','');
FILE_SCHEMA(('IFC4'));
ENDSEC;
DATA;
#1=IFCPROJECT('1hqIFTRjfV6AWq_bMtnZwI',$,$,$,$,$,$,$,$);
#2=IFCCLASSIFICATION($,$,$,'Foobar',$,$,$);
#3=IFCRELASSOCIATESCLASSIFICATION('05rScmOVzMoQXOfbYdtLYj',$,$,$,(#1),#2);
#4=IFCWALL('3Agm079vPIYBL4JExVrhD5',$,$,$,$,$,$,$,$);
#5=IFCSLAB('0BbkGoC6vPvRW13UT7D8zH',$,$,$,$,$,$,$,$);
#6=IFCCLASSIFICATIONREFERENCE($,'1',$,#2,$,$);
#7=IFCRELASSOCIATESCLASSIFICATION('2nJrDaLQfJ1QPhdJR0o97J',$,$,$,(#5),#6);
#8=IFCCOLUMN('16MocU_IDOF8_x3Iqllz0d',$,$,$,$,$,$,$,$);
#9=IFCCLASSIFICATIONREFERENCE($,'11',$,#2,$,$);
#10=IFCRELASSOCIATESCLASSIFICATION('0WTUhjMwvT39YBFH2pryoM',$,$,$,(#8),#9);
#11=IFCBEAM('1n81bO_6nGjgypJwWUVavJ',$,$,$,$,$,$,$,$);
#12=IFCCLASSIFICATIONREFERENCE($,'22',$,#13,$,$);
#13=IFCCLASSIFICATIONREFERENCE($,'2',$,#2,$,$);
#15=IFCRELASSOCIATESCLASSIFICATION('2jG7cjHsrIUfgKVktNgbzi',$,$,$,(#11),#12);
#16=IFCMATERIAL('Material',$,$);
#17=IFCEXTERNALREFERENCERELATIONSHIP($,$,#6,(#16));
ENDSEC;
END-ISO-10303-21;
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?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>A required classification system fails if no match</title>
<description>Generated via code automation in the Ids Repository on github.</description>
</info>
<specifications>
<specification name="A required classification system fails if no match" ifcVersion="IFC2X3 IFC4">
<applicability maxOccurs="unbounded">
<entity>
<name>
<simpleValue>IFCSLAB</simpleValue>
</name>
</entity>
</applicability>
<requirements>
<classification>
<system>
<simpleValue>Foobar1</simpleValue>
</system>
</classification>
</requirements>
</specification>
</specifications>
</ids>
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
ISO-10303-21;
HEADER;
FILE_DESCRIPTION(('ViewDefinition [CoordinationView]'),'2;1');
FILE_NAME('','2022-10-07T13:48:42',(),(),'IfcOpenShell v0.7.0-dc67287d','IfcOpenShell v0.7.0-dc67287d','');
FILE_SCHEMA(('IFC4'));
ENDSEC;
DATA;
#1=IFCPROJECT('1hqIFTRjfV6AWq_bMtnZwI',$,$,$,$,$,$,$,$);
#2=IFCCLASSIFICATION($,$,$,'Foobar',$,$,$);
#3=IFCRELASSOCIATESCLASSIFICATION('05rScmOVzMoQXOfbYdtLYj',$,$,$,(#1),#2);
#4=IFCWALL('3Agm079vPIYBL4JExVrhD5',$,$,$,$,$,$,$,$);
#5=IFCSLAB('0BbkGoC6vPvRW13UT7D8zH',$,$,$,$,$,$,$,$);
#6=IFCCLASSIFICATIONREFERENCE($,'1',$,#2,$,$);
#7=IFCRELASSOCIATESCLASSIFICATION('2nJrDaLQfJ1QPhdJR0o97J',$,$,$,(#5),#6);
#8=IFCCOLUMN('16MocU_IDOF8_x3Iqllz0d',$,$,$,$,$,$,$,$);
#9=IFCCLASSIFICATIONREFERENCE($,'11',$,#2,$,$);
#10=IFCRELASSOCIATESCLASSIFICATION('0WTUhjMwvT39YBFH2pryoM',$,$,$,(#8),#9);
#11=IFCBEAM('1n81bO_6nGjgypJwWUVavJ',$,$,$,$,$,$,$,$);
#12=IFCCLASSIFICATIONREFERENCE($,'22',$,#13,$,$);
#13=IFCCLASSIFICATIONREFERENCE($,'2',$,#2,$,$);
#15=IFCRELASSOCIATESCLASSIFICATION('2jG7cjHsrIUfgKVktNgbzi',$,$,$,(#11),#12);
#16=IFCMATERIAL('Material',$,$);
#17=IFCEXTERNALREFERENCERELATIONSHIP($,$,#6,(#16));
ENDSEC;
END-ISO-10303-21;
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?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>Prohibited specifications fails if the applicability matches</title>
<description>Generated via code automation in the Ids Repository on github.</description>
</info>
<specifications>
<specification name="Prohibited specifications fails if the applicability matches" ifcVersion="IFC2X3">
<applicability minOccurs="0" maxOccurs="0">
<entity>
<name>
<simpleValue>IFCWALL</simpleValue>
</name>
</entity>
</applicability>
</specification>
</specifications>
</ids>
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
ISO-10303-21;
HEADER;
FILE_DESCRIPTION(('ViewDefinition [CoordinationView]'),'2;1');
FILE_NAME('','2022-10-07T13:48:44',(),(),'IfcOpenShell v0.7.0-dc67287d','IfcOpenShell v0.7.0-dc67287d','');
FILE_SCHEMA(('IFC4'));
ENDSEC;
DATA;
#1=IFCWALL('1hqIFTRjfV6AWq_bMtnZwI',$,'Waldo',$,$,$,$,$,$);
ENDSEC;
END-ISO-10303-21;
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?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>Prohibited specifications passes if the applicability does not matches</title>
<description>Generated via code automation in the Ids Repository on github.</description>
</info>
<specifications>
<specification name="Prohibited specifications passes if the applicability does not matches" ifcVersion="IFC2X3">
<applicability minOccurs="0" maxOccurs="0">
<entity>
<name>
<simpleValue>IFCWINDOW</simpleValue>
</name>
</entity>
</applicability>
</specification>
</specifications>
</ids>
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
ISO-10303-21;
HEADER;
FILE_DESCRIPTION(('ViewDefinition [CoordinationView]'),'2;1');
FILE_NAME('','2022-10-07T13:48:44',(),(),'IfcOpenShell v0.7.0-dc67287d','IfcOpenShell v0.7.0-dc67287d','');
FILE_SCHEMA(('IFC4'));
ENDSEC;
DATA;
#1=IFCWALL('1hqIFTRjfV6AWq_bMtnZwI',$,'Waldo',$,$,$,$,$,$);
ENDSEC;
END-ISO-10303-21;
36 changes: 36 additions & 0 deletions Documentation/testcases/scripts.md
Original file line number Diff line number Diff line change
Expand Up @@ -612,6 +612,15 @@ Requirements:
Classification: Prohibited,Pattern(''\w+'')
```

### A prohibited classification reference returns the opposite of a required facet

``` ids classification/fail-a_prohibited_classification_reference_returns_the_opposite_of_a_required_facet.ids
A prohibited classification reference returns the opposite of a required facet
Entity: ''IFCSLAB''
Requirements:
Classification: Prohibited,''Foobar'',''1''
```

### A required facet checks all parameters as normal

``` ids classification/pass-a_required_facet_checks_all_parameters_as_normal.ids
Expand All @@ -621,6 +630,15 @@ Requirements:
Classification: Pattern(''\w+'')
```

### A required classification system fails if no match

``` ids classification/fail-a_required_classification_system_fails_if_no_match.ids
A required classification system fails if no match
Entity: ''IFCSLAB''
Requirements:
Classification: ''Foobar1''
```

### An optional classification value passes if specified

``` ids classification/pass-an_optional_classification_value_passes_if_specified.ids
Expand Down Expand Up @@ -1127,6 +1145,24 @@ Requirements:
Attribute: ''Name'',''Waldo''
```

### Prohibited specifications fails if the applicability matches

``` ids ids/fail-prohibited_specifications_fails_if_the_applicability_matches.ids
Prohibited specifications fails if the applicability matches
Prohibited
IFC2X3
Entity: ''IFCWALL''
```

### Prohibited specifications passes if the applicability does not matches

``` ids ids/pass-prohibited_specifications_passes_if_the_applicability_does_not_matches.ids
Prohibited specifications passes if the applicability does not matches
Prohibited
IFC2X3
Entity: ''IFCWINDOW''
```

### Required specifications need at least one applicable entity (1/2)

``` ids ids/pass-required_specifications_need_at_least_one_applicable_entity_1_2.ids
Expand Down
2 changes: 1 addition & 1 deletion SchemaProject/DocAutomation/IdsScript.cs
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,7 @@ internal void WriteTo(TextWriter writer)
{
writer.WriteLine(item);
}
if (RequirementFacetStrings != null)
if (RequirementFacetStrings != null && RequirementFacetStrings.Any())
{
writer.WriteLine("Requirements:");
foreach (var item in RequirementFacetStrings)
Expand Down
2 changes: 1 addition & 1 deletion SchemaProject/program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,8 @@ private static void RegenIDS()
var invalidFileName = item.FullName.Replace("fail-", "invalid-");
if (missingIfcFileNames.Contains(invalidFileName))
{
Console.WriteLine("Suitable matching invalid IFC is found, it has been renamed.");
File.Move(item.FullName, invalidFileName);
// Console.WriteLine("A matching invalid IFC is required, should you rename this?");
}
//else if (allIfcFound)
//{
Expand Down
Loading