expressir 0.2.8-x86-mingw32 → 0.2.13-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (105) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/release.yml +1 -7
  3. data/exe/format +20 -0
  4. data/expressir.gemspec +3 -2
  5. data/lib/expressir/express_exp/2.4/express_parser.so +0 -0
  6. data/lib/expressir/express_exp/2.5/express_parser.so +0 -0
  7. data/lib/expressir/express_exp/2.6/express_parser.so +0 -0
  8. data/lib/expressir/express_exp/2.7/express_parser.so +0 -0
  9. data/lib/expressir/express_exp/3.0/express_parser.so +0 -0
  10. data/lib/expressir/express_exp/formatter.rb +147 -110
  11. data/lib/expressir/express_exp/hyperlink_formatter.rb +25 -0
  12. data/lib/expressir/express_exp/parser.rb +14 -1
  13. data/lib/expressir/express_exp/schema_head_formatter.rb +14 -0
  14. data/lib/expressir/express_exp/visitor.rb +197 -111
  15. data/lib/expressir/model.rb +3 -1
  16. data/lib/expressir/model/attribute.rb +5 -1
  17. data/lib/expressir/model/constant.rb +5 -1
  18. data/lib/expressir/model/entity.rb +14 -20
  19. data/lib/expressir/model/enumeration_item.rb +5 -1
  20. data/lib/expressir/model/expressions/aggregate_initializer.rb +4 -2
  21. data/lib/expressir/model/expressions/aggregate_item.rb +3 -1
  22. data/lib/expressir/model/expressions/attribute_reference.rb +3 -1
  23. data/lib/expressir/model/expressions/binary_expression.rb +3 -1
  24. data/lib/expressir/model/expressions/call.rb +4 -2
  25. data/lib/expressir/model/expressions/entity_constructor.rb +4 -2
  26. data/lib/expressir/model/expressions/group_reference.rb +3 -1
  27. data/lib/expressir/model/expressions/index_reference.rb +3 -1
  28. data/lib/expressir/model/expressions/interval.rb +3 -1
  29. data/lib/expressir/model/expressions/query_expression.rb +5 -2
  30. data/lib/expressir/model/expressions/simple_reference.rb +3 -1
  31. data/lib/expressir/model/expressions/unary_expression.rb +3 -1
  32. data/lib/expressir/model/function.rb +28 -39
  33. data/lib/expressir/model/identifier.rb +1 -3
  34. data/lib/expressir/model/informal_proposition.rb +15 -0
  35. data/lib/expressir/model/interface.rb +4 -2
  36. data/lib/expressir/model/literals/binary.rb +3 -1
  37. data/lib/expressir/model/literals/integer.rb +3 -1
  38. data/lib/expressir/model/literals/logical.rb +3 -1
  39. data/lib/expressir/model/literals/real.rb +3 -1
  40. data/lib/expressir/model/literals/string.rb +3 -1
  41. data/lib/expressir/model/model_element.rb +140 -0
  42. data/lib/expressir/model/parameter.rb +5 -1
  43. data/lib/expressir/model/procedure.rb +29 -40
  44. data/lib/expressir/model/renamed_ref.rb +3 -1
  45. data/lib/expressir/model/repository.rb +5 -5
  46. data/lib/expressir/model/rule.rb +33 -41
  47. data/lib/expressir/model/schema.rb +44 -46
  48. data/lib/expressir/model/statements/alias.rb +6 -3
  49. data/lib/expressir/model/statements/assignment.rb +3 -1
  50. data/lib/expressir/model/statements/call.rb +4 -2
  51. data/lib/expressir/model/statements/case.rb +4 -2
  52. data/lib/expressir/model/statements/case_action.rb +4 -2
  53. data/lib/expressir/model/statements/compound.rb +4 -2
  54. data/lib/expressir/model/statements/escape.rb +1 -1
  55. data/lib/expressir/model/statements/if.rb +5 -3
  56. data/lib/expressir/model/statements/null.rb +1 -1
  57. data/lib/expressir/model/statements/repeat.rb +6 -3
  58. data/lib/expressir/model/statements/return.rb +3 -1
  59. data/lib/expressir/model/statements/skip.rb +1 -1
  60. data/lib/expressir/model/subtype_constraint.rb +5 -2
  61. data/lib/expressir/model/type.rb +11 -4
  62. data/lib/expressir/model/types/aggregate.rb +5 -1
  63. data/lib/expressir/model/types/array.rb +3 -1
  64. data/lib/expressir/model/types/bag.rb +3 -1
  65. data/lib/expressir/model/types/binary.rb +3 -1
  66. data/lib/expressir/model/types/boolean.rb +1 -1
  67. data/lib/expressir/model/types/enumeration.rb +5 -3
  68. data/lib/expressir/model/types/generic.rb +5 -1
  69. data/lib/expressir/model/types/generic_entity.rb +5 -1
  70. data/lib/expressir/model/types/integer.rb +1 -1
  71. data/lib/expressir/model/types/list.rb +3 -1
  72. data/lib/expressir/model/types/logical.rb +1 -1
  73. data/lib/expressir/model/types/number.rb +1 -1
  74. data/lib/expressir/model/types/real.rb +3 -1
  75. data/lib/expressir/model/types/select.rb +5 -3
  76. data/lib/expressir/model/types/set.rb +3 -1
  77. data/lib/expressir/model/types/string.rb +3 -1
  78. data/lib/expressir/model/unique.rb +6 -2
  79. data/lib/expressir/model/variable.rb +5 -1
  80. data/lib/expressir/model/where.rb +5 -1
  81. data/lib/expressir/version.rb +1 -1
  82. data/original/examples/syntax/hyperlink.exp +8 -0
  83. data/original/examples/syntax/hyperlink_formatted.exp +19 -0
  84. data/original/examples/syntax/remark.exp +63 -20
  85. data/original/examples/syntax/remark_formatted.exp +62 -24
  86. data/original/examples/syntax/simple.exp +3 -0
  87. data/original/examples/syntax/source.exp +16 -0
  88. data/original/examples/syntax/syntax.exp +201 -190
  89. data/original/examples/syntax/syntax_formatted.exp +370 -799
  90. data/spec/expressir/express_exp/{format_remark_spec.rb → formatter/remark_spec.rb} +2 -2
  91. data/spec/expressir/express_exp/{format_syntax_spec.rb → formatter/syntax_spec.rb} +2 -2
  92. data/spec/expressir/express_exp/hyperlink_formatter_spec.rb +24 -0
  93. data/spec/expressir/express_exp/parser/head_source_spec.rb +38 -0
  94. data/spec/expressir/express_exp/parser/multiple_spec.rb +32 -0
  95. data/spec/expressir/express_exp/{parse_remark_spec.rb → parser/remark_spec.rb} +120 -55
  96. data/spec/expressir/express_exp/{source_spec.rb → parser/source_spec.rb} +3 -6
  97. data/spec/expressir/express_exp/parser/syntax_spec.rb +3080 -0
  98. data/spec/expressir/express_exp/schema_head_formatter_spec.rb +36 -0
  99. data/spec/expressir/model/{find_spec.rb → model_element/find_spec.rb} +26 -8
  100. data/spec/expressir/model/model_element/hash_spec.rb +66 -0
  101. metadata +38 -13
  102. data/lib/expressir/model/scope.rb +0 -32
  103. data/spec/expressir/express_exp/ap233_spec.rb +0 -22
  104. data/spec/expressir/express_exp/find_spec.rb +0 -28
  105. data/spec/expressir/express_exp/parse_syntax_spec.rb +0 -3003
@@ -1,14 +1,11 @@
1
1
  require "spec_helper"
2
2
  require "expressir/express_exp/parser"
3
3
 
4
- RSpec.describe Expressir::Model::Scope do
4
+ RSpec.describe Expressir::ExpressExp::Parser do
5
5
  describe ".source" do
6
6
  it "contains original source" do
7
7
  input = File.read(sample_file)
8
- repo = Expressir::ExpressExp::Parser.from_exp(sample_file)
9
-
10
- expected_result = input
11
- expect(repo.source).to eq(expected_result)
8
+ repo = Expressir::ExpressExp::Parser.from_file(sample_file)
12
9
 
13
10
  schema = repo.schemas.first
14
11
  start_index = input.index("SCHEMA")
@@ -26,7 +23,7 @@ RSpec.describe Expressir::Model::Scope do
26
23
 
27
24
  def sample_file
28
25
  @sample_file ||= Expressir.root_path.join(
29
- "original", "examples", "syntax", "syntax.exp"
26
+ "original", "examples", "syntax", "source.exp"
30
27
  )
31
28
  end
32
29
  end
@@ -0,0 +1,3080 @@
1
+ require "spec_helper"
2
+ require "expressir/express_exp/parser"
3
+
4
+ RSpec.describe Expressir::ExpressExp::Parser do
5
+ describe ".from_file" do
6
+ it "parses syntax" do
7
+ repo = Expressir::ExpressExp::Parser.from_file(sample_file)
8
+
9
+ schemas = repo.schemas
10
+
11
+ schema = schemas.find{|x| x.id == "syntax_schema"}
12
+ expect(schema.version).to be_instance_of(Expressir::Model::Literals::String)
13
+ expect(schema.version.value).to eq("version")
14
+
15
+ interfaces = schema.interfaces
16
+ constants = schema.constants
17
+ types = schema.types
18
+ entities = schema.entities
19
+ subtype_constraints = schema.subtype_constraints
20
+ functions = schema.functions
21
+ procedures = schema.procedures
22
+ rules = schema.rules
23
+
24
+ # intefaces
25
+ interfaces[0].tap do |x|
26
+ expect(x).to be_instance_of(Expressir::Model::Interface)
27
+ expect(x.kind).to eq(Expressir::Model::Interface::USE)
28
+ expect(x.schema).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
29
+ expect(x.schema.id).to eq("contract_schema")
30
+ end
31
+
32
+ interfaces[1].tap do |x|
33
+ expect(x).to be_instance_of(Expressir::Model::Interface)
34
+ expect(x.kind).to eq(Expressir::Model::Interface::USE)
35
+ expect(x.schema).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
36
+ expect(x.schema.id).to eq("contract_schema")
37
+ expect(x.items).to be_instance_of(Array)
38
+ expect(x.items.count).to eq(1)
39
+ expect(x.items[0]).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
40
+ expect(x.items[0].id).to eq("contract")
41
+ end
42
+
43
+ interfaces[2].tap do |x|
44
+ expect(x).to be_instance_of(Expressir::Model::Interface)
45
+ expect(x.kind).to eq(Expressir::Model::Interface::USE)
46
+ expect(x.schema).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
47
+ expect(x.schema.id).to eq("contract_schema")
48
+ expect(x.items).to be_instance_of(Array)
49
+ expect(x.items.count).to eq(2)
50
+ expect(x.items[0]).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
51
+ expect(x.items[0].id).to eq("contract")
52
+ expect(x.items[1]).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
53
+ expect(x.items[1].id).to eq("contract2")
54
+ end
55
+
56
+ interfaces[3].tap do |x|
57
+ expect(x).to be_instance_of(Expressir::Model::Interface)
58
+ expect(x.kind).to eq(Expressir::Model::Interface::USE)
59
+ expect(x.schema).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
60
+ expect(x.schema.id).to eq("contract_schema")
61
+ expect(x.items).to be_instance_of(Array)
62
+ expect(x.items.count).to eq(1)
63
+ expect(x.items[0]).to be_instance_of(Expressir::Model::RenamedRef)
64
+ expect(x.items[0].ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
65
+ expect(x.items[0].ref.id).to eq("contract")
66
+ expect(x.items[0].id).to eq("contract2")
67
+ end
68
+
69
+ interfaces[4].tap do |x|
70
+ expect(x).to be_instance_of(Expressir::Model::Interface)
71
+ expect(x.kind).to eq(Expressir::Model::Interface::REFERENCE)
72
+ expect(x.schema).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
73
+ expect(x.schema.id).to eq("contract_schema")
74
+ end
75
+
76
+ interfaces[5].tap do |x|
77
+ expect(x).to be_instance_of(Expressir::Model::Interface)
78
+ expect(x.kind).to eq(Expressir::Model::Interface::REFERENCE)
79
+ expect(x.schema).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
80
+ expect(x.schema.id).to eq("contract_schema")
81
+ expect(x.items).to be_instance_of(Array)
82
+ expect(x.items.count).to eq(1)
83
+ expect(x.items[0]).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
84
+ expect(x.items[0].id).to eq("contract")
85
+ end
86
+
87
+ interfaces[6].tap do |x|
88
+ expect(x).to be_instance_of(Expressir::Model::Interface)
89
+ expect(x.kind).to eq(Expressir::Model::Interface::REFERENCE)
90
+ expect(x.schema).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
91
+ expect(x.schema.id).to eq("contract_schema")
92
+ expect(x.items).to be_instance_of(Array)
93
+ expect(x.items.count).to eq(2)
94
+ expect(x.items[0]).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
95
+ expect(x.items[0].id).to eq("contract")
96
+ expect(x.items[1]).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
97
+ expect(x.items[1].id).to eq("contract2")
98
+ end
99
+
100
+ interfaces[7].tap do |x|
101
+ expect(x).to be_instance_of(Expressir::Model::Interface)
102
+ expect(x.kind).to eq(Expressir::Model::Interface::REFERENCE)
103
+ expect(x.schema).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
104
+ expect(x.schema.id).to eq("contract_schema")
105
+ expect(x.items).to be_instance_of(Array)
106
+ expect(x.items.count).to eq(1)
107
+ expect(x.items[0]).to be_instance_of(Expressir::Model::RenamedRef)
108
+ expect(x.items[0].ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
109
+ expect(x.items[0].ref.id).to eq("contract")
110
+ expect(x.items[0].id).to eq("contract2")
111
+ end
112
+
113
+ # constants
114
+ constants.find{|x| x.id == "empty_constant"}.tap do |x|
115
+ expect(x).to be_instance_of(Expressir::Model::Constant)
116
+ expect(x.type).to be_instance_of(Expressir::Model::Types::Boolean)
117
+ expect(x.expression).to be_instance_of(Expressir::Model::Literals::Logical)
118
+ expect(x.expression.value).to eq(Expressir::Model::Literals::Logical::TRUE)
119
+ end
120
+
121
+ # types
122
+ types.find{|x| x.id == "empty_type"}.tap do |x|
123
+ expect(x).to be_instance_of(Expressir::Model::Type)
124
+ expect(x.type).to be_instance_of(Expressir::Model::Types::Boolean)
125
+ end
126
+
127
+ types.find{|x| x.id == "where_type"}.tap do |x|
128
+ expect(x).to be_instance_of(Expressir::Model::Type)
129
+ expect(x.type).to be_instance_of(Expressir::Model::Types::Boolean)
130
+ expect(x.where).to be_instance_of(Array)
131
+ expect(x.where.count).to eq(1)
132
+ expect(x.where[0]).to be_instance_of(Expressir::Model::Where)
133
+ expect(x.where[0].expression).to be_instance_of(Expressir::Model::Literals::Logical)
134
+ expect(x.where[0].expression.value).to eq(Expressir::Model::Literals::Logical::TRUE)
135
+ end
136
+
137
+ types.find{|x| x.id == "where_label_type"}.tap do |x|
138
+ expect(x).to be_instance_of(Expressir::Model::Type)
139
+ expect(x.type).to be_instance_of(Expressir::Model::Types::Boolean)
140
+ expect(x.where).to be_instance_of(Array)
141
+ expect(x.where.count).to eq(1)
142
+ expect(x.where[0]).to be_instance_of(Expressir::Model::Where)
143
+ expect(x.where[0].id).to eq("WR1")
144
+ expect(x.where[0].expression).to be_instance_of(Expressir::Model::Literals::Logical)
145
+ expect(x.where[0].expression.value).to eq(Expressir::Model::Literals::Logical::TRUE)
146
+ end
147
+
148
+ # entities
149
+ entities.find{|x| x.id == "empty_entity"}.tap do |x|
150
+ expect(x).to be_instance_of(Expressir::Model::Entity)
151
+ end
152
+
153
+ entities.find{|x| x.id == "abstract_entity"}.tap do |x|
154
+ expect(x).to be_instance_of(Expressir::Model::Entity)
155
+ expect(x.abstract).to eq(true)
156
+ end
157
+
158
+ entities.find{|x| x.id == "abstract_supertype_entity"}.tap do |x|
159
+ expect(x).to be_instance_of(Expressir::Model::Entity)
160
+ expect(x.abstract).to eq(true)
161
+ end
162
+
163
+ entities.find{|x| x.id == "abstract_supertype_constraint_entity"}.tap do |x|
164
+ expect(x).to be_instance_of(Expressir::Model::Entity)
165
+ expect(x.abstract).to eq(true)
166
+ expect(x.supertype_expression).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
167
+ expect(x.supertype_expression.id).to eq("empty_entity")
168
+ end
169
+
170
+ entities.find{|x| x.id == "supertype_constraint_entity"}.tap do |x|
171
+ expect(x).to be_instance_of(Expressir::Model::Entity)
172
+ expect(x.supertype_expression).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
173
+ expect(x.supertype_expression.id).to eq("empty_entity")
174
+ end
175
+
176
+ entities.find{|x| x.id == "subtype_entity"}.tap do |x|
177
+ expect(x).to be_instance_of(Expressir::Model::Entity)
178
+ expect(x.subtype_of).to be_instance_of(Array)
179
+ expect(x.subtype_of.count).to eq(1)
180
+ expect(x.subtype_of[0]).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
181
+ expect(x.subtype_of[0].id).to eq("empty_entity")
182
+ end
183
+
184
+ entities.find{|x| x.id == "supertype_constraint_subtype_entity"}.tap do |x|
185
+ expect(x).to be_instance_of(Expressir::Model::Entity)
186
+ expect(x.supertype_expression).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
187
+ expect(x.supertype_expression.id).to eq("empty_entity")
188
+ expect(x.subtype_of).to be_instance_of(Array)
189
+ expect(x.subtype_of.count).to eq(1)
190
+ expect(x.subtype_of[0]).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
191
+ expect(x.subtype_of[0].id).to eq("empty_entity")
192
+ end
193
+
194
+ entities.find{|x| x.id == "attribute_entity"}.tap do |x|
195
+ expect(x).to be_instance_of(Expressir::Model::Entity)
196
+ expect(x.attributes).to be_instance_of(Array)
197
+ expect(x.attributes.count).to eq(1)
198
+ expect(x.attributes[0]).to be_instance_of(Expressir::Model::Attribute)
199
+ expect(x.attributes[0].id).to eq("test")
200
+ expect(x.attributes[0].kind).to eq(Expressir::Model::Attribute::EXPLICIT)
201
+ expect(x.attributes[0].type).to be_instance_of(Expressir::Model::Types::Boolean)
202
+ end
203
+
204
+ entities.find{|x| x.id == "attribute_optional_entity"}.tap do |x|
205
+ expect(x).to be_instance_of(Expressir::Model::Entity)
206
+ expect(x.attributes).to be_instance_of(Array)
207
+ expect(x.attributes.count).to eq(1)
208
+ expect(x.attributes[0]).to be_instance_of(Expressir::Model::Attribute)
209
+ expect(x.attributes[0].id).to eq("test")
210
+ expect(x.attributes[0].kind).to eq(Expressir::Model::Attribute::EXPLICIT)
211
+ expect(x.attributes[0].optional).to eq(true)
212
+ expect(x.attributes[0].type).to be_instance_of(Expressir::Model::Types::Boolean)
213
+ end
214
+
215
+ entities.find{|x| x.id == "attribute_multiple_entity"}.tap do |x|
216
+ expect(x).to be_instance_of(Expressir::Model::Entity)
217
+ expect(x.attributes).to be_instance_of(Array)
218
+ expect(x.attributes.count).to eq(2)
219
+ expect(x.attributes[0]).to be_instance_of(Expressir::Model::Attribute)
220
+ expect(x.attributes[0].id).to eq("test")
221
+ expect(x.attributes[0].kind).to eq(Expressir::Model::Attribute::EXPLICIT)
222
+ expect(x.attributes[0].type).to be_instance_of(Expressir::Model::Types::Boolean)
223
+ expect(x.attributes[1]).to be_instance_of(Expressir::Model::Attribute)
224
+ expect(x.attributes[1].id).to eq("test2")
225
+ expect(x.attributes[1].kind).to eq(Expressir::Model::Attribute::EXPLICIT)
226
+ expect(x.attributes[1].type).to be_instance_of(Expressir::Model::Types::Boolean)
227
+ end
228
+
229
+ entities.find{|x| x.id == "attribute_multiple_shorthand_entity"}.tap do |x|
230
+ expect(x).to be_instance_of(Expressir::Model::Entity)
231
+ expect(x.attributes).to be_instance_of(Array)
232
+ expect(x.attributes.count).to eq(2)
233
+ expect(x.attributes[0]).to be_instance_of(Expressir::Model::Attribute)
234
+ expect(x.attributes[0].id).to eq("test")
235
+ expect(x.attributes[0].kind).to eq(Expressir::Model::Attribute::EXPLICIT)
236
+ expect(x.attributes[0].type).to be_instance_of(Expressir::Model::Types::Boolean)
237
+ expect(x.attributes[1]).to be_instance_of(Expressir::Model::Attribute)
238
+ expect(x.attributes[1].id).to eq("test2")
239
+ expect(x.attributes[1].kind).to eq(Expressir::Model::Attribute::EXPLICIT)
240
+ expect(x.attributes[1].type).to be_instance_of(Expressir::Model::Types::Boolean)
241
+ end
242
+
243
+ entities.find{|x| x.id == "attribute_redeclared_entity"}.tap do |x|
244
+ expect(x).to be_instance_of(Expressir::Model::Entity)
245
+ expect(x.subtype_of).to be_instance_of(Array)
246
+ expect(x.subtype_of.count).to eq(1)
247
+ expect(x.subtype_of[0]).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
248
+ expect(x.subtype_of[0].id).to eq("attribute_entity")
249
+ expect(x.attributes).to be_instance_of(Array)
250
+ expect(x.attributes.count).to eq(1)
251
+ expect(x.attributes[0]).to be_instance_of(Expressir::Model::Attribute)
252
+ expect(x.attributes[0].kind).to eq(Expressir::Model::Attribute::EXPLICIT)
253
+ expect(x.attributes[0].supertype_attribute).to be_instance_of(Expressir::Model::Expressions::AttributeReference)
254
+ expect(x.attributes[0].supertype_attribute.ref).to be_instance_of(Expressir::Model::Expressions::GroupReference)
255
+ expect(x.attributes[0].supertype_attribute.ref.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
256
+ expect(x.attributes[0].supertype_attribute.ref.ref.id).to eq("SELF")
257
+ expect(x.attributes[0].supertype_attribute.ref.entity).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
258
+ expect(x.attributes[0].supertype_attribute.ref.entity.id).to eq("attribute_entity")
259
+ expect(x.attributes[0].supertype_attribute.attribute).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
260
+ expect(x.attributes[0].supertype_attribute.attribute.id).to eq("test")
261
+ expect(x.attributes[0].type).to be_instance_of(Expressir::Model::Types::Boolean)
262
+ end
263
+
264
+ entities.find{|x| x.id == "attribute_redeclared_renamed_entity"}.tap do |x|
265
+ expect(x).to be_instance_of(Expressir::Model::Entity)
266
+ expect(x.subtype_of).to be_instance_of(Array)
267
+ expect(x.subtype_of.count).to eq(1)
268
+ expect(x.subtype_of[0]).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
269
+ expect(x.subtype_of[0].id).to eq("attribute_entity")
270
+ expect(x.attributes).to be_instance_of(Array)
271
+ expect(x.attributes.count).to eq(1)
272
+ expect(x.attributes[0]).to be_instance_of(Expressir::Model::Attribute)
273
+ expect(x.attributes[0].id).to eq("test2")
274
+ expect(x.attributes[0].kind).to eq(Expressir::Model::Attribute::EXPLICIT)
275
+ expect(x.attributes[0].supertype_attribute).to be_instance_of(Expressir::Model::Expressions::AttributeReference)
276
+ expect(x.attributes[0].supertype_attribute.ref).to be_instance_of(Expressir::Model::Expressions::GroupReference)
277
+ expect(x.attributes[0].supertype_attribute.ref.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
278
+ expect(x.attributes[0].supertype_attribute.ref.ref.id).to eq("SELF")
279
+ expect(x.attributes[0].supertype_attribute.ref.entity).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
280
+ expect(x.attributes[0].supertype_attribute.ref.entity.id).to eq("attribute_entity")
281
+ expect(x.attributes[0].supertype_attribute.attribute).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
282
+ expect(x.attributes[0].supertype_attribute.attribute.id).to eq("test")
283
+ expect(x.attributes[0].type).to be_instance_of(Expressir::Model::Types::Boolean)
284
+ end
285
+
286
+ entities.find{|x| x.id == "derived_attribute_entity"}.tap do |x|
287
+ expect(x).to be_instance_of(Expressir::Model::Entity)
288
+ expect(x.attributes).to be_instance_of(Array)
289
+ expect(x.attributes.count).to eq(1)
290
+ expect(x.attributes[0]).to be_instance_of(Expressir::Model::Attribute)
291
+ expect(x.attributes[0].id).to eq("test")
292
+ expect(x.attributes[0].kind).to eq(Expressir::Model::Attribute::DERIVED)
293
+ expect(x.attributes[0].type).to be_instance_of(Expressir::Model::Types::Boolean)
294
+ expect(x.attributes[0].expression).to be_instance_of(Expressir::Model::Literals::Logical)
295
+ expect(x.attributes[0].expression.value).to eq(Expressir::Model::Literals::Logical::TRUE)
296
+ end
297
+
298
+ entities.find{|x| x.id == "derived_attribute_redeclared_entity"}.tap do |x|
299
+ expect(x).to be_instance_of(Expressir::Model::Entity)
300
+ expect(x.subtype_of).to be_instance_of(Array)
301
+ expect(x.subtype_of.count).to eq(1)
302
+ expect(x.subtype_of[0]).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
303
+ expect(x.subtype_of[0].id).to eq("attribute_entity")
304
+ expect(x.attributes).to be_instance_of(Array)
305
+ expect(x.attributes.count).to eq(1)
306
+ expect(x.attributes[0]).to be_instance_of(Expressir::Model::Attribute)
307
+ expect(x.attributes[0].kind).to eq(Expressir::Model::Attribute::DERIVED)
308
+ expect(x.attributes[0].supertype_attribute).to be_instance_of(Expressir::Model::Expressions::AttributeReference)
309
+ expect(x.attributes[0].supertype_attribute.ref).to be_instance_of(Expressir::Model::Expressions::GroupReference)
310
+ expect(x.attributes[0].supertype_attribute.ref.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
311
+ expect(x.attributes[0].supertype_attribute.ref.ref.id).to eq("SELF")
312
+ expect(x.attributes[0].supertype_attribute.ref.entity).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
313
+ expect(x.attributes[0].supertype_attribute.ref.entity.id).to eq("attribute_entity")
314
+ expect(x.attributes[0].supertype_attribute.attribute).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
315
+ expect(x.attributes[0].supertype_attribute.attribute.id).to eq("test")
316
+ expect(x.attributes[0].type).to be_instance_of(Expressir::Model::Types::Boolean)
317
+ expect(x.attributes[0].expression).to be_instance_of(Expressir::Model::Literals::Logical)
318
+ expect(x.attributes[0].expression.value).to eq(Expressir::Model::Literals::Logical::TRUE)
319
+ end
320
+
321
+ entities.find{|x| x.id == "derived_attribute_redeclared_renamed_entity"}.tap do |x|
322
+ expect(x).to be_instance_of(Expressir::Model::Entity)
323
+ expect(x.subtype_of).to be_instance_of(Array)
324
+ expect(x.subtype_of.count).to eq(1)
325
+ expect(x.subtype_of[0]).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
326
+ expect(x.subtype_of[0].id).to eq("attribute_entity")
327
+ expect(x.attributes).to be_instance_of(Array)
328
+ expect(x.attributes.count).to eq(1)
329
+ expect(x.attributes[0]).to be_instance_of(Expressir::Model::Attribute)
330
+ expect(x.attributes[0].id).to eq("test2")
331
+ expect(x.attributes[0].kind).to eq(Expressir::Model::Attribute::DERIVED)
332
+ expect(x.attributes[0].supertype_attribute).to be_instance_of(Expressir::Model::Expressions::AttributeReference)
333
+ expect(x.attributes[0].supertype_attribute.ref).to be_instance_of(Expressir::Model::Expressions::GroupReference)
334
+ expect(x.attributes[0].supertype_attribute.ref.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
335
+ expect(x.attributes[0].supertype_attribute.ref.ref.id).to eq("SELF")
336
+ expect(x.attributes[0].supertype_attribute.ref.entity).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
337
+ expect(x.attributes[0].supertype_attribute.ref.entity.id).to eq("attribute_entity")
338
+ expect(x.attributes[0].supertype_attribute.attribute).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
339
+ expect(x.attributes[0].supertype_attribute.attribute.id).to eq("test")
340
+ expect(x.attributes[0].type).to be_instance_of(Expressir::Model::Types::Boolean)
341
+ expect(x.attributes[0].expression).to be_instance_of(Expressir::Model::Literals::Logical)
342
+ expect(x.attributes[0].expression.value).to eq(Expressir::Model::Literals::Logical::TRUE)
343
+ end
344
+
345
+ entities.find{|x| x.id == "inverse_attribute_entity"}.tap do |x|
346
+ expect(x).to be_instance_of(Expressir::Model::Entity)
347
+ expect(x.attributes).to be_instance_of(Array)
348
+ expect(x.attributes.count).to eq(1)
349
+ expect(x.attributes[0]).to be_instance_of(Expressir::Model::Attribute)
350
+ expect(x.attributes[0].id).to eq("test")
351
+ expect(x.attributes[0].kind).to eq(Expressir::Model::Attribute::INVERSE)
352
+ expect(x.attributes[0].type).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
353
+ expect(x.attributes[0].type.id).to eq("attribute_entity")
354
+ expect(x.attributes[0].expression).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
355
+ expect(x.attributes[0].expression.id).to eq("test")
356
+ end
357
+
358
+ entities.find{|x| x.id == "inverse_attribute_entity_entity"}.tap do |x|
359
+ expect(x).to be_instance_of(Expressir::Model::Entity)
360
+ expect(x.attributes).to be_instance_of(Array)
361
+ expect(x.attributes.count).to eq(1)
362
+ expect(x.attributes[0]).to be_instance_of(Expressir::Model::Attribute)
363
+ expect(x.attributes[0].id).to eq("test")
364
+ expect(x.attributes[0].kind).to eq(Expressir::Model::Attribute::INVERSE)
365
+ expect(x.attributes[0].type).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
366
+ expect(x.attributes[0].type.id).to eq("attribute_entity")
367
+ expect(x.attributes[0].expression).to be_instance_of(Expressir::Model::Expressions::AttributeReference)
368
+ expect(x.attributes[0].expression.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
369
+ expect(x.attributes[0].expression.ref.id).to eq("attribute_entity")
370
+ expect(x.attributes[0].expression.attribute).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
371
+ expect(x.attributes[0].expression.attribute.id).to eq("test")
372
+ end
373
+
374
+ entities.find{|x| x.id == "inverse_attribute_set_entity"}.tap do |x|
375
+ expect(x).to be_instance_of(Expressir::Model::Entity)
376
+ expect(x.attributes).to be_instance_of(Array)
377
+ expect(x.attributes.count).to eq(1)
378
+ expect(x.attributes[0]).to be_instance_of(Expressir::Model::Attribute)
379
+ expect(x.attributes[0].id).to eq("test")
380
+ expect(x.attributes[0].kind).to eq(Expressir::Model::Attribute::INVERSE)
381
+ expect(x.attributes[0].type).to be_instance_of(Expressir::Model::Types::Set)
382
+ expect(x.attributes[0].type.base_type).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
383
+ expect(x.attributes[0].type.base_type.id).to eq("attribute_entity")
384
+ expect(x.attributes[0].expression).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
385
+ expect(x.attributes[0].expression.id).to eq("test")
386
+ end
387
+
388
+ entities.find{|x| x.id == "inverse_attribute_set_bound_entity"}.tap do |x|
389
+ expect(x).to be_instance_of(Expressir::Model::Entity)
390
+ expect(x.attributes).to be_instance_of(Array)
391
+ expect(x.attributes.count).to eq(1)
392
+ expect(x.attributes[0]).to be_instance_of(Expressir::Model::Attribute)
393
+ expect(x.attributes[0].id).to eq("test")
394
+ expect(x.attributes[0].kind).to eq(Expressir::Model::Attribute::INVERSE)
395
+ expect(x.attributes[0].type).to be_instance_of(Expressir::Model::Types::Set)
396
+ expect(x.attributes[0].type.bound1).to be_instance_of(Expressir::Model::Literals::Integer)
397
+ expect(x.attributes[0].type.bound1.value).to eq("1")
398
+ expect(x.attributes[0].type.bound2).to be_instance_of(Expressir::Model::Literals::Integer)
399
+ expect(x.attributes[0].type.bound2.value).to eq("9")
400
+ expect(x.attributes[0].type.base_type).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
401
+ expect(x.attributes[0].type.base_type.id).to eq("attribute_entity")
402
+ expect(x.attributes[0].expression).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
403
+ expect(x.attributes[0].expression.id).to eq("test")
404
+ end
405
+
406
+ entities.find{|x| x.id == "inverse_attribute_bag_entity"}.tap do |x|
407
+ expect(x).to be_instance_of(Expressir::Model::Entity)
408
+ expect(x.attributes).to be_instance_of(Array)
409
+ expect(x.attributes.count).to eq(1)
410
+ expect(x.attributes[0]).to be_instance_of(Expressir::Model::Attribute)
411
+ expect(x.attributes[0].id).to eq("test")
412
+ expect(x.attributes[0].kind).to eq(Expressir::Model::Attribute::INVERSE)
413
+ expect(x.attributes[0].type).to be_instance_of(Expressir::Model::Types::Bag)
414
+ expect(x.attributes[0].type.base_type).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
415
+ expect(x.attributes[0].type.base_type.id).to eq("attribute_entity")
416
+ expect(x.attributes[0].expression).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
417
+ expect(x.attributes[0].expression.id).to eq("test")
418
+ end
419
+
420
+ entities.find{|x| x.id == "inverse_attribute_bag_bound_entity"}.tap do |x|
421
+ expect(x).to be_instance_of(Expressir::Model::Entity)
422
+ expect(x.attributes).to be_instance_of(Array)
423
+ expect(x.attributes.count).to eq(1)
424
+ expect(x.attributes[0]).to be_instance_of(Expressir::Model::Attribute)
425
+ expect(x.attributes[0].id).to eq("test")
426
+ expect(x.attributes[0].kind).to eq(Expressir::Model::Attribute::INVERSE)
427
+ expect(x.attributes[0].type).to be_instance_of(Expressir::Model::Types::Bag)
428
+ expect(x.attributes[0].type.bound1).to be_instance_of(Expressir::Model::Literals::Integer)
429
+ expect(x.attributes[0].type.bound1.value).to eq("1")
430
+ expect(x.attributes[0].type.bound2).to be_instance_of(Expressir::Model::Literals::Integer)
431
+ expect(x.attributes[0].type.bound2.value).to eq("9")
432
+ expect(x.attributes[0].type.base_type).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
433
+ expect(x.attributes[0].type.base_type.id).to eq("attribute_entity")
434
+ expect(x.attributes[0].expression).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
435
+ expect(x.attributes[0].expression.id).to eq("test")
436
+ end
437
+
438
+ entities.find{|x| x.id == "inverse_attribute_redeclared_entity"}.tap do |x|
439
+ expect(x).to be_instance_of(Expressir::Model::Entity)
440
+ expect(x.subtype_of).to be_instance_of(Array)
441
+ expect(x.subtype_of.count).to eq(1)
442
+ expect(x.subtype_of[0]).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
443
+ expect(x.subtype_of[0].id).to eq("attribute_entity")
444
+ expect(x.attributes).to be_instance_of(Array)
445
+ expect(x.attributes.count).to eq(1)
446
+ expect(x.attributes[0]).to be_instance_of(Expressir::Model::Attribute)
447
+ expect(x.attributes[0].kind).to eq(Expressir::Model::Attribute::INVERSE)
448
+ expect(x.attributes[0].supertype_attribute).to be_instance_of(Expressir::Model::Expressions::AttributeReference)
449
+ expect(x.attributes[0].supertype_attribute.ref).to be_instance_of(Expressir::Model::Expressions::GroupReference)
450
+ expect(x.attributes[0].supertype_attribute.ref.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
451
+ expect(x.attributes[0].supertype_attribute.ref.ref.id).to eq("SELF")
452
+ expect(x.attributes[0].supertype_attribute.ref.entity).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
453
+ expect(x.attributes[0].supertype_attribute.ref.entity.id).to eq("attribute_entity")
454
+ expect(x.attributes[0].supertype_attribute.attribute).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
455
+ expect(x.attributes[0].supertype_attribute.attribute.id).to eq("test")
456
+ expect(x.attributes[0].type).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
457
+ expect(x.attributes[0].type.id).to eq("attribute_entity")
458
+ expect(x.attributes[0].expression).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
459
+ expect(x.attributes[0].expression.id).to eq("test")
460
+ end
461
+
462
+ entities.find{|x| x.id == "inverse_attribute_redeclared_renamed_entity"}.tap do |x|
463
+ expect(x).to be_instance_of(Expressir::Model::Entity)
464
+ expect(x.subtype_of).to be_instance_of(Array)
465
+ expect(x.subtype_of.count).to eq(1)
466
+ expect(x.subtype_of[0]).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
467
+ expect(x.subtype_of[0].id).to eq("attribute_entity")
468
+ expect(x.attributes).to be_instance_of(Array)
469
+ expect(x.attributes.count).to eq(1)
470
+ expect(x.attributes[0]).to be_instance_of(Expressir::Model::Attribute)
471
+ expect(x.attributes[0].id).to eq("test2")
472
+ expect(x.attributes[0].kind).to eq(Expressir::Model::Attribute::INVERSE)
473
+ expect(x.attributes[0].supertype_attribute).to be_instance_of(Expressir::Model::Expressions::AttributeReference)
474
+ expect(x.attributes[0].supertype_attribute.ref).to be_instance_of(Expressir::Model::Expressions::GroupReference)
475
+ expect(x.attributes[0].supertype_attribute.ref.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
476
+ expect(x.attributes[0].supertype_attribute.ref.ref.id).to eq("SELF")
477
+ expect(x.attributes[0].supertype_attribute.ref.entity).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
478
+ expect(x.attributes[0].supertype_attribute.ref.entity.id).to eq("attribute_entity")
479
+ expect(x.attributes[0].supertype_attribute.attribute).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
480
+ expect(x.attributes[0].supertype_attribute.attribute.id).to eq("test")
481
+ expect(x.attributes[0].type).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
482
+ expect(x.attributes[0].type.id).to eq("attribute_entity")
483
+ expect(x.attributes[0].expression).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
484
+ expect(x.attributes[0].expression.id).to eq("test")
485
+ end
486
+
487
+ entities.find{|x| x.id == "unique_entity"}.tap do |x|
488
+ expect(x).to be_instance_of(Expressir::Model::Entity)
489
+ expect(x.attributes).to be_instance_of(Array)
490
+ expect(x.attributes.count).to eq(1)
491
+ expect(x.attributes[0]).to be_instance_of(Expressir::Model::Attribute)
492
+ expect(x.attributes[0].id).to eq("test")
493
+ expect(x.attributes[0].kind).to eq(Expressir::Model::Attribute::EXPLICIT)
494
+ expect(x.attributes[0].type).to be_instance_of(Expressir::Model::Types::Boolean)
495
+ expect(x.unique).to be_instance_of(Array)
496
+ expect(x.unique.count).to eq(1)
497
+ expect(x.unique[0]).to be_instance_of(Expressir::Model::Unique)
498
+ expect(x.unique[0].attributes).to be_instance_of(Array)
499
+ expect(x.unique[0].attributes.count).to eq(1)
500
+ expect(x.unique[0].attributes[0]).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
501
+ expect(x.unique[0].attributes[0].id).to eq("test")
502
+ end
503
+
504
+ entities.find{|x| x.id == "unique_label_entity"}.tap do |x|
505
+ expect(x).to be_instance_of(Expressir::Model::Entity)
506
+ expect(x.attributes).to be_instance_of(Array)
507
+ expect(x.attributes.count).to eq(1)
508
+ expect(x.attributes[0]).to be_instance_of(Expressir::Model::Attribute)
509
+ expect(x.attributes[0].id).to eq("test")
510
+ expect(x.attributes[0].kind).to eq(Expressir::Model::Attribute::EXPLICIT)
511
+ expect(x.attributes[0].type).to be_instance_of(Expressir::Model::Types::Boolean)
512
+ expect(x.unique).to be_instance_of(Array)
513
+ expect(x.unique.count).to eq(1)
514
+ expect(x.unique[0]).to be_instance_of(Expressir::Model::Unique)
515
+ expect(x.unique[0].id).to eq("UR1")
516
+ expect(x.unique[0].attributes).to be_instance_of(Array)
517
+ expect(x.unique[0].attributes.count).to eq(1)
518
+ expect(x.unique[0].attributes[0]).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
519
+ expect(x.unique[0].attributes[0].id).to eq("test")
520
+ end
521
+
522
+ entities.find{|x| x.id == "unique_redeclared_entity"}.tap do |x|
523
+ expect(x).to be_instance_of(Expressir::Model::Entity)
524
+ expect(x.subtype_of).to be_instance_of(Array)
525
+ expect(x.subtype_of.count).to eq(1)
526
+ expect(x.subtype_of[0]).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
527
+ expect(x.subtype_of[0].id).to eq("attribute_entity")
528
+ expect(x.unique).to be_instance_of(Array)
529
+ expect(x.unique.count).to eq(1)
530
+ expect(x.unique[0]).to be_instance_of(Expressir::Model::Unique)
531
+ expect(x.unique[0].attributes).to be_instance_of(Array)
532
+ expect(x.unique[0].attributes.count).to eq(1)
533
+ expect(x.unique[0].attributes[0]).to be_instance_of(Expressir::Model::Expressions::AttributeReference)
534
+ expect(x.unique[0].attributes[0].ref).to be_instance_of(Expressir::Model::Expressions::GroupReference)
535
+ expect(x.unique[0].attributes[0].ref.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
536
+ expect(x.unique[0].attributes[0].ref.ref.id).to eq("SELF")
537
+ expect(x.unique[0].attributes[0].ref.entity).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
538
+ expect(x.unique[0].attributes[0].ref.entity.id).to eq("attribute_entity")
539
+ expect(x.unique[0].attributes[0].attribute).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
540
+ expect(x.unique[0].attributes[0].attribute.id).to eq("test")
541
+ end
542
+
543
+ entities.find{|x| x.id == "unique_label_entity"}.tap do |x|
544
+ expect(x).to be_instance_of(Expressir::Model::Entity)
545
+ expect(x.unique).to be_instance_of(Array)
546
+ expect(x.unique.count).to eq(1)
547
+ expect(x.unique[0]).to be_instance_of(Expressir::Model::Unique)
548
+ expect(x.unique[0].id).to eq("UR1")
549
+ expect(x.unique[0].attributes).to be_instance_of(Array)
550
+ expect(x.unique[0].attributes.count).to eq(1)
551
+ expect(x.unique[0].attributes[0]).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
552
+ expect(x.unique[0].attributes[0].id).to eq("test")
553
+ end
554
+
555
+ entities.find{|x| x.id == "unique_label_redeclared_entity"}.tap do |x|
556
+ expect(x).to be_instance_of(Expressir::Model::Entity)
557
+ expect(x.subtype_of).to be_instance_of(Array)
558
+ expect(x.subtype_of.count).to eq(1)
559
+ expect(x.subtype_of[0]).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
560
+ expect(x.subtype_of[0].id).to eq("attribute_entity")
561
+ expect(x.unique).to be_instance_of(Array)
562
+ expect(x.unique.count).to eq(1)
563
+ expect(x.unique[0]).to be_instance_of(Expressir::Model::Unique)
564
+ expect(x.unique[0].id).to eq("UR1")
565
+ expect(x.unique[0].attributes).to be_instance_of(Array)
566
+ expect(x.unique[0].attributes.count).to eq(1)
567
+ expect(x.unique[0].attributes[0]).to be_instance_of(Expressir::Model::Expressions::AttributeReference)
568
+ expect(x.unique[0].attributes[0].ref).to be_instance_of(Expressir::Model::Expressions::GroupReference)
569
+ expect(x.unique[0].attributes[0].ref.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
570
+ expect(x.unique[0].attributes[0].ref.ref.id).to eq("SELF")
571
+ expect(x.unique[0].attributes[0].ref.entity).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
572
+ expect(x.unique[0].attributes[0].ref.entity.id).to eq("attribute_entity")
573
+ expect(x.unique[0].attributes[0].attribute).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
574
+ expect(x.unique[0].attributes[0].attribute.id).to eq("test")
575
+ end
576
+
577
+ entities.find{|x| x.id == "where_entity"}.tap do |x|
578
+ expect(x).to be_instance_of(Expressir::Model::Entity)
579
+ expect(x.where).to be_instance_of(Array)
580
+ expect(x.where.count).to eq(1)
581
+ expect(x.where[0]).to be_instance_of(Expressir::Model::Where)
582
+ expect(x.where[0].expression).to be_instance_of(Expressir::Model::Literals::Logical)
583
+ expect(x.where[0].expression.value).to eq(Expressir::Model::Literals::Logical::TRUE)
584
+ end
585
+
586
+ entities.find{|x| x.id == "where_label_entity"}.tap do |x|
587
+ expect(x).to be_instance_of(Expressir::Model::Entity)
588
+ expect(x.where).to be_instance_of(Array)
589
+ expect(x.where.count).to eq(1)
590
+ expect(x.where[0]).to be_instance_of(Expressir::Model::Where)
591
+ expect(x.where[0].id).to eq("WR1")
592
+ expect(x.where[0].expression).to be_instance_of(Expressir::Model::Literals::Logical)
593
+ expect(x.where[0].expression.value).to eq(Expressir::Model::Literals::Logical::TRUE)
594
+ end
595
+
596
+ # subtype constraints
597
+ subtype_constraints.find{|x| x.id == "empty_subtype_constraint"}.tap do |x|
598
+ expect(x).to be_instance_of(Expressir::Model::SubtypeConstraint)
599
+ expect(x.applies_to).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
600
+ expect(x.applies_to.id).to eq("empty_entity")
601
+ end
602
+
603
+ subtype_constraints.find{|x| x.id == "abstract_supertype_subtype_constraint"}.tap do |x|
604
+ expect(x).to be_instance_of(Expressir::Model::SubtypeConstraint)
605
+ expect(x.applies_to).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
606
+ expect(x.applies_to.id).to eq("empty_entity")
607
+ expect(x.abstract).to eq(true)
608
+ end
609
+
610
+ subtype_constraints.find{|x| x.id == "total_over_subtype_constraint"}.tap do |x|
611
+ expect(x).to be_instance_of(Expressir::Model::SubtypeConstraint)
612
+ expect(x.applies_to).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
613
+ expect(x.applies_to.id).to eq("empty_entity")
614
+ expect(x.total_over).to be_instance_of(Array)
615
+ expect(x.total_over.count).to eq(1)
616
+ expect(x.total_over[0]).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
617
+ expect(x.total_over[0].id).to eq("a")
618
+ end
619
+
620
+ subtype_constraints.find{|x| x.id == "supertype_expression_subtype_constraint"}.tap do |x|
621
+ expect(x).to be_instance_of(Expressir::Model::SubtypeConstraint)
622
+ expect(x.applies_to).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
623
+ expect(x.applies_to.id).to eq("empty_entity")
624
+ expect(x.supertype_expression).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
625
+ expect(x.supertype_expression.id).to eq("a")
626
+ end
627
+
628
+ subtype_constraints.find{|x| x.id == "supertype_expression_andor_subtype_constraint"}.tap do |x|
629
+ expect(x).to be_instance_of(Expressir::Model::SubtypeConstraint)
630
+ expect(x.applies_to).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
631
+ expect(x.applies_to.id).to eq("empty_entity")
632
+ expect(x.supertype_expression).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
633
+ expect(x.supertype_expression.operator).to eq(Expressir::Model::Expressions::BinaryExpression::ANDOR)
634
+ expect(x.supertype_expression.operand1).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
635
+ expect(x.supertype_expression.operand1.id).to eq("a")
636
+ expect(x.supertype_expression.operand2).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
637
+ expect(x.supertype_expression.operand2.id).to eq("b")
638
+ end
639
+
640
+ subtype_constraints.find{|x| x.id == "supertype_expression_and_subtype_constraint"}.tap do |x|
641
+ expect(x).to be_instance_of(Expressir::Model::SubtypeConstraint)
642
+ expect(x.applies_to).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
643
+ expect(x.applies_to.id).to eq("empty_entity")
644
+ expect(x.supertype_expression).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
645
+ expect(x.supertype_expression.operator).to eq(Expressir::Model::Expressions::BinaryExpression::AND)
646
+ expect(x.supertype_expression.operand1).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
647
+ expect(x.supertype_expression.operand1.id).to eq("a")
648
+ expect(x.supertype_expression.operand2).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
649
+ expect(x.supertype_expression.operand2.id).to eq("b")
650
+ end
651
+
652
+ subtype_constraints.find{|x| x.id == "supertype_expression_andor_and_subtype_constraint"}.tap do |x|
653
+ expect(x).to be_instance_of(Expressir::Model::SubtypeConstraint)
654
+ expect(x.applies_to).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
655
+ expect(x.applies_to.id).to eq("empty_entity")
656
+ expect(x.supertype_expression).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
657
+ expect(x.supertype_expression.operator).to eq(Expressir::Model::Expressions::BinaryExpression::ANDOR)
658
+ expect(x.supertype_expression.operand1).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
659
+ expect(x.supertype_expression.operand1.id).to eq("a")
660
+ expect(x.supertype_expression.operand2).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
661
+ expect(x.supertype_expression.operand2.operator).to eq(Expressir::Model::Expressions::BinaryExpression::AND)
662
+ expect(x.supertype_expression.operand2.operand1).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
663
+ expect(x.supertype_expression.operand2.operand1.id).to eq("b")
664
+ expect(x.supertype_expression.operand2.operand2).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
665
+ expect(x.supertype_expression.operand2.operand2.id).to eq("c")
666
+ end
667
+
668
+ subtype_constraints.find{|x| x.id == "supertype_expression_and_andor_subtype_constraint"}.tap do |x|
669
+ expect(x).to be_instance_of(Expressir::Model::SubtypeConstraint)
670
+ expect(x.applies_to).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
671
+ expect(x.applies_to.id).to eq("empty_entity")
672
+ expect(x.supertype_expression).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
673
+ expect(x.supertype_expression.operator).to eq(Expressir::Model::Expressions::BinaryExpression::ANDOR)
674
+ expect(x.supertype_expression.operand1).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
675
+ expect(x.supertype_expression.operand1.operator).to eq(Expressir::Model::Expressions::BinaryExpression::AND)
676
+ expect(x.supertype_expression.operand1.operand1).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
677
+ expect(x.supertype_expression.operand1.operand1.id).to eq("a")
678
+ expect(x.supertype_expression.operand1.operand2).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
679
+ expect(x.supertype_expression.operand1.operand2.id).to eq("b")
680
+ expect(x.supertype_expression.operand2).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
681
+ expect(x.supertype_expression.operand2.id).to eq("c")
682
+ end
683
+
684
+ subtype_constraints.find{|x| x.id == "supertype_expression_parenthesis_andor_and_subtype_constraint"}.tap do |x|
685
+ expect(x).to be_instance_of(Expressir::Model::SubtypeConstraint)
686
+ expect(x.applies_to).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
687
+ expect(x.applies_to.id).to eq("empty_entity")
688
+ expect(x.supertype_expression).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
689
+ expect(x.supertype_expression.operator).to eq(Expressir::Model::Expressions::BinaryExpression::AND)
690
+ expect(x.supertype_expression.operand1).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
691
+ expect(x.supertype_expression.operand1.operator).to eq(Expressir::Model::Expressions::BinaryExpression::ANDOR)
692
+ expect(x.supertype_expression.operand1.operand1).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
693
+ expect(x.supertype_expression.operand1.operand1.id).to eq("a")
694
+ expect(x.supertype_expression.operand1.operand2).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
695
+ expect(x.supertype_expression.operand1.operand2.id).to eq("b")
696
+ expect(x.supertype_expression.operand2).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
697
+ expect(x.supertype_expression.operand2.id).to eq("c")
698
+ end
699
+
700
+ subtype_constraints.find{|x| x.id == "supertype_expression_and_parenthesis_andor_subtype_constraint"}.tap do |x|
701
+ expect(x).to be_instance_of(Expressir::Model::SubtypeConstraint)
702
+ expect(x.applies_to).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
703
+ expect(x.applies_to.id).to eq("empty_entity")
704
+ expect(x.supertype_expression).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
705
+ expect(x.supertype_expression.operator).to eq(Expressir::Model::Expressions::BinaryExpression::AND)
706
+ expect(x.supertype_expression.operand1).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
707
+ expect(x.supertype_expression.operand1.id).to eq("a")
708
+ expect(x.supertype_expression.operand2).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
709
+ expect(x.supertype_expression.operand2.operator).to eq(Expressir::Model::Expressions::BinaryExpression::ANDOR)
710
+ expect(x.supertype_expression.operand2.operand1).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
711
+ expect(x.supertype_expression.operand2.operand1.id).to eq("b")
712
+ expect(x.supertype_expression.operand2.operand2).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
713
+ expect(x.supertype_expression.operand2.operand2.id).to eq("c")
714
+ end
715
+
716
+ subtype_constraints.find{|x| x.id == "supertype_expression_oneof_subtype_constraint"}.tap do |x|
717
+ expect(x).to be_instance_of(Expressir::Model::SubtypeConstraint)
718
+ expect(x.applies_to).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
719
+ expect(x.applies_to.id).to eq("empty_entity")
720
+ expect(x.supertype_expression).to be_instance_of(Expressir::Model::Expressions::Call)
721
+ expect(x.supertype_expression.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
722
+ expect(x.supertype_expression.ref.id).to eq("ONEOF")
723
+ expect(x.supertype_expression.parameters).to be_instance_of(Array)
724
+ expect(x.supertype_expression.parameters.count).to eq(2)
725
+ expect(x.supertype_expression.parameters[0]).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
726
+ expect(x.supertype_expression.parameters[0].id).to eq("a")
727
+ expect(x.supertype_expression.parameters[1]).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
728
+ expect(x.supertype_expression.parameters[1].id).to eq("b")
729
+ end
730
+
731
+ subtype_constraints.find{|x| x.id == "supertype_expression_and_oneof_subtype_constraint"}.tap do |x|
732
+ expect(x).to be_instance_of(Expressir::Model::SubtypeConstraint)
733
+ expect(x.applies_to).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
734
+ expect(x.applies_to.id).to eq("empty_entity")
735
+ expect(x.supertype_expression).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
736
+ expect(x.supertype_expression.operator).to eq(Expressir::Model::Expressions::BinaryExpression::AND)
737
+ expect(x.supertype_expression.operand1).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
738
+ expect(x.supertype_expression.operand1.id).to eq("a")
739
+ expect(x.supertype_expression.operand2).to be_instance_of(Expressir::Model::Expressions::Call)
740
+ expect(x.supertype_expression.operand2.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
741
+ expect(x.supertype_expression.operand2.ref.id).to eq("ONEOF")
742
+ expect(x.supertype_expression.operand2.parameters).to be_instance_of(Array)
743
+ expect(x.supertype_expression.operand2.parameters.count).to eq(2)
744
+ expect(x.supertype_expression.operand2.parameters[0]).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
745
+ expect(x.supertype_expression.operand2.parameters[0].id).to eq("b")
746
+ expect(x.supertype_expression.operand2.parameters[1]).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
747
+ expect(x.supertype_expression.operand2.parameters[1].id).to eq("c")
748
+ end
749
+
750
+ subtype_constraints.find{|x| x.id == "supertype_expression_andor_oneof_subtype_constraint"}.tap do |x|
751
+ expect(x).to be_instance_of(Expressir::Model::SubtypeConstraint)
752
+ expect(x.applies_to).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
753
+ expect(x.applies_to.id).to eq("empty_entity")
754
+ expect(x.supertype_expression).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
755
+ expect(x.supertype_expression.operator).to eq(Expressir::Model::Expressions::BinaryExpression::ANDOR)
756
+ expect(x.supertype_expression.operand1).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
757
+ expect(x.supertype_expression.operand1.id).to eq("a")
758
+ expect(x.supertype_expression.operand2).to be_instance_of(Expressir::Model::Expressions::Call)
759
+ expect(x.supertype_expression.operand2.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
760
+ expect(x.supertype_expression.operand2.ref.id).to eq("ONEOF")
761
+ expect(x.supertype_expression.operand2.parameters).to be_instance_of(Array)
762
+ expect(x.supertype_expression.operand2.parameters.count).to eq(2)
763
+ expect(x.supertype_expression.operand2.parameters[0]).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
764
+ expect(x.supertype_expression.operand2.parameters[0].id).to eq("b")
765
+ expect(x.supertype_expression.operand2.parameters[1]).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
766
+ expect(x.supertype_expression.operand2.parameters[1].id).to eq("c")
767
+ end
768
+
769
+ subtype_constraints.find{|x| x.id == "supertype_expression_oneof_and_subtype_constraint"}.tap do |x|
770
+ expect(x).to be_instance_of(Expressir::Model::SubtypeConstraint)
771
+ expect(x.applies_to).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
772
+ expect(x.applies_to.id).to eq("empty_entity")
773
+ expect(x.supertype_expression).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
774
+ expect(x.supertype_expression.operator).to eq(Expressir::Model::Expressions::BinaryExpression::AND)
775
+ expect(x.supertype_expression.operand1).to be_instance_of(Expressir::Model::Expressions::Call)
776
+ expect(x.supertype_expression.operand1.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
777
+ expect(x.supertype_expression.operand1.ref.id).to eq("ONEOF")
778
+ expect(x.supertype_expression.operand1.parameters).to be_instance_of(Array)
779
+ expect(x.supertype_expression.operand1.parameters.count).to eq(2)
780
+ expect(x.supertype_expression.operand1.parameters[0]).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
781
+ expect(x.supertype_expression.operand1.parameters[0].id).to eq("a")
782
+ expect(x.supertype_expression.operand1.parameters[1]).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
783
+ expect(x.supertype_expression.operand1.parameters[1].id).to eq("b")
784
+ expect(x.supertype_expression.operand2).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
785
+ expect(x.supertype_expression.operand2.id).to eq("c")
786
+ end
787
+
788
+ subtype_constraints.find{|x| x.id == "supertype_expression_oneof_andor_subtype_constraint"}.tap do |x|
789
+ expect(x).to be_instance_of(Expressir::Model::SubtypeConstraint)
790
+ expect(x.applies_to).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
791
+ expect(x.applies_to.id).to eq("empty_entity")
792
+ expect(x.supertype_expression).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
793
+ expect(x.supertype_expression.operator).to eq(Expressir::Model::Expressions::BinaryExpression::ANDOR)
794
+ expect(x.supertype_expression.operand1).to be_instance_of(Expressir::Model::Expressions::Call)
795
+ expect(x.supertype_expression.operand1.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
796
+ expect(x.supertype_expression.operand1.ref.id).to eq("ONEOF")
797
+ expect(x.supertype_expression.operand1.parameters).to be_instance_of(Array)
798
+ expect(x.supertype_expression.operand1.parameters.count).to eq(2)
799
+ expect(x.supertype_expression.operand1.parameters[0]).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
800
+ expect(x.supertype_expression.operand1.parameters[0].id).to eq("a")
801
+ expect(x.supertype_expression.operand1.parameters[1]).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
802
+ expect(x.supertype_expression.operand1.parameters[1].id).to eq("b")
803
+ expect(x.supertype_expression.operand2).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
804
+ expect(x.supertype_expression.operand2.id).to eq("c")
805
+ end
806
+
807
+ subtype_constraints.find{|x| x.id == "supertype_expression_oneof_and_oneof_subtype_constraint"}.tap do |x|
808
+ expect(x).to be_instance_of(Expressir::Model::SubtypeConstraint)
809
+ expect(x.applies_to).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
810
+ expect(x.applies_to.id).to eq("empty_entity")
811
+ expect(x.supertype_expression).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
812
+ expect(x.supertype_expression.operator).to eq(Expressir::Model::Expressions::BinaryExpression::AND)
813
+ expect(x.supertype_expression.operand1).to be_instance_of(Expressir::Model::Expressions::Call)
814
+ expect(x.supertype_expression.operand1.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
815
+ expect(x.supertype_expression.operand1.ref.id).to eq("ONEOF")
816
+ expect(x.supertype_expression.operand1.parameters).to be_instance_of(Array)
817
+ expect(x.supertype_expression.operand1.parameters.count).to eq(2)
818
+ expect(x.supertype_expression.operand1.parameters[0]).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
819
+ expect(x.supertype_expression.operand1.parameters[0].id).to eq("a")
820
+ expect(x.supertype_expression.operand1.parameters[1]).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
821
+ expect(x.supertype_expression.operand1.parameters[1].id).to eq("b")
822
+ expect(x.supertype_expression.operand2).to be_instance_of(Expressir::Model::Expressions::Call)
823
+ expect(x.supertype_expression.operand2.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
824
+ expect(x.supertype_expression.operand2.ref.id).to eq("ONEOF")
825
+ expect(x.supertype_expression.operand2.parameters).to be_instance_of(Array)
826
+ expect(x.supertype_expression.operand2.parameters.count).to eq(2)
827
+ expect(x.supertype_expression.operand2.parameters[0]).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
828
+ expect(x.supertype_expression.operand2.parameters[0].id).to eq("c")
829
+ expect(x.supertype_expression.operand2.parameters[1]).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
830
+ expect(x.supertype_expression.operand2.parameters[1].id).to eq("d")
831
+ end
832
+
833
+ subtype_constraints.find{|x| x.id == "supertype_expression_oneof_andor_oneof_subtype_constraint"}.tap do |x|
834
+ expect(x).to be_instance_of(Expressir::Model::SubtypeConstraint)
835
+ expect(x.applies_to).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
836
+ expect(x.applies_to.id).to eq("empty_entity")
837
+ expect(x.supertype_expression).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
838
+ expect(x.supertype_expression.operator).to eq(Expressir::Model::Expressions::BinaryExpression::ANDOR)
839
+ expect(x.supertype_expression.operand1).to be_instance_of(Expressir::Model::Expressions::Call)
840
+ expect(x.supertype_expression.operand1.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
841
+ expect(x.supertype_expression.operand1.ref.id).to eq("ONEOF")
842
+ expect(x.supertype_expression.operand1.parameters).to be_instance_of(Array)
843
+ expect(x.supertype_expression.operand1.parameters.count).to eq(2)
844
+ expect(x.supertype_expression.operand1.parameters[0]).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
845
+ expect(x.supertype_expression.operand1.parameters[0].id).to eq("a")
846
+ expect(x.supertype_expression.operand1.parameters[1]).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
847
+ expect(x.supertype_expression.operand1.parameters[1].id).to eq("b")
848
+ expect(x.supertype_expression.operand2).to be_instance_of(Expressir::Model::Expressions::Call)
849
+ expect(x.supertype_expression.operand2.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
850
+ expect(x.supertype_expression.operand2.ref.id).to eq("ONEOF")
851
+ expect(x.supertype_expression.operand2.parameters).to be_instance_of(Array)
852
+ expect(x.supertype_expression.operand2.parameters.count).to eq(2)
853
+ expect(x.supertype_expression.operand2.parameters[0]).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
854
+ expect(x.supertype_expression.operand2.parameters[0].id).to eq("c")
855
+ expect(x.supertype_expression.operand2.parameters[1]).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
856
+ expect(x.supertype_expression.operand2.parameters[1].id).to eq("d")
857
+ end
858
+
859
+ # functions
860
+ functions.find{|x| x.id == "empty_function"}.tap do |x|
861
+ expect(x).to be_instance_of(Expressir::Model::Function)
862
+ expect(x.return_type).to be_instance_of(Expressir::Model::Types::Boolean)
863
+ expect(x.statements).to be_instance_of(Array)
864
+ expect(x.statements.count).to eq(1)
865
+ expect(x.statements[0]).to be_instance_of(Expressir::Model::Statements::Null)
866
+ end
867
+
868
+ functions.find{|x| x.id == "parameter_function"}.tap do |x|
869
+ expect(x).to be_instance_of(Expressir::Model::Function)
870
+ expect(x.parameters).to be_instance_of(Array)
871
+ expect(x.parameters.count).to eq(1)
872
+ expect(x.parameters[0]).to be_instance_of(Expressir::Model::Parameter)
873
+ expect(x.parameters[0].id).to eq("test")
874
+ expect(x.parameters[0].type).to be_instance_of(Expressir::Model::Types::Boolean)
875
+ expect(x.return_type).to be_instance_of(Expressir::Model::Types::Boolean)
876
+ expect(x.statements).to be_instance_of(Array)
877
+ expect(x.statements.count).to eq(1)
878
+ expect(x.statements[0]).to be_instance_of(Expressir::Model::Statements::Null)
879
+ end
880
+
881
+ functions.find{|x| x.id == "multiple_parameter_function"}.tap do |x|
882
+ expect(x).to be_instance_of(Expressir::Model::Function)
883
+ expect(x.parameters).to be_instance_of(Array)
884
+ expect(x.parameters.count).to eq(2)
885
+ expect(x.parameters[0]).to be_instance_of(Expressir::Model::Parameter)
886
+ expect(x.parameters[0].id).to eq("test")
887
+ expect(x.parameters[0].type).to be_instance_of(Expressir::Model::Types::Boolean)
888
+ expect(x.parameters[1]).to be_instance_of(Expressir::Model::Parameter)
889
+ expect(x.parameters[1].id).to eq("test2")
890
+ expect(x.parameters[1].type).to be_instance_of(Expressir::Model::Types::Boolean)
891
+ expect(x.return_type).to be_instance_of(Expressir::Model::Types::Boolean)
892
+ expect(x.statements).to be_instance_of(Array)
893
+ expect(x.statements.count).to eq(1)
894
+ expect(x.statements[0]).to be_instance_of(Expressir::Model::Statements::Null)
895
+ end
896
+
897
+ functions.find{|x| x.id == "multiple_shorthand_parameter_function"}.tap do |x|
898
+ expect(x).to be_instance_of(Expressir::Model::Function)
899
+ expect(x.parameters).to be_instance_of(Array)
900
+ expect(x.parameters.count).to eq(2)
901
+ expect(x.parameters[0]).to be_instance_of(Expressir::Model::Parameter)
902
+ expect(x.parameters[0].id).to eq("test")
903
+ expect(x.parameters[0].type).to be_instance_of(Expressir::Model::Types::Boolean)
904
+ expect(x.parameters[1]).to be_instance_of(Expressir::Model::Parameter)
905
+ expect(x.parameters[1].id).to eq("test2")
906
+ expect(x.parameters[1].type).to be_instance_of(Expressir::Model::Types::Boolean)
907
+ expect(x.return_type).to be_instance_of(Expressir::Model::Types::Boolean)
908
+ expect(x.statements).to be_instance_of(Array)
909
+ expect(x.statements.count).to eq(1)
910
+ expect(x.statements[0]).to be_instance_of(Expressir::Model::Statements::Null)
911
+ end
912
+
913
+ functions.find{|x| x.id == "type_function"}.tap do |x|
914
+ expect(x).to be_instance_of(Expressir::Model::Function)
915
+ expect(x.return_type).to be_instance_of(Expressir::Model::Types::Boolean)
916
+ expect(x.types).to be_instance_of(Array)
917
+ expect(x.types.count).to eq(1)
918
+ expect(x.types[0]).to be_instance_of(Expressir::Model::Type)
919
+ expect(x.types[0].id).to eq("test")
920
+ expect(x.types[0].type).to be_instance_of(Expressir::Model::Types::Boolean)
921
+ expect(x.statements).to be_instance_of(Array)
922
+ expect(x.statements.count).to eq(1)
923
+ expect(x.statements[0]).to be_instance_of(Expressir::Model::Statements::Null)
924
+ end
925
+
926
+ functions.find{|x| x.id == "constant_function"}.tap do |x|
927
+ expect(x).to be_instance_of(Expressir::Model::Function)
928
+ expect(x.return_type).to be_instance_of(Expressir::Model::Types::Boolean)
929
+ expect(x.constants).to be_instance_of(Array)
930
+ expect(x.constants.count).to eq(1)
931
+ expect(x.constants[0]).to be_instance_of(Expressir::Model::Constant)
932
+ expect(x.constants[0].id).to eq("test")
933
+ expect(x.constants[0].type).to be_instance_of(Expressir::Model::Types::Boolean)
934
+ expect(x.constants[0].expression).to be_instance_of(Expressir::Model::Literals::Logical)
935
+ expect(x.constants[0].expression.value).to eq(Expressir::Model::Literals::Logical::TRUE)
936
+ expect(x.statements).to be_instance_of(Array)
937
+ expect(x.statements.count).to eq(1)
938
+ expect(x.statements[0]).to be_instance_of(Expressir::Model::Statements::Null)
939
+ end
940
+
941
+ functions.find{|x| x.id == "multiple_constant_function"}.tap do |x|
942
+ expect(x).to be_instance_of(Expressir::Model::Function)
943
+ expect(x.return_type).to be_instance_of(Expressir::Model::Types::Boolean)
944
+ expect(x.constants).to be_instance_of(Array)
945
+ expect(x.constants.count).to eq(2)
946
+ expect(x.constants[0]).to be_instance_of(Expressir::Model::Constant)
947
+ expect(x.constants[0].id).to eq("test")
948
+ expect(x.constants[0].type).to be_instance_of(Expressir::Model::Types::Boolean)
949
+ expect(x.constants[0].expression).to be_instance_of(Expressir::Model::Literals::Logical)
950
+ expect(x.constants[0].expression.value).to eq(Expressir::Model::Literals::Logical::TRUE)
951
+ expect(x.constants[1]).to be_instance_of(Expressir::Model::Constant)
952
+ expect(x.constants[1].id).to eq("test2")
953
+ expect(x.constants[1].type).to be_instance_of(Expressir::Model::Types::Boolean)
954
+ expect(x.constants[1].expression).to be_instance_of(Expressir::Model::Literals::Logical)
955
+ expect(x.constants[1].expression.value).to eq(Expressir::Model::Literals::Logical::TRUE)
956
+ expect(x.statements).to be_instance_of(Array)
957
+ expect(x.statements.count).to eq(1)
958
+ expect(x.statements[0]).to be_instance_of(Expressir::Model::Statements::Null)
959
+ end
960
+
961
+ functions.find{|x| x.id == "variable_function"}.tap do |x|
962
+ expect(x).to be_instance_of(Expressir::Model::Function)
963
+ expect(x.return_type).to be_instance_of(Expressir::Model::Types::Boolean)
964
+ expect(x.variables).to be_instance_of(Array)
965
+ expect(x.variables.count).to eq(1)
966
+ expect(x.variables[0]).to be_instance_of(Expressir::Model::Variable)
967
+ expect(x.variables[0].id).to eq("test")
968
+ expect(x.variables[0].type).to be_instance_of(Expressir::Model::Types::Boolean)
969
+ expect(x.statements).to be_instance_of(Array)
970
+ expect(x.statements.count).to eq(1)
971
+ expect(x.statements[0]).to be_instance_of(Expressir::Model::Statements::Null)
972
+ end
973
+
974
+ functions.find{|x| x.id == "multiple_variable_function"}.tap do |x|
975
+ expect(x).to be_instance_of(Expressir::Model::Function)
976
+ expect(x.return_type).to be_instance_of(Expressir::Model::Types::Boolean)
977
+ expect(x.variables).to be_instance_of(Array)
978
+ expect(x.variables.count).to eq(2)
979
+ expect(x.variables[0]).to be_instance_of(Expressir::Model::Variable)
980
+ expect(x.variables[0].id).to eq("test")
981
+ expect(x.variables[0].type).to be_instance_of(Expressir::Model::Types::Boolean)
982
+ expect(x.variables[1]).to be_instance_of(Expressir::Model::Variable)
983
+ expect(x.variables[1].id).to eq("test2")
984
+ expect(x.variables[1].type).to be_instance_of(Expressir::Model::Types::Boolean)
985
+ expect(x.statements).to be_instance_of(Array)
986
+ expect(x.statements.count).to eq(1)
987
+ expect(x.statements[0]).to be_instance_of(Expressir::Model::Statements::Null)
988
+ end
989
+
990
+ functions.find{|x| x.id == "multiple_shorthand_variable_function"}.tap do |x|
991
+ expect(x).to be_instance_of(Expressir::Model::Function)
992
+ expect(x.return_type).to be_instance_of(Expressir::Model::Types::Boolean)
993
+ expect(x.variables).to be_instance_of(Array)
994
+ expect(x.variables.count).to eq(2)
995
+ expect(x.variables[0]).to be_instance_of(Expressir::Model::Variable)
996
+ expect(x.variables[0].id).to eq("test")
997
+ expect(x.variables[0].type).to be_instance_of(Expressir::Model::Types::Boolean)
998
+ expect(x.variables[1]).to be_instance_of(Expressir::Model::Variable)
999
+ expect(x.variables[1].id).to eq("test2")
1000
+ expect(x.variables[1].type).to be_instance_of(Expressir::Model::Types::Boolean)
1001
+ expect(x.statements).to be_instance_of(Array)
1002
+ expect(x.statements.count).to eq(1)
1003
+ expect(x.statements[0]).to be_instance_of(Expressir::Model::Statements::Null)
1004
+ end
1005
+
1006
+ functions.find{|x| x.id == "variable_expression_function"}.tap do |x|
1007
+ expect(x).to be_instance_of(Expressir::Model::Function)
1008
+ expect(x.return_type).to be_instance_of(Expressir::Model::Types::Boolean)
1009
+ expect(x.variables).to be_instance_of(Array)
1010
+ expect(x.variables.count).to eq(1)
1011
+ expect(x.variables[0]).to be_instance_of(Expressir::Model::Variable)
1012
+ expect(x.variables[0].id).to eq("test")
1013
+ expect(x.variables[0].type).to be_instance_of(Expressir::Model::Types::Boolean)
1014
+ expect(x.variables[0].expression).to be_instance_of(Expressir::Model::Literals::Logical)
1015
+ expect(x.variables[0].expression.value).to eq(Expressir::Model::Literals::Logical::TRUE)
1016
+ expect(x.statements).to be_instance_of(Array)
1017
+ expect(x.statements.count).to eq(1)
1018
+ expect(x.statements[0]).to be_instance_of(Expressir::Model::Statements::Null)
1019
+ end
1020
+
1021
+ functions.find{|x| x.id == "multiple_variable_expression_function"}.tap do |x|
1022
+ expect(x).to be_instance_of(Expressir::Model::Function)
1023
+ expect(x.return_type).to be_instance_of(Expressir::Model::Types::Boolean)
1024
+ expect(x.variables).to be_instance_of(Array)
1025
+ expect(x.variables.count).to eq(2)
1026
+ expect(x.variables[0]).to be_instance_of(Expressir::Model::Variable)
1027
+ expect(x.variables[0].id).to eq("test")
1028
+ expect(x.variables[0].type).to be_instance_of(Expressir::Model::Types::Boolean)
1029
+ expect(x.variables[0].expression).to be_instance_of(Expressir::Model::Literals::Logical)
1030
+ expect(x.variables[0].expression.value).to eq(Expressir::Model::Literals::Logical::TRUE)
1031
+ expect(x.variables[1]).to be_instance_of(Expressir::Model::Variable)
1032
+ expect(x.variables[1].id).to eq("test2")
1033
+ expect(x.variables[1].type).to be_instance_of(Expressir::Model::Types::Boolean)
1034
+ expect(x.variables[1].expression).to be_instance_of(Expressir::Model::Literals::Logical)
1035
+ expect(x.variables[1].expression.value).to eq(Expressir::Model::Literals::Logical::TRUE)
1036
+ expect(x.statements).to be_instance_of(Array)
1037
+ expect(x.statements.count).to eq(1)
1038
+ expect(x.statements[0]).to be_instance_of(Expressir::Model::Statements::Null)
1039
+ end
1040
+
1041
+ functions.find{|x| x.id == "multiple_shorthand_variable_expression_function"}.tap do |x|
1042
+ expect(x).to be_instance_of(Expressir::Model::Function)
1043
+ expect(x.return_type).to be_instance_of(Expressir::Model::Types::Boolean)
1044
+ expect(x.variables).to be_instance_of(Array)
1045
+ expect(x.variables.count).to eq(2)
1046
+ expect(x.variables[0]).to be_instance_of(Expressir::Model::Variable)
1047
+ expect(x.variables[0].id).to eq("test")
1048
+ expect(x.variables[0].type).to be_instance_of(Expressir::Model::Types::Boolean)
1049
+ expect(x.variables[0].expression).to be_instance_of(Expressir::Model::Literals::Logical)
1050
+ expect(x.variables[0].expression.value).to eq(Expressir::Model::Literals::Logical::TRUE)
1051
+ expect(x.variables[1]).to be_instance_of(Expressir::Model::Variable)
1052
+ expect(x.variables[1].id).to eq("test2")
1053
+ expect(x.variables[1].type).to be_instance_of(Expressir::Model::Types::Boolean)
1054
+ expect(x.variables[1].expression).to be_instance_of(Expressir::Model::Literals::Logical)
1055
+ expect(x.variables[1].expression.value).to eq(Expressir::Model::Literals::Logical::TRUE)
1056
+ expect(x.statements).to be_instance_of(Array)
1057
+ expect(x.statements.count).to eq(1)
1058
+ expect(x.statements[0]).to be_instance_of(Expressir::Model::Statements::Null)
1059
+ end
1060
+
1061
+ # procedures
1062
+ procedures.find{|x| x.id == "empty_procedure"}.tap do |x|
1063
+ expect(x).to be_instance_of(Expressir::Model::Procedure)
1064
+ end
1065
+
1066
+ procedures.find{|x| x.id == "parameter_procedure"}.tap do |x|
1067
+ expect(x).to be_instance_of(Expressir::Model::Procedure)
1068
+ expect(x.parameters).to be_instance_of(Array)
1069
+ expect(x.parameters.count).to eq(1)
1070
+ expect(x.parameters[0]).to be_instance_of(Expressir::Model::Parameter)
1071
+ expect(x.parameters[0].id).to eq("test")
1072
+ expect(x.parameters[0].var).not_to eq(true)
1073
+ expect(x.parameters[0].type).to be_instance_of(Expressir::Model::Types::Boolean)
1074
+ end
1075
+
1076
+ procedures.find{|x| x.id == "multiple_parameter_procedure"}.tap do |x|
1077
+ expect(x).to be_instance_of(Expressir::Model::Procedure)
1078
+ expect(x.parameters).to be_instance_of(Array)
1079
+ expect(x.parameters.count).to eq(2)
1080
+ expect(x.parameters[0]).to be_instance_of(Expressir::Model::Parameter)
1081
+ expect(x.parameters[0].id).to eq("test")
1082
+ expect(x.parameters[0].var).not_to eq(true)
1083
+ expect(x.parameters[0].type).to be_instance_of(Expressir::Model::Types::Boolean)
1084
+ expect(x.parameters[1]).to be_instance_of(Expressir::Model::Parameter)
1085
+ expect(x.parameters[1].id).to eq("test2")
1086
+ expect(x.parameters[1].var).not_to eq(true)
1087
+ expect(x.parameters[1].type).to be_instance_of(Expressir::Model::Types::Boolean)
1088
+ end
1089
+
1090
+ procedures.find{|x| x.id == "multiple_shorthand_parameter_procedure"}.tap do |x|
1091
+ expect(x).to be_instance_of(Expressir::Model::Procedure)
1092
+ expect(x.parameters).to be_instance_of(Array)
1093
+ expect(x.parameters.count).to eq(2)
1094
+ expect(x.parameters[0]).to be_instance_of(Expressir::Model::Parameter)
1095
+ expect(x.parameters[0].id).to eq("test")
1096
+ expect(x.parameters[0].var).not_to eq(true)
1097
+ expect(x.parameters[0].type).to be_instance_of(Expressir::Model::Types::Boolean)
1098
+ expect(x.parameters[1]).to be_instance_of(Expressir::Model::Parameter)
1099
+ expect(x.parameters[1].id).to eq("test2")
1100
+ expect(x.parameters[1].var).not_to eq(true)
1101
+ expect(x.parameters[1].type).to be_instance_of(Expressir::Model::Types::Boolean)
1102
+ end
1103
+
1104
+ procedures.find{|x| x.id == "variable_parameter_procedure"}.tap do |x|
1105
+ expect(x).to be_instance_of(Expressir::Model::Procedure)
1106
+ expect(x.parameters).to be_instance_of(Array)
1107
+ expect(x.parameters.count).to eq(1)
1108
+ expect(x.parameters[0]).to be_instance_of(Expressir::Model::Parameter)
1109
+ expect(x.parameters[0].id).to eq("test")
1110
+ expect(x.parameters[0].var).to eq(true)
1111
+ expect(x.parameters[0].type).to be_instance_of(Expressir::Model::Types::Boolean)
1112
+ end
1113
+
1114
+ procedures.find{|x| x.id == "multiple_variable_parameter_procedure"}.tap do |x|
1115
+ expect(x).to be_instance_of(Expressir::Model::Procedure)
1116
+ expect(x.parameters).to be_instance_of(Array)
1117
+ expect(x.parameters.count).to eq(2)
1118
+ expect(x.parameters[0]).to be_instance_of(Expressir::Model::Parameter)
1119
+ expect(x.parameters[0].id).to eq("test")
1120
+ expect(x.parameters[0].var).to eq(true)
1121
+ expect(x.parameters[0].type).to be_instance_of(Expressir::Model::Types::Boolean)
1122
+ expect(x.parameters[1]).to be_instance_of(Expressir::Model::Parameter)
1123
+ expect(x.parameters[1].id).to eq("test2")
1124
+ expect(x.parameters[1].var).not_to eq(true)
1125
+ expect(x.parameters[1].type).to be_instance_of(Expressir::Model::Types::Boolean)
1126
+ end
1127
+
1128
+ procedures.find{|x| x.id == "multiple_variable_parameter2_procedure"}.tap do |x|
1129
+ expect(x).to be_instance_of(Expressir::Model::Procedure)
1130
+ expect(x.parameters).to be_instance_of(Array)
1131
+ expect(x.parameters.count).to eq(2)
1132
+ expect(x.parameters[0]).to be_instance_of(Expressir::Model::Parameter)
1133
+ expect(x.parameters[0].id).to eq("test")
1134
+ expect(x.parameters[0].var).not_to eq(true)
1135
+ expect(x.parameters[0].type).to be_instance_of(Expressir::Model::Types::Boolean)
1136
+ expect(x.parameters[1]).to be_instance_of(Expressir::Model::Parameter)
1137
+ expect(x.parameters[1].id).to eq("test2")
1138
+ expect(x.parameters[1].var).to eq(true)
1139
+ expect(x.parameters[1].type).to be_instance_of(Expressir::Model::Types::Boolean)
1140
+ end
1141
+
1142
+ procedures.find{|x| x.id == "multiple_shorthand_variable_parameter_procedure"}.tap do |x|
1143
+ expect(x).to be_instance_of(Expressir::Model::Procedure)
1144
+ expect(x.parameters).to be_instance_of(Array)
1145
+ expect(x.parameters.count).to eq(2)
1146
+ expect(x.parameters[0]).to be_instance_of(Expressir::Model::Parameter)
1147
+ expect(x.parameters[0].id).to eq("test")
1148
+ expect(x.parameters[0].var).to eq(true)
1149
+ expect(x.parameters[0].type).to be_instance_of(Expressir::Model::Types::Boolean)
1150
+ expect(x.parameters[1]).to be_instance_of(Expressir::Model::Parameter)
1151
+ expect(x.parameters[1].id).to eq("test2")
1152
+ expect(x.parameters[1].var).to eq(true)
1153
+ expect(x.parameters[1].type).to be_instance_of(Expressir::Model::Types::Boolean)
1154
+ end
1155
+
1156
+ procedures.find{|x| x.id == "type_procedure"}.tap do |x|
1157
+ expect(x).to be_instance_of(Expressir::Model::Procedure)
1158
+ expect(x.types).to be_instance_of(Array)
1159
+ expect(x.types.count).to eq(1)
1160
+ expect(x.types[0]).to be_instance_of(Expressir::Model::Type)
1161
+ expect(x.types[0].id).to eq("test")
1162
+ expect(x.types[0].type).to be_instance_of(Expressir::Model::Types::Boolean)
1163
+ end
1164
+
1165
+ procedures.find{|x| x.id == "constant_procedure"}.tap do |x|
1166
+ expect(x).to be_instance_of(Expressir::Model::Procedure)
1167
+ expect(x.constants).to be_instance_of(Array)
1168
+ expect(x.constants.count).to eq(1)
1169
+ expect(x.constants[0]).to be_instance_of(Expressir::Model::Constant)
1170
+ expect(x.constants[0].id).to eq("test")
1171
+ expect(x.constants[0].type).to be_instance_of(Expressir::Model::Types::Boolean)
1172
+ expect(x.constants[0].expression).to be_instance_of(Expressir::Model::Literals::Logical)
1173
+ expect(x.constants[0].expression.value).to eq(Expressir::Model::Literals::Logical::TRUE)
1174
+ end
1175
+
1176
+ procedures.find{|x| x.id == "multiple_constant_procedure"}.tap do |x|
1177
+ expect(x).to be_instance_of(Expressir::Model::Procedure)
1178
+ expect(x.constants).to be_instance_of(Array)
1179
+ expect(x.constants.count).to eq(2)
1180
+ expect(x.constants[0]).to be_instance_of(Expressir::Model::Constant)
1181
+ expect(x.constants[0].id).to eq("test")
1182
+ expect(x.constants[0].type).to be_instance_of(Expressir::Model::Types::Boolean)
1183
+ expect(x.constants[0].expression).to be_instance_of(Expressir::Model::Literals::Logical)
1184
+ expect(x.constants[0].expression.value).to eq(Expressir::Model::Literals::Logical::TRUE)
1185
+ expect(x.constants[1]).to be_instance_of(Expressir::Model::Constant)
1186
+ expect(x.constants[1].id).to eq("test2")
1187
+ expect(x.constants[1].type).to be_instance_of(Expressir::Model::Types::Boolean)
1188
+ expect(x.constants[1].expression).to be_instance_of(Expressir::Model::Literals::Logical)
1189
+ expect(x.constants[1].expression.value).to eq(Expressir::Model::Literals::Logical::TRUE)
1190
+ end
1191
+
1192
+ procedures.find{|x| x.id == "variable_procedure"}.tap do |x|
1193
+ expect(x).to be_instance_of(Expressir::Model::Procedure)
1194
+ expect(x.variables).to be_instance_of(Array)
1195
+ expect(x.variables.count).to eq(1)
1196
+ expect(x.variables[0]).to be_instance_of(Expressir::Model::Variable)
1197
+ expect(x.variables[0].id).to eq("test")
1198
+ expect(x.variables[0].type).to be_instance_of(Expressir::Model::Types::Boolean)
1199
+ end
1200
+
1201
+ procedures.find{|x| x.id == "multiple_variable_procedure"}.tap do |x|
1202
+ expect(x).to be_instance_of(Expressir::Model::Procedure)
1203
+ expect(x.variables).to be_instance_of(Array)
1204
+ expect(x.variables.count).to eq(2)
1205
+ expect(x.variables[0]).to be_instance_of(Expressir::Model::Variable)
1206
+ expect(x.variables[0].id).to eq("test")
1207
+ expect(x.variables[0].type).to be_instance_of(Expressir::Model::Types::Boolean)
1208
+ expect(x.variables[1]).to be_instance_of(Expressir::Model::Variable)
1209
+ expect(x.variables[1].id).to eq("test2")
1210
+ expect(x.variables[1].type).to be_instance_of(Expressir::Model::Types::Boolean)
1211
+ end
1212
+
1213
+ procedures.find{|x| x.id == "multiple_shorthand_variable_procedure"}.tap do |x|
1214
+ expect(x).to be_instance_of(Expressir::Model::Procedure)
1215
+ expect(x.variables).to be_instance_of(Array)
1216
+ expect(x.variables.count).to eq(2)
1217
+ expect(x.variables[0]).to be_instance_of(Expressir::Model::Variable)
1218
+ expect(x.variables[0].id).to eq("test")
1219
+ expect(x.variables[0].type).to be_instance_of(Expressir::Model::Types::Boolean)
1220
+ expect(x.variables[1]).to be_instance_of(Expressir::Model::Variable)
1221
+ expect(x.variables[1].id).to eq("test2")
1222
+ expect(x.variables[1].type).to be_instance_of(Expressir::Model::Types::Boolean)
1223
+ end
1224
+
1225
+ procedures.find{|x| x.id == "variable_expression_procedure"}.tap do |x|
1226
+ expect(x).to be_instance_of(Expressir::Model::Procedure)
1227
+ expect(x.variables).to be_instance_of(Array)
1228
+ expect(x.variables.count).to eq(1)
1229
+ expect(x.variables[0]).to be_instance_of(Expressir::Model::Variable)
1230
+ expect(x.variables[0].id).to eq("test")
1231
+ expect(x.variables[0].type).to be_instance_of(Expressir::Model::Types::Boolean)
1232
+ expect(x.variables[0].expression).to be_instance_of(Expressir::Model::Literals::Logical)
1233
+ expect(x.variables[0].expression.value).to eq(Expressir::Model::Literals::Logical::TRUE)
1234
+ end
1235
+
1236
+ procedures.find{|x| x.id == "multiple_variable_expression_procedure"}.tap do |x|
1237
+ expect(x).to be_instance_of(Expressir::Model::Procedure)
1238
+ expect(x.variables).to be_instance_of(Array)
1239
+ expect(x.variables.count).to eq(2)
1240
+ expect(x.variables[0]).to be_instance_of(Expressir::Model::Variable)
1241
+ expect(x.variables[0].id).to eq("test")
1242
+ expect(x.variables[0].type).to be_instance_of(Expressir::Model::Types::Boolean)
1243
+ expect(x.variables[0].expression).to be_instance_of(Expressir::Model::Literals::Logical)
1244
+ expect(x.variables[0].expression.value).to eq(Expressir::Model::Literals::Logical::TRUE)
1245
+ expect(x.variables[1]).to be_instance_of(Expressir::Model::Variable)
1246
+ expect(x.variables[1].id).to eq("test2")
1247
+ expect(x.variables[1].type).to be_instance_of(Expressir::Model::Types::Boolean)
1248
+ expect(x.variables[1].expression).to be_instance_of(Expressir::Model::Literals::Logical)
1249
+ expect(x.variables[1].expression.value).to eq(Expressir::Model::Literals::Logical::TRUE)
1250
+ end
1251
+
1252
+ procedures.find{|x| x.id == "multiple_shorthand_variable_expression_procedure"}.tap do |x|
1253
+ expect(x).to be_instance_of(Expressir::Model::Procedure)
1254
+ expect(x.variables).to be_instance_of(Array)
1255
+ expect(x.variables.count).to eq(2)
1256
+ expect(x.variables[0]).to be_instance_of(Expressir::Model::Variable)
1257
+ expect(x.variables[0].id).to eq("test")
1258
+ expect(x.variables[0].type).to be_instance_of(Expressir::Model::Types::Boolean)
1259
+ expect(x.variables[0].expression).to be_instance_of(Expressir::Model::Literals::Logical)
1260
+ expect(x.variables[0].expression.value).to eq(Expressir::Model::Literals::Logical::TRUE)
1261
+ expect(x.variables[1]).to be_instance_of(Expressir::Model::Variable)
1262
+ expect(x.variables[1].id).to eq("test2")
1263
+ expect(x.variables[1].type).to be_instance_of(Expressir::Model::Types::Boolean)
1264
+ expect(x.variables[1].expression).to be_instance_of(Expressir::Model::Literals::Logical)
1265
+ expect(x.variables[1].expression.value).to eq(Expressir::Model::Literals::Logical::TRUE)
1266
+ end
1267
+
1268
+ procedures.find{|x| x.id == "statement_procedure"}.tap do |x|
1269
+ expect(x).to be_instance_of(Expressir::Model::Procedure)
1270
+ expect(x.statements).to be_instance_of(Array)
1271
+ expect(x.statements.count).to eq(1)
1272
+ expect(x.statements[0]).to be_instance_of(Expressir::Model::Statements::Null)
1273
+ end
1274
+
1275
+ # rules
1276
+ rules.find{|x| x.id == "empty_rule"}.tap do |x|
1277
+ expect(x).to be_instance_of(Expressir::Model::Rule)
1278
+ expect(x.applies_to).to be_instance_of(Array)
1279
+ expect(x.applies_to.count).to eq(1)
1280
+ expect(x.applies_to[0]).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
1281
+ expect(x.applies_to[0].id).to eq("empty_entity")
1282
+ expect(x.where).to be_instance_of(Array)
1283
+ expect(x.where.count).to eq(1)
1284
+ expect(x.where[0]).to be_instance_of(Expressir::Model::Where)
1285
+ expect(x.where[0].expression).to be_instance_of(Expressir::Model::Literals::Logical)
1286
+ expect(x.where[0].expression.value).to eq(Expressir::Model::Literals::Logical::TRUE)
1287
+ end
1288
+
1289
+ rules.find{|x| x.id == "type_rule"}.tap do |x|
1290
+ expect(x).to be_instance_of(Expressir::Model::Rule)
1291
+ expect(x.applies_to).to be_instance_of(Array)
1292
+ expect(x.applies_to.count).to eq(1)
1293
+ expect(x.applies_to[0]).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
1294
+ expect(x.applies_to[0].id).to eq("empty_entity")
1295
+ expect(x.types).to be_instance_of(Array)
1296
+ expect(x.types.count).to eq(1)
1297
+ expect(x.types[0]).to be_instance_of(Expressir::Model::Type)
1298
+ expect(x.types[0].id).to eq("test")
1299
+ expect(x.types[0].type).to be_instance_of(Expressir::Model::Types::Boolean)
1300
+ expect(x.where).to be_instance_of(Array)
1301
+ expect(x.where.count).to eq(1)
1302
+ expect(x.where[0]).to be_instance_of(Expressir::Model::Where)
1303
+ expect(x.where[0].expression).to be_instance_of(Expressir::Model::Literals::Logical)
1304
+ expect(x.where[0].expression.value).to eq(Expressir::Model::Literals::Logical::TRUE)
1305
+ end
1306
+
1307
+ rules.find{|x| x.id == "constant_rule"}.tap do |x|
1308
+ expect(x).to be_instance_of(Expressir::Model::Rule)
1309
+ expect(x.applies_to).to be_instance_of(Array)
1310
+ expect(x.applies_to.count).to eq(1)
1311
+ expect(x.applies_to[0]).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
1312
+ expect(x.applies_to[0].id).to eq("empty_entity")
1313
+ expect(x.constants).to be_instance_of(Array)
1314
+ expect(x.constants.count).to eq(1)
1315
+ expect(x.constants[0]).to be_instance_of(Expressir::Model::Constant)
1316
+ expect(x.constants[0].id).to eq("test")
1317
+ expect(x.constants[0].type).to be_instance_of(Expressir::Model::Types::Boolean)
1318
+ expect(x.constants[0].expression).to be_instance_of(Expressir::Model::Literals::Logical)
1319
+ expect(x.constants[0].expression.value).to eq(Expressir::Model::Literals::Logical::TRUE)
1320
+ expect(x.where).to be_instance_of(Array)
1321
+ expect(x.where.count).to eq(1)
1322
+ expect(x.where[0]).to be_instance_of(Expressir::Model::Where)
1323
+ expect(x.where[0].expression).to be_instance_of(Expressir::Model::Literals::Logical)
1324
+ expect(x.where[0].expression.value).to eq(Expressir::Model::Literals::Logical::TRUE)
1325
+ end
1326
+
1327
+ rules.find{|x| x.id == "multiple_constant_rule"}.tap do |x|
1328
+ expect(x).to be_instance_of(Expressir::Model::Rule)
1329
+ expect(x.applies_to).to be_instance_of(Array)
1330
+ expect(x.applies_to.count).to eq(1)
1331
+ expect(x.applies_to[0]).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
1332
+ expect(x.applies_to[0].id).to eq("empty_entity")
1333
+ expect(x.constants).to be_instance_of(Array)
1334
+ expect(x.constants.count).to eq(2)
1335
+ expect(x.constants[0]).to be_instance_of(Expressir::Model::Constant)
1336
+ expect(x.constants[0].id).to eq("test")
1337
+ expect(x.constants[0].type).to be_instance_of(Expressir::Model::Types::Boolean)
1338
+ expect(x.constants[0].expression).to be_instance_of(Expressir::Model::Literals::Logical)
1339
+ expect(x.constants[0].expression.value).to eq(Expressir::Model::Literals::Logical::TRUE)
1340
+ expect(x.constants[1]).to be_instance_of(Expressir::Model::Constant)
1341
+ expect(x.constants[1].id).to eq("test2")
1342
+ expect(x.constants[1].type).to be_instance_of(Expressir::Model::Types::Boolean)
1343
+ expect(x.constants[1].expression).to be_instance_of(Expressir::Model::Literals::Logical)
1344
+ expect(x.constants[1].expression.value).to eq(Expressir::Model::Literals::Logical::TRUE)
1345
+ expect(x.where).to be_instance_of(Array)
1346
+ expect(x.where.count).to eq(1)
1347
+ expect(x.where[0]).to be_instance_of(Expressir::Model::Where)
1348
+ expect(x.where[0].expression).to be_instance_of(Expressir::Model::Literals::Logical)
1349
+ expect(x.where[0].expression.value).to eq(Expressir::Model::Literals::Logical::TRUE)
1350
+ end
1351
+
1352
+ rules.find{|x| x.id == "variable_rule"}.tap do |x|
1353
+ expect(x).to be_instance_of(Expressir::Model::Rule)
1354
+ expect(x.applies_to).to be_instance_of(Array)
1355
+ expect(x.applies_to.count).to eq(1)
1356
+ expect(x.applies_to[0]).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
1357
+ expect(x.applies_to[0].id).to eq("empty_entity")
1358
+ expect(x.variables).to be_instance_of(Array)
1359
+ expect(x.variables.count).to eq(1)
1360
+ expect(x.variables[0]).to be_instance_of(Expressir::Model::Variable)
1361
+ expect(x.variables[0].id).to eq("test")
1362
+ expect(x.variables[0].type).to be_instance_of(Expressir::Model::Types::Boolean)
1363
+ expect(x.where).to be_instance_of(Array)
1364
+ expect(x.where.count).to eq(1)
1365
+ expect(x.where[0]).to be_instance_of(Expressir::Model::Where)
1366
+ expect(x.where[0].expression).to be_instance_of(Expressir::Model::Literals::Logical)
1367
+ expect(x.where[0].expression.value).to eq(Expressir::Model::Literals::Logical::TRUE)
1368
+ end
1369
+
1370
+ rules.find{|x| x.id == "multiple_variable_rule"}.tap do |x|
1371
+ expect(x).to be_instance_of(Expressir::Model::Rule)
1372
+ expect(x.applies_to).to be_instance_of(Array)
1373
+ expect(x.applies_to.count).to eq(1)
1374
+ expect(x.applies_to[0]).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
1375
+ expect(x.applies_to[0].id).to eq("empty_entity")
1376
+ expect(x.variables).to be_instance_of(Array)
1377
+ expect(x.variables.count).to eq(2)
1378
+ expect(x.variables[0]).to be_instance_of(Expressir::Model::Variable)
1379
+ expect(x.variables[0].id).to eq("test")
1380
+ expect(x.variables[0].type).to be_instance_of(Expressir::Model::Types::Boolean)
1381
+ expect(x.variables[1]).to be_instance_of(Expressir::Model::Variable)
1382
+ expect(x.variables[1].id).to eq("test2")
1383
+ expect(x.variables[1].type).to be_instance_of(Expressir::Model::Types::Boolean)
1384
+ expect(x.where).to be_instance_of(Array)
1385
+ expect(x.where.count).to eq(1)
1386
+ expect(x.where[0]).to be_instance_of(Expressir::Model::Where)
1387
+ expect(x.where[0].expression).to be_instance_of(Expressir::Model::Literals::Logical)
1388
+ expect(x.where[0].expression.value).to eq(Expressir::Model::Literals::Logical::TRUE)
1389
+ end
1390
+
1391
+ rules.find{|x| x.id == "multiple_shorthand_variable_rule"}.tap do |x|
1392
+ expect(x).to be_instance_of(Expressir::Model::Rule)
1393
+ expect(x.applies_to).to be_instance_of(Array)
1394
+ expect(x.applies_to.count).to eq(1)
1395
+ expect(x.applies_to[0]).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
1396
+ expect(x.applies_to[0].id).to eq("empty_entity")
1397
+ expect(x.variables).to be_instance_of(Array)
1398
+ expect(x.variables.count).to eq(2)
1399
+ expect(x.variables[0]).to be_instance_of(Expressir::Model::Variable)
1400
+ expect(x.variables[0].id).to eq("test")
1401
+ expect(x.variables[0].type).to be_instance_of(Expressir::Model::Types::Boolean)
1402
+ expect(x.variables[1]).to be_instance_of(Expressir::Model::Variable)
1403
+ expect(x.variables[1].id).to eq("test2")
1404
+ expect(x.variables[1].type).to be_instance_of(Expressir::Model::Types::Boolean)
1405
+ expect(x.where).to be_instance_of(Array)
1406
+ expect(x.where.count).to eq(1)
1407
+ expect(x.where[0]).to be_instance_of(Expressir::Model::Where)
1408
+ expect(x.where[0].expression).to be_instance_of(Expressir::Model::Literals::Logical)
1409
+ expect(x.where[0].expression.value).to eq(Expressir::Model::Literals::Logical::TRUE)
1410
+ end
1411
+
1412
+ rules.find{|x| x.id == "variable_expression_rule"}.tap do |x|
1413
+ expect(x).to be_instance_of(Expressir::Model::Rule)
1414
+ expect(x.applies_to).to be_instance_of(Array)
1415
+ expect(x.applies_to.count).to eq(1)
1416
+ expect(x.applies_to[0]).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
1417
+ expect(x.applies_to[0].id).to eq("empty_entity")
1418
+ expect(x.variables).to be_instance_of(Array)
1419
+ expect(x.variables.count).to eq(1)
1420
+ expect(x.variables[0]).to be_instance_of(Expressir::Model::Variable)
1421
+ expect(x.variables[0].id).to eq("test")
1422
+ expect(x.variables[0].type).to be_instance_of(Expressir::Model::Types::Boolean)
1423
+ expect(x.variables[0].expression).to be_instance_of(Expressir::Model::Literals::Logical)
1424
+ expect(x.variables[0].expression.value).to eq(Expressir::Model::Literals::Logical::TRUE)
1425
+ expect(x.where).to be_instance_of(Array)
1426
+ expect(x.where.count).to eq(1)
1427
+ expect(x.where[0]).to be_instance_of(Expressir::Model::Where)
1428
+ expect(x.where[0].expression).to be_instance_of(Expressir::Model::Literals::Logical)
1429
+ expect(x.where[0].expression.value).to eq(Expressir::Model::Literals::Logical::TRUE)
1430
+ end
1431
+
1432
+ rules.find{|x| x.id == "multiple_variable_expression_rule"}.tap do |x|
1433
+ expect(x).to be_instance_of(Expressir::Model::Rule)
1434
+ expect(x.applies_to).to be_instance_of(Array)
1435
+ expect(x.applies_to.count).to eq(1)
1436
+ expect(x.applies_to[0]).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
1437
+ expect(x.applies_to[0].id).to eq("empty_entity")
1438
+ expect(x.variables).to be_instance_of(Array)
1439
+ expect(x.variables.count).to eq(2)
1440
+ expect(x.variables[0]).to be_instance_of(Expressir::Model::Variable)
1441
+ expect(x.variables[0].id).to eq("test")
1442
+ expect(x.variables[0].type).to be_instance_of(Expressir::Model::Types::Boolean)
1443
+ expect(x.variables[0].expression).to be_instance_of(Expressir::Model::Literals::Logical)
1444
+ expect(x.variables[0].expression.value).to eq(Expressir::Model::Literals::Logical::TRUE)
1445
+ expect(x.variables[1]).to be_instance_of(Expressir::Model::Variable)
1446
+ expect(x.variables[1].id).to eq("test2")
1447
+ expect(x.variables[1].type).to be_instance_of(Expressir::Model::Types::Boolean)
1448
+ expect(x.variables[1].expression).to be_instance_of(Expressir::Model::Literals::Logical)
1449
+ expect(x.variables[1].expression.value).to eq(Expressir::Model::Literals::Logical::TRUE)
1450
+ expect(x.where).to be_instance_of(Array)
1451
+ expect(x.where.count).to eq(1)
1452
+ expect(x.where[0]).to be_instance_of(Expressir::Model::Where)
1453
+ expect(x.where[0].expression).to be_instance_of(Expressir::Model::Literals::Logical)
1454
+ expect(x.where[0].expression.value).to eq(Expressir::Model::Literals::Logical::TRUE)
1455
+ end
1456
+
1457
+ rules.find{|x| x.id == "multiple_shorthand_variable_expression_rule"}.tap do |x|
1458
+ expect(x).to be_instance_of(Expressir::Model::Rule)
1459
+ expect(x.applies_to).to be_instance_of(Array)
1460
+ expect(x.applies_to.count).to eq(1)
1461
+ expect(x.applies_to[0]).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
1462
+ expect(x.applies_to[0].id).to eq("empty_entity")
1463
+ expect(x.variables).to be_instance_of(Array)
1464
+ expect(x.variables.count).to eq(2)
1465
+ expect(x.variables[0]).to be_instance_of(Expressir::Model::Variable)
1466
+ expect(x.variables[0].id).to eq("test")
1467
+ expect(x.variables[0].type).to be_instance_of(Expressir::Model::Types::Boolean)
1468
+ expect(x.variables[0].expression).to be_instance_of(Expressir::Model::Literals::Logical)
1469
+ expect(x.variables[0].expression.value).to eq(Expressir::Model::Literals::Logical::TRUE)
1470
+ expect(x.variables[1]).to be_instance_of(Expressir::Model::Variable)
1471
+ expect(x.variables[1].id).to eq("test2")
1472
+ expect(x.variables[1].type).to be_instance_of(Expressir::Model::Types::Boolean)
1473
+ expect(x.variables[1].expression).to be_instance_of(Expressir::Model::Literals::Logical)
1474
+ expect(x.variables[1].expression.value).to eq(Expressir::Model::Literals::Logical::TRUE)
1475
+ expect(x.where).to be_instance_of(Array)
1476
+ expect(x.where.count).to eq(1)
1477
+ expect(x.where[0]).to be_instance_of(Expressir::Model::Where)
1478
+ expect(x.where[0].expression).to be_instance_of(Expressir::Model::Literals::Logical)
1479
+ expect(x.where[0].expression.value).to eq(Expressir::Model::Literals::Logical::TRUE)
1480
+ end
1481
+
1482
+ rules.find{|x| x.id == "statement_rule"}.tap do |x|
1483
+ expect(x).to be_instance_of(Expressir::Model::Rule)
1484
+ expect(x.applies_to).to be_instance_of(Array)
1485
+ expect(x.applies_to.count).to eq(1)
1486
+ expect(x.applies_to[0]).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
1487
+ expect(x.applies_to[0].id).to eq("empty_entity")
1488
+ expect(x.statements).to be_instance_of(Array)
1489
+ expect(x.statements.count).to eq(1)
1490
+ expect(x.statements[0]).to be_instance_of(Expressir::Model::Statements::Null)
1491
+ expect(x.where).to be_instance_of(Array)
1492
+ expect(x.where.count).to eq(1)
1493
+ expect(x.where[0]).to be_instance_of(Expressir::Model::Where)
1494
+ expect(x.where[0].expression).to be_instance_of(Expressir::Model::Literals::Logical)
1495
+ expect(x.where[0].expression.value).to eq(Expressir::Model::Literals::Logical::TRUE)
1496
+ end
1497
+
1498
+ rules.find{|x| x.id == "where_label_rule"}.tap do |x|
1499
+ expect(x).to be_instance_of(Expressir::Model::Rule)
1500
+ expect(x.applies_to).to be_instance_of(Array)
1501
+ expect(x.applies_to.count).to eq(1)
1502
+ expect(x.applies_to[0]).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
1503
+ expect(x.applies_to[0].id).to eq("empty_entity")
1504
+ expect(x.where).to be_instance_of(Array)
1505
+ expect(x.where.count).to eq(1)
1506
+ expect(x.where[0]).to be_instance_of(Expressir::Model::Where)
1507
+ expect(x.where[0].id).to eq("WR1")
1508
+ expect(x.where[0].expression).to be_instance_of(Expressir::Model::Literals::Logical)
1509
+ expect(x.where[0].expression.value).to eq(Expressir::Model::Literals::Logical::TRUE)
1510
+ end
1511
+
1512
+ procedures.find{|x| x.id == "statements"}.tap do |x|
1513
+ # statements
1514
+ x.procedures.find{|x| x.id == "alias_simple_reference_statement"}.statements[0].tap do |x|
1515
+ expect(x).to be_instance_of(Expressir::Model::Statements::Alias)
1516
+ expect(x.id).to eq("test")
1517
+ expect(x.expression).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
1518
+ expect(x.expression.id).to eq("test")
1519
+ expect(x.statements).to be_instance_of(Array)
1520
+ expect(x.statements.count).to eq(1)
1521
+ expect(x.statements[0]).to be_instance_of(Expressir::Model::Statements::Null)
1522
+ end
1523
+
1524
+ x.procedures.find{|x| x.id == "alias_group_reference_statement"}.statements[0].tap do |x|
1525
+ expect(x).to be_instance_of(Expressir::Model::Statements::Alias)
1526
+ expect(x.id).to eq("test")
1527
+ expect(x.expression).to be_instance_of(Expressir::Model::Expressions::GroupReference)
1528
+ expect(x.expression.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
1529
+ expect(x.expression.ref.id).to eq("test")
1530
+ expect(x.expression.entity).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
1531
+ expect(x.expression.entity.id).to eq("test2")
1532
+ expect(x.statements).to be_instance_of(Array)
1533
+ expect(x.statements.count).to eq(1)
1534
+ expect(x.statements[0]).to be_instance_of(Expressir::Model::Statements::Null)
1535
+ end
1536
+
1537
+ x.procedures.find{|x| x.id == "alias_index_reference_statement"}.statements[0].tap do |x|
1538
+ expect(x).to be_instance_of(Expressir::Model::Statements::Alias)
1539
+ expect(x.id).to eq("test")
1540
+ expect(x.expression).to be_instance_of(Expressir::Model::Expressions::IndexReference)
1541
+ expect(x.expression.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
1542
+ expect(x.expression.ref.id).to eq("test")
1543
+ expect(x.expression.index1).to be_instance_of(Expressir::Model::Literals::Integer)
1544
+ expect(x.expression.index1.value).to eq("1")
1545
+ expect(x.statements).to be_instance_of(Array)
1546
+ expect(x.statements.count).to eq(1)
1547
+ expect(x.statements[0]).to be_instance_of(Expressir::Model::Statements::Null)
1548
+ end
1549
+
1550
+ x.procedures.find{|x| x.id == "alias_index2_reference_statement"}.statements[0].tap do |x|
1551
+ expect(x).to be_instance_of(Expressir::Model::Statements::Alias)
1552
+ expect(x.id).to eq("test")
1553
+ expect(x.expression).to be_instance_of(Expressir::Model::Expressions::IndexReference)
1554
+ expect(x.expression.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
1555
+ expect(x.expression.ref.id).to eq("test")
1556
+ expect(x.expression.index1).to be_instance_of(Expressir::Model::Literals::Integer)
1557
+ expect(x.expression.index1.value).to eq("1")
1558
+ expect(x.expression.index2).to be_instance_of(Expressir::Model::Literals::Integer)
1559
+ expect(x.expression.index2.value).to eq("9")
1560
+ expect(x.statements).to be_instance_of(Array)
1561
+ expect(x.statements.count).to eq(1)
1562
+ expect(x.statements[0]).to be_instance_of(Expressir::Model::Statements::Null)
1563
+ end
1564
+
1565
+ x.procedures.find{|x| x.id == "alias_attribute_reference_statement"}.statements[0].tap do |x|
1566
+ expect(x).to be_instance_of(Expressir::Model::Statements::Alias)
1567
+ expect(x.id).to eq("test")
1568
+ expect(x.expression).to be_instance_of(Expressir::Model::Expressions::AttributeReference)
1569
+ expect(x.expression.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
1570
+ expect(x.expression.ref.id).to eq("test")
1571
+ expect(x.expression.attribute).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
1572
+ expect(x.expression.attribute.id).to eq("test2")
1573
+ expect(x.statements).to be_instance_of(Array)
1574
+ expect(x.statements.count).to eq(1)
1575
+ expect(x.statements[0]).to be_instance_of(Expressir::Model::Statements::Null)
1576
+ end
1577
+
1578
+ x.procedures.find{|x| x.id == "assignment_simple_reference_statement"}.statements[0].tap do |x|
1579
+ expect(x).to be_instance_of(Expressir::Model::Statements::Assignment)
1580
+ expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
1581
+ expect(x.ref.id).to eq("test")
1582
+ expect(x.expression).to be_instance_of(Expressir::Model::Literals::Logical)
1583
+ expect(x.expression.value).to eq(Expressir::Model::Literals::Logical::TRUE)
1584
+ end
1585
+
1586
+ x.procedures.find{|x| x.id == "assignment_group_reference_statement"}.statements[0].tap do |x|
1587
+ expect(x).to be_instance_of(Expressir::Model::Statements::Assignment)
1588
+ expect(x.ref).to be_instance_of(Expressir::Model::Expressions::GroupReference)
1589
+ expect(x.ref.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
1590
+ expect(x.ref.ref.id).to eq("test")
1591
+ expect(x.ref.entity).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
1592
+ expect(x.ref.entity.id).to eq("test2")
1593
+ expect(x.expression).to be_instance_of(Expressir::Model::Literals::Logical)
1594
+ expect(x.expression.value).to eq(Expressir::Model::Literals::Logical::TRUE)
1595
+ end
1596
+
1597
+ x.procedures.find{|x| x.id == "assignment_index_reference_statement"}.statements[0].tap do |x|
1598
+ expect(x).to be_instance_of(Expressir::Model::Statements::Assignment)
1599
+ expect(x.ref).to be_instance_of(Expressir::Model::Expressions::IndexReference)
1600
+ expect(x.ref.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
1601
+ expect(x.ref.ref.id).to eq("test")
1602
+ expect(x.ref.index1).to be_instance_of(Expressir::Model::Literals::Integer)
1603
+ expect(x.ref.index1.value).to eq("1")
1604
+ expect(x.expression).to be_instance_of(Expressir::Model::Literals::Logical)
1605
+ expect(x.expression.value).to eq(Expressir::Model::Literals::Logical::TRUE)
1606
+ end
1607
+
1608
+ x.procedures.find{|x| x.id == "assignment_index2_reference_statement"}.statements[0].tap do |x|
1609
+ expect(x).to be_instance_of(Expressir::Model::Statements::Assignment)
1610
+ expect(x.ref).to be_instance_of(Expressir::Model::Expressions::IndexReference)
1611
+ expect(x.ref.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
1612
+ expect(x.ref.ref.id).to eq("test")
1613
+ expect(x.ref.index1).to be_instance_of(Expressir::Model::Literals::Integer)
1614
+ expect(x.ref.index1.value).to eq("1")
1615
+ expect(x.ref.index2).to be_instance_of(Expressir::Model::Literals::Integer)
1616
+ expect(x.ref.index2.value).to eq("9")
1617
+ expect(x.expression).to be_instance_of(Expressir::Model::Literals::Logical)
1618
+ expect(x.expression.value).to eq(Expressir::Model::Literals::Logical::TRUE)
1619
+ end
1620
+
1621
+ x.procedures.find{|x| x.id == "assignment_attribute_reference_statement"}.statements[0].tap do |x|
1622
+ expect(x).to be_instance_of(Expressir::Model::Statements::Assignment)
1623
+ expect(x.ref).to be_instance_of(Expressir::Model::Expressions::AttributeReference)
1624
+ expect(x.ref.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
1625
+ expect(x.ref.ref.id).to eq("test")
1626
+ expect(x.ref.attribute).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
1627
+ expect(x.ref.attribute.id).to eq("test2")
1628
+ expect(x.expression).to be_instance_of(Expressir::Model::Literals::Logical)
1629
+ expect(x.expression.value).to eq(Expressir::Model::Literals::Logical::TRUE)
1630
+ end
1631
+
1632
+ x.procedures.find{|x| x.id == "case_statement"}.statements[0].tap do |x|
1633
+ expect(x).to be_instance_of(Expressir::Model::Statements::Case)
1634
+ expect(x.expression).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
1635
+ expect(x.expression.id).to eq("test")
1636
+ expect(x.actions).to be_instance_of(Array)
1637
+ expect(x.actions.count).to eq(1)
1638
+ expect(x.actions[0]).to be_instance_of(Expressir::Model::Statements::CaseAction)
1639
+ expect(x.actions[0].labels).to be_instance_of(Array)
1640
+ expect(x.actions[0].labels.count).to eq(1)
1641
+ expect(x.actions[0].labels[0]).to be_instance_of(Expressir::Model::Literals::Logical)
1642
+ expect(x.actions[0].labels[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
1643
+ expect(x.actions[0].statement).to be_instance_of(Expressir::Model::Statements::Null)
1644
+ end
1645
+
1646
+ x.procedures.find{|x| x.id == "case_multiple_statement"}.statements[0].tap do |x|
1647
+ expect(x).to be_instance_of(Expressir::Model::Statements::Case)
1648
+ expect(x.expression).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
1649
+ expect(x.expression.id).to eq("test")
1650
+ expect(x.actions).to be_instance_of(Array)
1651
+ expect(x.actions.count).to eq(2)
1652
+ expect(x.actions[0]).to be_instance_of(Expressir::Model::Statements::CaseAction)
1653
+ expect(x.actions[0].labels).to be_instance_of(Array)
1654
+ expect(x.actions[0].labels.count).to eq(1)
1655
+ expect(x.actions[0].labels[0]).to be_instance_of(Expressir::Model::Literals::Logical)
1656
+ expect(x.actions[0].labels[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
1657
+ expect(x.actions[0].statement).to be_instance_of(Expressir::Model::Statements::Null)
1658
+ expect(x.actions[1]).to be_instance_of(Expressir::Model::Statements::CaseAction)
1659
+ expect(x.actions[1].labels).to be_instance_of(Array)
1660
+ expect(x.actions[1].labels.count).to eq(1)
1661
+ expect(x.actions[1].labels[0]).to be_instance_of(Expressir::Model::Literals::Logical)
1662
+ expect(x.actions[1].labels[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
1663
+ expect(x.actions[1].statement).to be_instance_of(Expressir::Model::Statements::Null)
1664
+ end
1665
+
1666
+ x.procedures.find{|x| x.id == "case_multiple_shorthand_statement"}.statements[0].tap do |x|
1667
+ expect(x).to be_instance_of(Expressir::Model::Statements::Case)
1668
+ expect(x.expression).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
1669
+ expect(x.expression.id).to eq("test")
1670
+ expect(x.actions).to be_instance_of(Array)
1671
+ expect(x.actions.count).to eq(1)
1672
+ expect(x.actions[0]).to be_instance_of(Expressir::Model::Statements::CaseAction)
1673
+ expect(x.actions[0].labels).to be_instance_of(Array)
1674
+ expect(x.actions[0].labels.count).to eq(2)
1675
+ expect(x.actions[0].labels[0]).to be_instance_of(Expressir::Model::Literals::Logical)
1676
+ expect(x.actions[0].labels[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
1677
+ expect(x.actions[0].labels[1]).to be_instance_of(Expressir::Model::Literals::Logical)
1678
+ expect(x.actions[0].labels[1].value).to eq(Expressir::Model::Literals::Logical::TRUE)
1679
+ expect(x.actions[0].statement).to be_instance_of(Expressir::Model::Statements::Null)
1680
+ end
1681
+
1682
+ x.procedures.find{|x| x.id == "case_otherwise_statement"}.statements[0].tap do |x|
1683
+ expect(x).to be_instance_of(Expressir::Model::Statements::Case)
1684
+ expect(x.expression).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
1685
+ expect(x.expression.id).to eq("test")
1686
+ expect(x.actions).to be_instance_of(Array)
1687
+ expect(x.actions.count).to eq(1)
1688
+ expect(x.actions[0]).to be_instance_of(Expressir::Model::Statements::CaseAction)
1689
+ expect(x.actions[0].labels).to be_instance_of(Array)
1690
+ expect(x.actions[0].labels.count).to eq(1)
1691
+ expect(x.actions[0].labels[0]).to be_instance_of(Expressir::Model::Literals::Logical)
1692
+ expect(x.actions[0].labels[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
1693
+ expect(x.actions[0].statement).to be_instance_of(Expressir::Model::Statements::Null)
1694
+ expect(x.otherwise_statement).to be_instance_of(Expressir::Model::Statements::Null)
1695
+ end
1696
+
1697
+ x.procedures.find{|x| x.id == "compound_statement"}.statements[0].tap do |x|
1698
+ expect(x).to be_instance_of(Expressir::Model::Statements::Compound)
1699
+ expect(x.statements).to be_instance_of(Array)
1700
+ expect(x.statements.count).to eq(1)
1701
+ expect(x.statements[0]).to be_instance_of(Expressir::Model::Statements::Null)
1702
+ end
1703
+
1704
+ x.procedures.find{|x| x.id == "escape_statement"}.statements[0].tap do |x|
1705
+ expect(x).to be_instance_of(Expressir::Model::Statements::Escape)
1706
+ end
1707
+
1708
+ x.procedures.find{|x| x.id == "if_statement"}.statements[0].tap do |x|
1709
+ expect(x).to be_instance_of(Expressir::Model::Statements::If)
1710
+ expect(x.expression).to be_instance_of(Expressir::Model::Literals::Logical)
1711
+ expect(x.expression.value).to eq(Expressir::Model::Literals::Logical::TRUE)
1712
+ expect(x.statements).to be_instance_of(Array)
1713
+ expect(x.statements.count).to eq(1)
1714
+ expect(x.statements[0]).to be_instance_of(Expressir::Model::Statements::Null)
1715
+ end
1716
+
1717
+ x.procedures.find{|x| x.id == "if2_statement"}.statements[0].tap do |x|
1718
+ expect(x).to be_instance_of(Expressir::Model::Statements::If)
1719
+ expect(x.expression).to be_instance_of(Expressir::Model::Literals::Logical)
1720
+ expect(x.expression.value).to eq(Expressir::Model::Literals::Logical::TRUE)
1721
+ expect(x.statements).to be_instance_of(Array)
1722
+ expect(x.statements.count).to eq(2)
1723
+ expect(x.statements[0]).to be_instance_of(Expressir::Model::Statements::Null)
1724
+ expect(x.statements[1]).to be_instance_of(Expressir::Model::Statements::Null)
1725
+ end
1726
+
1727
+ x.procedures.find{|x| x.id == "if_else_statement"}.statements[0].tap do |x|
1728
+ expect(x).to be_instance_of(Expressir::Model::Statements::If)
1729
+ expect(x.expression).to be_instance_of(Expressir::Model::Literals::Logical)
1730
+ expect(x.expression.value).to eq(Expressir::Model::Literals::Logical::TRUE)
1731
+ expect(x.statements).to be_instance_of(Array)
1732
+ expect(x.statements.count).to eq(1)
1733
+ expect(x.statements[0]).to be_instance_of(Expressir::Model::Statements::Null)
1734
+ expect(x.else_statements).to be_instance_of(Array)
1735
+ expect(x.else_statements.count).to eq(1)
1736
+ expect(x.else_statements[0]).to be_instance_of(Expressir::Model::Statements::Null)
1737
+ end
1738
+
1739
+ x.procedures.find{|x| x.id == "if2_else_statement"}.statements[0].tap do |x|
1740
+ expect(x).to be_instance_of(Expressir::Model::Statements::If)
1741
+ expect(x.expression).to be_instance_of(Expressir::Model::Literals::Logical)
1742
+ expect(x.expression.value).to eq(Expressir::Model::Literals::Logical::TRUE)
1743
+ expect(x.statements).to be_instance_of(Array)
1744
+ expect(x.statements.count).to eq(2)
1745
+ expect(x.statements[0]).to be_instance_of(Expressir::Model::Statements::Null)
1746
+ expect(x.statements[1]).to be_instance_of(Expressir::Model::Statements::Null)
1747
+ expect(x.else_statements).to be_instance_of(Array)
1748
+ expect(x.else_statements.count).to eq(1)
1749
+ expect(x.else_statements[0]).to be_instance_of(Expressir::Model::Statements::Null)
1750
+ end
1751
+
1752
+ x.procedures.find{|x| x.id == "if_else2_statement"}.statements[0].tap do |x|
1753
+ expect(x).to be_instance_of(Expressir::Model::Statements::If)
1754
+ expect(x.expression).to be_instance_of(Expressir::Model::Literals::Logical)
1755
+ expect(x.expression.value).to eq(Expressir::Model::Literals::Logical::TRUE)
1756
+ expect(x.statements).to be_instance_of(Array)
1757
+ expect(x.statements.count).to eq(1)
1758
+ expect(x.statements[0]).to be_instance_of(Expressir::Model::Statements::Null)
1759
+ expect(x.else_statements).to be_instance_of(Array)
1760
+ expect(x.else_statements.count).to eq(2)
1761
+ expect(x.else_statements[0]).to be_instance_of(Expressir::Model::Statements::Null)
1762
+ expect(x.else_statements[1]).to be_instance_of(Expressir::Model::Statements::Null)
1763
+ end
1764
+
1765
+ x.procedures.find{|x| x.id == "if2_else2_statement"}.statements[0].tap do |x|
1766
+ expect(x).to be_instance_of(Expressir::Model::Statements::If)
1767
+ expect(x.expression).to be_instance_of(Expressir::Model::Literals::Logical)
1768
+ expect(x.expression.value).to eq(Expressir::Model::Literals::Logical::TRUE)
1769
+ expect(x.statements).to be_instance_of(Array)
1770
+ expect(x.statements.count).to eq(2)
1771
+ expect(x.statements[0]).to be_instance_of(Expressir::Model::Statements::Null)
1772
+ expect(x.statements[1]).to be_instance_of(Expressir::Model::Statements::Null)
1773
+ expect(x.else_statements).to be_instance_of(Array)
1774
+ expect(x.else_statements.count).to eq(2)
1775
+ expect(x.else_statements[0]).to be_instance_of(Expressir::Model::Statements::Null)
1776
+ expect(x.else_statements[1]).to be_instance_of(Expressir::Model::Statements::Null)
1777
+ end
1778
+
1779
+ x.procedures.find{|x| x.id == "null_statement"}.statements[0].tap do |x|
1780
+ expect(x).to be_instance_of(Expressir::Model::Statements::Null)
1781
+ end
1782
+
1783
+ x.procedures.find{|x| x.id == "call_statement"}.statements[0].tap do |x|
1784
+ expect(x).to be_instance_of(Expressir::Model::Statements::Call)
1785
+ expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
1786
+ expect(x.ref.id).to eq("empty_procedure")
1787
+ end
1788
+
1789
+ x.procedures.find{|x| x.id == "call_parameter_statement"}.statements[0].tap do |x|
1790
+ expect(x).to be_instance_of(Expressir::Model::Statements::Call)
1791
+ expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
1792
+ expect(x.ref.id).to eq("empty_procedure")
1793
+ expect(x.parameters).to be_instance_of(Array)
1794
+ expect(x.parameters.count).to eq(1)
1795
+ expect(x.parameters[0]).to be_instance_of(Expressir::Model::Literals::Logical)
1796
+ expect(x.parameters[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
1797
+ end
1798
+
1799
+ x.procedures.find{|x| x.id == "call_parameter2_statement"}.statements[0].tap do |x|
1800
+ expect(x).to be_instance_of(Expressir::Model::Statements::Call)
1801
+ expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
1802
+ expect(x.ref.id).to eq("empty_procedure")
1803
+ expect(x.parameters).to be_instance_of(Array)
1804
+ expect(x.parameters.count).to eq(2)
1805
+ expect(x.parameters[0]).to be_instance_of(Expressir::Model::Literals::Logical)
1806
+ expect(x.parameters[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
1807
+ expect(x.parameters[1]).to be_instance_of(Expressir::Model::Literals::Logical)
1808
+ expect(x.parameters[1].value).to eq(Expressir::Model::Literals::Logical::TRUE)
1809
+ end
1810
+
1811
+ x.procedures.find{|x| x.id == "call_insert_statement"}.statements[0].tap do |x|
1812
+ expect(x).to be_instance_of(Expressir::Model::Statements::Call)
1813
+ expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
1814
+ expect(x.ref.id).to eq("INSERT")
1815
+ expect(x.parameters).to be_instance_of(Array)
1816
+ expect(x.parameters.count).to eq(1)
1817
+ expect(x.parameters[0]).to be_instance_of(Expressir::Model::Literals::Logical)
1818
+ expect(x.parameters[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
1819
+ end
1820
+
1821
+ x.procedures.find{|x| x.id == "call_remove_statement"}.statements[0].tap do |x|
1822
+ expect(x).to be_instance_of(Expressir::Model::Statements::Call)
1823
+ expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
1824
+ expect(x.ref.id).to eq("REMOVE")
1825
+ expect(x.parameters).to be_instance_of(Array)
1826
+ expect(x.parameters.count).to eq(1)
1827
+ expect(x.parameters[0]).to be_instance_of(Expressir::Model::Literals::Logical)
1828
+ expect(x.parameters[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
1829
+ end
1830
+
1831
+ x.procedures.find{|x| x.id == "repeat_statement"}.statements[0].tap do |x|
1832
+ expect(x).to be_instance_of(Expressir::Model::Statements::Repeat)
1833
+ expect(x.statements).to be_instance_of(Array)
1834
+ expect(x.statements.count).to eq(1)
1835
+ expect(x.statements[0]).to be_instance_of(Expressir::Model::Statements::Null)
1836
+ end
1837
+
1838
+ x.procedures.find{|x| x.id == "repeat_variable_statement"}.statements[0].tap do |x|
1839
+ expect(x).to be_instance_of(Expressir::Model::Statements::Repeat)
1840
+ expect(x.id).to eq("test")
1841
+ expect(x.bound1).to be_instance_of(Expressir::Model::Literals::Integer)
1842
+ expect(x.bound1.value).to eq("1")
1843
+ expect(x.bound2).to be_instance_of(Expressir::Model::Literals::Integer)
1844
+ expect(x.bound2.value).to eq("9")
1845
+ expect(x.statements).to be_instance_of(Array)
1846
+ expect(x.statements.count).to eq(1)
1847
+ expect(x.statements[0]).to be_instance_of(Expressir::Model::Statements::Null)
1848
+ end
1849
+
1850
+ x.procedures.find{|x| x.id == "repeat_variable_increment_statement"}.statements[0].tap do |x|
1851
+ expect(x).to be_instance_of(Expressir::Model::Statements::Repeat)
1852
+ expect(x.id).to eq("test")
1853
+ expect(x.bound1).to be_instance_of(Expressir::Model::Literals::Integer)
1854
+ expect(x.bound1.value).to eq("1")
1855
+ expect(x.bound2).to be_instance_of(Expressir::Model::Literals::Integer)
1856
+ expect(x.bound2.value).to eq("9")
1857
+ expect(x.increment).to be_instance_of(Expressir::Model::Literals::Integer)
1858
+ expect(x.increment.value).to eq("2")
1859
+ expect(x.statements).to be_instance_of(Array)
1860
+ expect(x.statements.count).to eq(1)
1861
+ expect(x.statements[0]).to be_instance_of(Expressir::Model::Statements::Null)
1862
+ end
1863
+
1864
+ x.procedures.find{|x| x.id == "repeat_while_statement"}.statements[0].tap do |x|
1865
+ expect(x).to be_instance_of(Expressir::Model::Statements::Repeat)
1866
+ expect(x.while_expression).to be_instance_of(Expressir::Model::Literals::Logical)
1867
+ expect(x.while_expression.value).to eq(Expressir::Model::Literals::Logical::TRUE)
1868
+ expect(x.statements).to be_instance_of(Array)
1869
+ expect(x.statements.count).to eq(1)
1870
+ expect(x.statements[0]).to be_instance_of(Expressir::Model::Statements::Null)
1871
+ end
1872
+
1873
+ x.procedures.find{|x| x.id == "repeat_until_statement"}.statements[0].tap do |x|
1874
+ expect(x).to be_instance_of(Expressir::Model::Statements::Repeat)
1875
+ expect(x.until_expression).to be_instance_of(Expressir::Model::Literals::Logical)
1876
+ expect(x.until_expression.value).to eq(Expressir::Model::Literals::Logical::TRUE)
1877
+ expect(x.statements).to be_instance_of(Array)
1878
+ expect(x.statements.count).to eq(1)
1879
+ expect(x.statements[0]).to be_instance_of(Expressir::Model::Statements::Null)
1880
+ end
1881
+
1882
+ x.procedures.find{|x| x.id == "return_statement"}.statements[0].tap do |x|
1883
+ expect(x).to be_instance_of(Expressir::Model::Statements::Return)
1884
+ end
1885
+
1886
+ x.procedures.find{|x| x.id == "return_expression_statement"}.statements[0].tap do |x|
1887
+ expect(x).to be_instance_of(Expressir::Model::Statements::Return)
1888
+ expect(x.expression).to be_instance_of(Expressir::Model::Literals::Logical)
1889
+ expect(x.expression.value).to eq(Expressir::Model::Literals::Logical::TRUE)
1890
+ end
1891
+
1892
+ x.procedures.find{|x| x.id == "skip_statement"}.statements[0].tap do |x|
1893
+ expect(x).to be_instance_of(Expressir::Model::Statements::Skip)
1894
+ end
1895
+ end
1896
+
1897
+ procedures.find{|x| x.id == "types"}.tap do |x|
1898
+ # simple types
1899
+ x.types.find{|x| x.id == "binary_type"}.type.tap do |x|
1900
+ expect(x).to be_instance_of(Expressir::Model::Types::Binary)
1901
+ end
1902
+
1903
+ x.types.find{|x| x.id == "binary_width_type"}.type.tap do |x|
1904
+ expect(x).to be_instance_of(Expressir::Model::Types::Binary)
1905
+ expect(x.width).to be_instance_of(Expressir::Model::Literals::Integer)
1906
+ expect(x.width.value).to eq("3")
1907
+ end
1908
+
1909
+ x.types.find{|x| x.id == "binary_width_fixed_type"}.type.tap do |x|
1910
+ expect(x).to be_instance_of(Expressir::Model::Types::Binary)
1911
+ expect(x.width).to be_instance_of(Expressir::Model::Literals::Integer)
1912
+ expect(x.width.value).to eq("3")
1913
+ expect(x.fixed).to eq(true)
1914
+ end
1915
+
1916
+ x.types.find{|x| x.id == "boolean_type"}.type.tap do |x|
1917
+ expect(x).to be_instance_of(Expressir::Model::Types::Boolean)
1918
+ end
1919
+
1920
+ x.types.find{|x| x.id == "integer_type"}.type.tap do |x|
1921
+ expect(x).to be_instance_of(Expressir::Model::Types::Integer)
1922
+ end
1923
+
1924
+ x.types.find{|x| x.id == "logical_type"}.type.tap do |x|
1925
+ expect(x).to be_instance_of(Expressir::Model::Types::Logical)
1926
+ end
1927
+
1928
+ x.types.find{|x| x.id == "number_type"}.type.tap do |x|
1929
+ expect(x).to be_instance_of(Expressir::Model::Types::Number)
1930
+ end
1931
+
1932
+ x.types.find{|x| x.id == "real_type"}.type.tap do |x|
1933
+ expect(x).to be_instance_of(Expressir::Model::Types::Real)
1934
+ end
1935
+
1936
+ x.types.find{|x| x.id == "real_precision_type"}.type.tap do |x|
1937
+ expect(x).to be_instance_of(Expressir::Model::Types::Real)
1938
+ expect(x.precision).to be_instance_of(Expressir::Model::Literals::Integer)
1939
+ expect(x.precision.value).to eq("3")
1940
+ end
1941
+
1942
+ x.types.find{|x| x.id == "string_type"}.type.tap do |x|
1943
+ expect(x).to be_instance_of(Expressir::Model::Types::String)
1944
+ end
1945
+
1946
+ x.types.find{|x| x.id == "string_width_type"}.type.tap do |x|
1947
+ expect(x).to be_instance_of(Expressir::Model::Types::String)
1948
+ expect(x.width).to be_instance_of(Expressir::Model::Literals::Integer)
1949
+ expect(x.width.value).to eq("3")
1950
+ end
1951
+
1952
+ x.types.find{|x| x.id == "string_width_fixed_type"}.type.tap do |x|
1953
+ expect(x).to be_instance_of(Expressir::Model::Types::String)
1954
+ expect(x.width).to be_instance_of(Expressir::Model::Literals::Integer)
1955
+ expect(x.width.value).to eq("3")
1956
+ expect(x.fixed).to eq(true)
1957
+ end
1958
+
1959
+ # aggregation types
1960
+ x.types.find{|x| x.id == "array_type"}.type.tap do |x|
1961
+ expect(x).to be_instance_of(Expressir::Model::Types::Array)
1962
+ expect(x.bound1).to be_instance_of(Expressir::Model::Literals::Integer)
1963
+ expect(x.bound1.value).to eq("1")
1964
+ expect(x.bound2).to be_instance_of(Expressir::Model::Literals::Integer)
1965
+ expect(x.bound2.value).to eq("9")
1966
+ expect(x.base_type).to be_instance_of(Expressir::Model::Types::String)
1967
+ end
1968
+
1969
+ x.types.find{|x| x.id == "array_optional_type"}.type.tap do |x|
1970
+ expect(x).to be_instance_of(Expressir::Model::Types::Array)
1971
+ expect(x.bound1).to be_instance_of(Expressir::Model::Literals::Integer)
1972
+ expect(x.bound1.value).to eq("1")
1973
+ expect(x.bound2).to be_instance_of(Expressir::Model::Literals::Integer)
1974
+ expect(x.bound2.value).to eq("9")
1975
+ expect(x.optional).to eq(true)
1976
+ expect(x.base_type).to be_instance_of(Expressir::Model::Types::String)
1977
+ end
1978
+
1979
+ x.types.find{|x| x.id == "array_unique_type"}.type.tap do |x|
1980
+ expect(x).to be_instance_of(Expressir::Model::Types::Array)
1981
+ expect(x.bound1).to be_instance_of(Expressir::Model::Literals::Integer)
1982
+ expect(x.bound1.value).to eq("1")
1983
+ expect(x.bound2).to be_instance_of(Expressir::Model::Literals::Integer)
1984
+ expect(x.bound2.value).to eq("9")
1985
+ expect(x.unique).to eq(true)
1986
+ expect(x.base_type).to be_instance_of(Expressir::Model::Types::String)
1987
+ end
1988
+
1989
+ x.types.find{|x| x.id == "array_optional_unique_type"}.type.tap do |x|
1990
+ expect(x).to be_instance_of(Expressir::Model::Types::Array)
1991
+ expect(x.bound1).to be_instance_of(Expressir::Model::Literals::Integer)
1992
+ expect(x.bound1.value).to eq("1")
1993
+ expect(x.bound2).to be_instance_of(Expressir::Model::Literals::Integer)
1994
+ expect(x.bound2.value).to eq("9")
1995
+ expect(x.optional).to eq(true)
1996
+ expect(x.unique).to eq(true)
1997
+ expect(x.base_type).to be_instance_of(Expressir::Model::Types::String)
1998
+ end
1999
+
2000
+ x.types.find{|x| x.id == "bag_type"}.type.tap do |x|
2001
+ expect(x).to be_instance_of(Expressir::Model::Types::Bag)
2002
+ expect(x.base_type).to be_instance_of(Expressir::Model::Types::String)
2003
+ end
2004
+
2005
+ x.types.find{|x| x.id == "bag_bound_type"}.type.tap do |x|
2006
+ expect(x).to be_instance_of(Expressir::Model::Types::Bag)
2007
+ expect(x.bound1).to be_instance_of(Expressir::Model::Literals::Integer)
2008
+ expect(x.bound1.value).to eq("1")
2009
+ expect(x.bound2).to be_instance_of(Expressir::Model::Literals::Integer)
2010
+ expect(x.bound2.value).to eq("9")
2011
+ expect(x.base_type).to be_instance_of(Expressir::Model::Types::String)
2012
+ end
2013
+
2014
+ x.types.find{|x| x.id == "list_type"}.type.tap do |x|
2015
+ expect(x).to be_instance_of(Expressir::Model::Types::List)
2016
+ expect(x.base_type).to be_instance_of(Expressir::Model::Types::String)
2017
+ end
2018
+
2019
+ x.types.find{|x| x.id == "list_bound_type"}.type.tap do |x|
2020
+ expect(x).to be_instance_of(Expressir::Model::Types::List)
2021
+ expect(x.bound1).to be_instance_of(Expressir::Model::Literals::Integer)
2022
+ expect(x.bound1.value).to eq("1")
2023
+ expect(x.bound2).to be_instance_of(Expressir::Model::Literals::Integer)
2024
+ expect(x.bound2.value).to eq("9")
2025
+ expect(x.base_type).to be_instance_of(Expressir::Model::Types::String)
2026
+ end
2027
+
2028
+ x.types.find{|x| x.id == "list_unique_type"}.type.tap do |x|
2029
+ expect(x).to be_instance_of(Expressir::Model::Types::List)
2030
+ expect(x.unique).to eq(true)
2031
+ expect(x.base_type).to be_instance_of(Expressir::Model::Types::String)
2032
+ end
2033
+
2034
+ x.types.find{|x| x.id == "list_bound_unique_type"}.type.tap do |x|
2035
+ expect(x).to be_instance_of(Expressir::Model::Types::List)
2036
+ expect(x.bound1).to be_instance_of(Expressir::Model::Literals::Integer)
2037
+ expect(x.bound1.value).to eq("1")
2038
+ expect(x.bound2).to be_instance_of(Expressir::Model::Literals::Integer)
2039
+ expect(x.bound2.value).to eq("9")
2040
+ expect(x.unique).to eq(true)
2041
+ expect(x.base_type).to be_instance_of(Expressir::Model::Types::String)
2042
+ end
2043
+
2044
+ x.types.find{|x| x.id == "set_type"}.type.tap do |x|
2045
+ expect(x).to be_instance_of(Expressir::Model::Types::Set)
2046
+ expect(x.base_type).to be_instance_of(Expressir::Model::Types::String)
2047
+ end
2048
+
2049
+ x.types.find{|x| x.id == "set_bound_type"}.type.tap do |x|
2050
+ expect(x).to be_instance_of(Expressir::Model::Types::Set)
2051
+ expect(x.bound1).to be_instance_of(Expressir::Model::Literals::Integer)
2052
+ expect(x.bound1.value).to eq("1")
2053
+ expect(x.bound2).to be_instance_of(Expressir::Model::Literals::Integer)
2054
+ expect(x.bound2.value).to eq("9")
2055
+ expect(x.base_type).to be_instance_of(Expressir::Model::Types::String)
2056
+ end
2057
+
2058
+ # constructed types
2059
+ x.types.find{|x| x.id == "select_type"}.type.tap do |x|
2060
+ expect(x).to be_instance_of(Expressir::Model::Types::Select)
2061
+ end
2062
+
2063
+ x.types.find{|x| x.id == "select_extensible_type"}.type.tap do |x|
2064
+ expect(x).to be_instance_of(Expressir::Model::Types::Select)
2065
+ expect(x.extensible).to eq(true)
2066
+ end
2067
+
2068
+ x.types.find{|x| x.id == "select_extensible_generic_entity_type"}.type.tap do |x|
2069
+ expect(x).to be_instance_of(Expressir::Model::Types::Select)
2070
+ expect(x.extensible).to eq(true)
2071
+ expect(x.generic_entity).to eq(true)
2072
+ end
2073
+
2074
+ x.types.find{|x| x.id == "select_list_type"}.type.tap do |x|
2075
+ expect(x).to be_instance_of(Expressir::Model::Types::Select)
2076
+ expect(x.items).to be_instance_of(Array)
2077
+ expect(x.items.count).to eq(1)
2078
+ expect(x.items[0]).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2079
+ expect(x.items[0].id).to eq("empty_type")
2080
+ end
2081
+
2082
+ x.types.find{|x| x.id == "select_extension_type_ref_type"}.type.tap do |x|
2083
+ expect(x).to be_instance_of(Expressir::Model::Types::Select)
2084
+ expect(x.extension_type).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2085
+ expect(x.extension_type.id).to eq("select_type")
2086
+ end
2087
+
2088
+ x.types.find{|x| x.id == "select_extension_type_ref_list_type"}.type.tap do |x|
2089
+ expect(x).to be_instance_of(Expressir::Model::Types::Select)
2090
+ expect(x.extension_type).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2091
+ expect(x.extension_type.id).to eq("select_type")
2092
+ expect(x.extension_items).to be_instance_of(Array)
2093
+ expect(x.extension_items.count).to eq(1)
2094
+ expect(x.extension_items[0]).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2095
+ expect(x.extension_items[0].id).to eq("empty_type")
2096
+ end
2097
+
2098
+ x.types.find{|x| x.id == "enumeration_type"}.type.tap do |x|
2099
+ expect(x).to be_instance_of(Expressir::Model::Types::Enumeration)
2100
+ end
2101
+
2102
+ x.types.find{|x| x.id == "enumeration_extensible_type"}.type.tap do |x|
2103
+ expect(x).to be_instance_of(Expressir::Model::Types::Enumeration)
2104
+ expect(x.extensible).to eq(true)
2105
+ end
2106
+
2107
+ x.types.find{|x| x.id == "enumeration_list_type"}.type.tap do |x|
2108
+ expect(x).to be_instance_of(Expressir::Model::Types::Enumeration)
2109
+ expect(x.items).to be_instance_of(Array)
2110
+ expect(x.items.count).to eq(1)
2111
+ expect(x.items[0]).to be_instance_of(Expressir::Model::EnumerationItem)
2112
+ expect(x.items[0].id).to eq("test")
2113
+ end
2114
+
2115
+ x.types.find{|x| x.id == "enumeration_extension_type_ref_type"}.type.tap do |x|
2116
+ expect(x).to be_instance_of(Expressir::Model::Types::Enumeration)
2117
+ expect(x.extension_type).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2118
+ expect(x.extension_type.id).to eq("enumeration_type")
2119
+ end
2120
+
2121
+ x.types.find{|x| x.id == "enumeration_extension_type_ref_list_type"}.type.tap do |x|
2122
+ expect(x).to be_instance_of(Expressir::Model::Types::Enumeration)
2123
+ expect(x.extension_type).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2124
+ expect(x.extension_type.id).to eq("enumeration_type")
2125
+ expect(x.extension_items).to be_instance_of(Array)
2126
+ expect(x.extension_items[0]).to be_instance_of(Expressir::Model::EnumerationItem)
2127
+ expect(x.extension_items[0].id).to eq("test")
2128
+ end
2129
+ end
2130
+
2131
+ procedures.find{|x| x.id == "expressions"}.tap do |x|
2132
+ # literal expressions
2133
+ x.variables.find{|x| x.id == "binary_expression"}.expression.tap do |x|
2134
+ expect(x).to be_instance_of(Expressir::Model::Literals::Binary)
2135
+ expect(x.value).to eq("011110000111100001111000")
2136
+ end
2137
+
2138
+ x.variables.find{|x| x.id == "integer_expression"}.expression.tap do |x|
2139
+ expect(x).to be_instance_of(Expressir::Model::Literals::Integer)
2140
+ expect(x.value).to eq("999")
2141
+ end
2142
+
2143
+ x.variables.find{|x| x.id == "true_logical_expression"}.expression.tap do |x|
2144
+ expect(x).to be_instance_of(Expressir::Model::Literals::Logical)
2145
+ expect(x.value).to eq(Expressir::Model::Literals::Logical::TRUE)
2146
+ end
2147
+
2148
+ x.variables.find{|x| x.id == "false_logical_expression"}.expression.tap do |x|
2149
+ expect(x).to be_instance_of(Expressir::Model::Literals::Logical)
2150
+ expect(x.value).to eq(Expressir::Model::Literals::Logical::FALSE)
2151
+ end
2152
+
2153
+ x.variables.find{|x| x.id == "unknown_logical_expression"}.expression.tap do |x|
2154
+ expect(x).to be_instance_of(Expressir::Model::Literals::Logical)
2155
+ expect(x.value).to eq(Expressir::Model::Literals::Logical::UNKNOWN)
2156
+ end
2157
+
2158
+ x.variables.find{|x| x.id == "real_expression"}.expression.tap do |x|
2159
+ expect(x).to be_instance_of(Expressir::Model::Literals::Real)
2160
+ expect(x.value).to eq("999.999")
2161
+ end
2162
+
2163
+ x.variables.find{|x| x.id == "simple_string_expression"}.expression.tap do |x|
2164
+ expect(x).to be_instance_of(Expressir::Model::Literals::String)
2165
+ expect(x.value).to eq("xxx")
2166
+ end
2167
+
2168
+ x.variables.find{|x| x.id == "utf8_simple_string_expression"}.expression.tap do |x|
2169
+ expect(x).to be_instance_of(Expressir::Model::Literals::String)
2170
+ expect(x.value).to eq("UTF8 test: Příliš žluťoučký kůň úpěl ďábelské ódy.")
2171
+ end
2172
+
2173
+ x.variables.find{|x| x.id == "encoded_string_expression"}.expression.tap do |x|
2174
+ expect(x).to be_instance_of(Expressir::Model::Literals::String)
2175
+ expect(x.value).to eq("000000780000007800000078")
2176
+ expect(x.encoded).to eq(true)
2177
+ end
2178
+
2179
+ # constant expressions
2180
+ x.variables.find{|x| x.id == "const_e_expression"}.expression.tap do |x|
2181
+ expect(x).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2182
+ expect(x.id).to eq("CONST_E")
2183
+ end
2184
+
2185
+ x.variables.find{|x| x.id == "indeterminate_expression"}.expression.tap do |x|
2186
+ expect(x).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2187
+ expect(x.id).to eq("?")
2188
+ end
2189
+
2190
+ x.variables.find{|x| x.id == "pi_expression"}.expression.tap do |x|
2191
+ expect(x).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2192
+ expect(x.id).to eq("PI")
2193
+ end
2194
+
2195
+ x.variables.find{|x| x.id == "self_expression"}.expression.tap do |x|
2196
+ expect(x).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2197
+ expect(x.id).to eq("SELF")
2198
+ end
2199
+
2200
+ # function expressions
2201
+ x.variables.find{|x| x.id == "abs_expression"}.expression.tap do |x|
2202
+ expect(x).to be_instance_of(Expressir::Model::Expressions::Call)
2203
+ expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2204
+ expect(x.ref.id).to eq("ABS")
2205
+ expect(x.parameters).to be_instance_of(Array)
2206
+ expect(x.parameters.count).to eq(1)
2207
+ expect(x.parameters[0]).to be_instance_of(Expressir::Model::Literals::Logical)
2208
+ expect(x.parameters[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
2209
+ end
2210
+
2211
+ x.variables.find{|x| x.id == "acos_expression"}.expression.tap do |x|
2212
+ expect(x).to be_instance_of(Expressir::Model::Expressions::Call)
2213
+ expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2214
+ expect(x.ref.id).to eq("ACOS")
2215
+ expect(x.parameters).to be_instance_of(Array)
2216
+ expect(x.parameters.count).to eq(1)
2217
+ expect(x.parameters[0]).to be_instance_of(Expressir::Model::Literals::Logical)
2218
+ expect(x.parameters[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
2219
+ end
2220
+
2221
+ x.variables.find{|x| x.id == "asin_expression"}.expression.tap do |x|
2222
+ expect(x).to be_instance_of(Expressir::Model::Expressions::Call)
2223
+ expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2224
+ expect(x.ref.id).to eq("ASIN")
2225
+ expect(x.parameters).to be_instance_of(Array)
2226
+ expect(x.parameters.count).to eq(1)
2227
+ expect(x.parameters[0]).to be_instance_of(Expressir::Model::Literals::Logical)
2228
+ expect(x.parameters[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
2229
+ end
2230
+
2231
+ x.variables.find{|x| x.id == "atan_expression"}.expression.tap do |x|
2232
+ expect(x).to be_instance_of(Expressir::Model::Expressions::Call)
2233
+ expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2234
+ expect(x.ref.id).to eq("ATAN")
2235
+ expect(x.parameters).to be_instance_of(Array)
2236
+ expect(x.parameters.count).to eq(1)
2237
+ expect(x.parameters[0]).to be_instance_of(Expressir::Model::Literals::Logical)
2238
+ expect(x.parameters[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
2239
+ end
2240
+
2241
+ x.variables.find{|x| x.id == "blength_expression"}.expression.tap do |x|
2242
+ expect(x).to be_instance_of(Expressir::Model::Expressions::Call)
2243
+ expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2244
+ expect(x.ref.id).to eq("BLENGTH")
2245
+ expect(x.parameters).to be_instance_of(Array)
2246
+ expect(x.parameters.count).to eq(1)
2247
+ expect(x.parameters[0]).to be_instance_of(Expressir::Model::Literals::Logical)
2248
+ expect(x.parameters[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
2249
+ end
2250
+
2251
+ x.variables.find{|x| x.id == "cos_expression"}.expression.tap do |x|
2252
+ expect(x).to be_instance_of(Expressir::Model::Expressions::Call)
2253
+ expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2254
+ expect(x.ref.id).to eq("COS")
2255
+ expect(x.parameters).to be_instance_of(Array)
2256
+ expect(x.parameters.count).to eq(1)
2257
+ expect(x.parameters[0]).to be_instance_of(Expressir::Model::Literals::Logical)
2258
+ expect(x.parameters[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
2259
+ end
2260
+
2261
+ x.variables.find{|x| x.id == "exists_expression"}.expression.tap do |x|
2262
+ expect(x).to be_instance_of(Expressir::Model::Expressions::Call)
2263
+ expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2264
+ expect(x.ref.id).to eq("EXISTS")
2265
+ expect(x.parameters).to be_instance_of(Array)
2266
+ expect(x.parameters.count).to eq(1)
2267
+ expect(x.parameters[0]).to be_instance_of(Expressir::Model::Literals::Logical)
2268
+ expect(x.parameters[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
2269
+ end
2270
+
2271
+ x.variables.find{|x| x.id == "exp_expression"}.expression.tap do |x|
2272
+ expect(x).to be_instance_of(Expressir::Model::Expressions::Call)
2273
+ expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2274
+ expect(x.ref.id).to eq("EXP")
2275
+ expect(x.parameters).to be_instance_of(Array)
2276
+ expect(x.parameters.count).to eq(1)
2277
+ expect(x.parameters[0]).to be_instance_of(Expressir::Model::Literals::Logical)
2278
+ expect(x.parameters[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
2279
+ end
2280
+
2281
+ x.variables.find{|x| x.id == "format_expression"}.expression.tap do |x|
2282
+ expect(x).to be_instance_of(Expressir::Model::Expressions::Call)
2283
+ expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2284
+ expect(x.ref.id).to eq("FORMAT")
2285
+ expect(x.parameters).to be_instance_of(Array)
2286
+ expect(x.parameters.count).to eq(1)
2287
+ expect(x.parameters[0]).to be_instance_of(Expressir::Model::Literals::Logical)
2288
+ expect(x.parameters[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
2289
+ end
2290
+
2291
+ x.variables.find{|x| x.id == "hibound_expression"}.expression.tap do |x|
2292
+ expect(x).to be_instance_of(Expressir::Model::Expressions::Call)
2293
+ expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2294
+ expect(x.ref.id).to eq("HIBOUND")
2295
+ expect(x.parameters).to be_instance_of(Array)
2296
+ expect(x.parameters.count).to eq(1)
2297
+ expect(x.parameters[0]).to be_instance_of(Expressir::Model::Literals::Logical)
2298
+ expect(x.parameters[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
2299
+ end
2300
+
2301
+ x.variables.find{|x| x.id == "hiindex_expression"}.expression.tap do |x|
2302
+ expect(x).to be_instance_of(Expressir::Model::Expressions::Call)
2303
+ expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2304
+ expect(x.ref.id).to eq("HIINDEX")
2305
+ expect(x.parameters).to be_instance_of(Array)
2306
+ expect(x.parameters.count).to eq(1)
2307
+ expect(x.parameters[0]).to be_instance_of(Expressir::Model::Literals::Logical)
2308
+ expect(x.parameters[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
2309
+ end
2310
+
2311
+ x.variables.find{|x| x.id == "length_expression"}.expression.tap do |x|
2312
+ expect(x).to be_instance_of(Expressir::Model::Expressions::Call)
2313
+ expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2314
+ expect(x.ref.id).to eq("LENGTH")
2315
+ expect(x.parameters).to be_instance_of(Array)
2316
+ expect(x.parameters.count).to eq(1)
2317
+ expect(x.parameters[0]).to be_instance_of(Expressir::Model::Literals::Logical)
2318
+ expect(x.parameters[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
2319
+ end
2320
+
2321
+ x.variables.find{|x| x.id == "lobound_expression"}.expression.tap do |x|
2322
+ expect(x).to be_instance_of(Expressir::Model::Expressions::Call)
2323
+ expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2324
+ expect(x.ref.id).to eq("LOBOUND")
2325
+ expect(x.parameters).to be_instance_of(Array)
2326
+ expect(x.parameters.count).to eq(1)
2327
+ expect(x.parameters[0]).to be_instance_of(Expressir::Model::Literals::Logical)
2328
+ expect(x.parameters[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
2329
+ end
2330
+
2331
+ x.variables.find{|x| x.id == "loindex_expression"}.expression.tap do |x|
2332
+ expect(x).to be_instance_of(Expressir::Model::Expressions::Call)
2333
+ expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2334
+ expect(x.ref.id).to eq("LOINDEX")
2335
+ expect(x.parameters).to be_instance_of(Array)
2336
+ expect(x.parameters.count).to eq(1)
2337
+ expect(x.parameters[0]).to be_instance_of(Expressir::Model::Literals::Logical)
2338
+ expect(x.parameters[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
2339
+ end
2340
+
2341
+ x.variables.find{|x| x.id == "log_expression"}.expression.tap do |x|
2342
+ expect(x).to be_instance_of(Expressir::Model::Expressions::Call)
2343
+ expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2344
+ expect(x.ref.id).to eq("LOG")
2345
+ expect(x.parameters).to be_instance_of(Array)
2346
+ expect(x.parameters.count).to eq(1)
2347
+ expect(x.parameters[0]).to be_instance_of(Expressir::Model::Literals::Logical)
2348
+ expect(x.parameters[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
2349
+ end
2350
+
2351
+ x.variables.find{|x| x.id == "log2_expression"}.expression.tap do |x|
2352
+ expect(x).to be_instance_of(Expressir::Model::Expressions::Call)
2353
+ expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2354
+ expect(x.ref.id).to eq("LOG2")
2355
+ expect(x.parameters).to be_instance_of(Array)
2356
+ expect(x.parameters.count).to eq(1)
2357
+ expect(x.parameters[0]).to be_instance_of(Expressir::Model::Literals::Logical)
2358
+ expect(x.parameters[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
2359
+ end
2360
+
2361
+ x.variables.find{|x| x.id == "log10_expression"}.expression.tap do |x|
2362
+ expect(x).to be_instance_of(Expressir::Model::Expressions::Call)
2363
+ expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2364
+ expect(x.ref.id).to eq("LOG10")
2365
+ expect(x.parameters).to be_instance_of(Array)
2366
+ expect(x.parameters.count).to eq(1)
2367
+ expect(x.parameters[0]).to be_instance_of(Expressir::Model::Literals::Logical)
2368
+ expect(x.parameters[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
2369
+ end
2370
+
2371
+ x.variables.find{|x| x.id == "nvl_expression"}.expression.tap do |x|
2372
+ expect(x).to be_instance_of(Expressir::Model::Expressions::Call)
2373
+ expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2374
+ expect(x.ref.id).to eq("NVL")
2375
+ expect(x.parameters).to be_instance_of(Array)
2376
+ expect(x.parameters.count).to eq(1)
2377
+ expect(x.parameters[0]).to be_instance_of(Expressir::Model::Literals::Logical)
2378
+ expect(x.parameters[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
2379
+ end
2380
+
2381
+ x.variables.find{|x| x.id == "odd_expression"}.expression.tap do |x|
2382
+ expect(x).to be_instance_of(Expressir::Model::Expressions::Call)
2383
+ expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2384
+ expect(x.ref.id).to eq("ODD")
2385
+ expect(x.parameters).to be_instance_of(Array)
2386
+ expect(x.parameters.count).to eq(1)
2387
+ expect(x.parameters[0]).to be_instance_of(Expressir::Model::Literals::Logical)
2388
+ expect(x.parameters[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
2389
+ end
2390
+
2391
+ x.variables.find{|x| x.id == "rolesof_expression"}.expression.tap do |x|
2392
+ expect(x).to be_instance_of(Expressir::Model::Expressions::Call)
2393
+ expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2394
+ expect(x.ref.id).to eq("ROLESOF")
2395
+ expect(x.parameters).to be_instance_of(Array)
2396
+ expect(x.parameters.count).to eq(1)
2397
+ expect(x.parameters[0]).to be_instance_of(Expressir::Model::Literals::Logical)
2398
+ expect(x.parameters[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
2399
+ end
2400
+
2401
+ x.variables.find{|x| x.id == "sin_expression"}.expression.tap do |x|
2402
+ expect(x).to be_instance_of(Expressir::Model::Expressions::Call)
2403
+ expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2404
+ expect(x.ref.id).to eq("SIN")
2405
+ expect(x.parameters).to be_instance_of(Array)
2406
+ expect(x.parameters.count).to eq(1)
2407
+ expect(x.parameters[0]).to be_instance_of(Expressir::Model::Literals::Logical)
2408
+ expect(x.parameters[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
2409
+ end
2410
+
2411
+ x.variables.find{|x| x.id == "sizeof_expression"}.expression.tap do |x|
2412
+ expect(x).to be_instance_of(Expressir::Model::Expressions::Call)
2413
+ expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2414
+ expect(x.ref.id).to eq("SIZEOF")
2415
+ expect(x.parameters).to be_instance_of(Array)
2416
+ expect(x.parameters.count).to eq(1)
2417
+ expect(x.parameters[0]).to be_instance_of(Expressir::Model::Literals::Logical)
2418
+ expect(x.parameters[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
2419
+ end
2420
+
2421
+ x.variables.find{|x| x.id == "sqrt_expression"}.expression.tap do |x|
2422
+ expect(x).to be_instance_of(Expressir::Model::Expressions::Call)
2423
+ expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2424
+ expect(x.ref.id).to eq("SQRT")
2425
+ expect(x.parameters).to be_instance_of(Array)
2426
+ expect(x.parameters.count).to eq(1)
2427
+ expect(x.parameters[0]).to be_instance_of(Expressir::Model::Literals::Logical)
2428
+ expect(x.parameters[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
2429
+ end
2430
+
2431
+ x.variables.find{|x| x.id == "tan_expression"}.expression.tap do |x|
2432
+ expect(x).to be_instance_of(Expressir::Model::Expressions::Call)
2433
+ expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2434
+ expect(x.ref.id).to eq("TAN")
2435
+ expect(x.parameters).to be_instance_of(Array)
2436
+ expect(x.parameters.count).to eq(1)
2437
+ expect(x.parameters[0]).to be_instance_of(Expressir::Model::Literals::Logical)
2438
+ expect(x.parameters[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
2439
+ end
2440
+
2441
+ x.variables.find{|x| x.id == "typeof_expression"}.expression.tap do |x|
2442
+ expect(x).to be_instance_of(Expressir::Model::Expressions::Call)
2443
+ expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2444
+ expect(x.ref.id).to eq("TYPEOF")
2445
+ expect(x.parameters).to be_instance_of(Array)
2446
+ expect(x.parameters.count).to eq(1)
2447
+ expect(x.parameters[0]).to be_instance_of(Expressir::Model::Literals::Logical)
2448
+ expect(x.parameters[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
2449
+ end
2450
+
2451
+ x.variables.find{|x| x.id == "usedin_expression"}.expression.tap do |x|
2452
+ expect(x).to be_instance_of(Expressir::Model::Expressions::Call)
2453
+ expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2454
+ expect(x.ref.id).to eq("USEDIN")
2455
+ expect(x.parameters).to be_instance_of(Array)
2456
+ expect(x.parameters.count).to eq(1)
2457
+ expect(x.parameters[0]).to be_instance_of(Expressir::Model::Literals::Logical)
2458
+ expect(x.parameters[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
2459
+ end
2460
+
2461
+ x.variables.find{|x| x.id == "value_expression"}.expression.tap do |x|
2462
+ expect(x).to be_instance_of(Expressir::Model::Expressions::Call)
2463
+ expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2464
+ expect(x.ref.id).to eq("VALUE")
2465
+ expect(x.parameters).to be_instance_of(Array)
2466
+ expect(x.parameters.count).to eq(1)
2467
+ expect(x.parameters[0]).to be_instance_of(Expressir::Model::Literals::Logical)
2468
+ expect(x.parameters[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
2469
+ end
2470
+
2471
+ x.variables.find{|x| x.id == "value_in_expression"}.expression.tap do |x|
2472
+ expect(x).to be_instance_of(Expressir::Model::Expressions::Call)
2473
+ expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2474
+ expect(x.ref.id).to eq("VALUE_IN")
2475
+ expect(x.parameters).to be_instance_of(Array)
2476
+ expect(x.parameters.count).to eq(1)
2477
+ expect(x.parameters[0]).to be_instance_of(Expressir::Model::Literals::Logical)
2478
+ expect(x.parameters[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
2479
+ end
2480
+
2481
+ x.variables.find{|x| x.id == "value_unique_expression"}.expression.tap do |x|
2482
+ expect(x).to be_instance_of(Expressir::Model::Expressions::Call)
2483
+ expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2484
+ expect(x.ref.id).to eq("VALUE_UNIQUE")
2485
+ expect(x.parameters).to be_instance_of(Array)
2486
+ expect(x.parameters.count).to eq(1)
2487
+ expect(x.parameters[0]).to be_instance_of(Expressir::Model::Literals::Logical)
2488
+ expect(x.parameters[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
2489
+ end
2490
+
2491
+ # operator expressions
2492
+ x.variables.find{|x| x.id == "plus_expression"}.expression.tap do |x|
2493
+ expect(x).to be_instance_of(Expressir::Model::Expressions::UnaryExpression)
2494
+ expect(x.operator).to eq(Expressir::Model::Expressions::UnaryExpression::PLUS)
2495
+ expect(x.operand).to be_instance_of(Expressir::Model::Literals::Integer)
2496
+ expect(x.operand.value).to eq("4")
2497
+ end
2498
+
2499
+ x.variables.find{|x| x.id == "plus_addition_expression"}.expression.tap do |x|
2500
+ expect(x).to be_instance_of(Expressir::Model::Expressions::UnaryExpression)
2501
+ expect(x.operator).to eq(Expressir::Model::Expressions::UnaryExpression::PLUS)
2502
+ expect(x.operand).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2503
+ expect(x.operand.operator).to eq(Expressir::Model::Expressions::BinaryExpression::ADDITION)
2504
+ expect(x.operand.operand1).to be_instance_of(Expressir::Model::Literals::Integer)
2505
+ expect(x.operand.operand1.value).to eq("4")
2506
+ expect(x.operand.operand2).to be_instance_of(Expressir::Model::Literals::Integer)
2507
+ expect(x.operand.operand2.value).to eq("2")
2508
+ end
2509
+
2510
+ x.variables.find{|x| x.id == "minus_expression"}.expression.tap do |x|
2511
+ expect(x).to be_instance_of(Expressir::Model::Expressions::UnaryExpression)
2512
+ expect(x.operator).to eq(Expressir::Model::Expressions::UnaryExpression::MINUS)
2513
+ expect(x.operand).to be_instance_of(Expressir::Model::Literals::Integer)
2514
+ expect(x.operand.value).to eq("4")
2515
+ end
2516
+
2517
+ x.variables.find{|x| x.id == "minus_addition_expression"}.expression.tap do |x|
2518
+ expect(x).to be_instance_of(Expressir::Model::Expressions::UnaryExpression)
2519
+ expect(x.operator).to eq(Expressir::Model::Expressions::UnaryExpression::MINUS)
2520
+ expect(x.operand).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2521
+ expect(x.operand.operator).to eq(Expressir::Model::Expressions::BinaryExpression::ADDITION)
2522
+ expect(x.operand.operand1).to be_instance_of(Expressir::Model::Literals::Integer)
2523
+ expect(x.operand.operand1.value).to eq("4")
2524
+ expect(x.operand.operand2).to be_instance_of(Expressir::Model::Literals::Integer)
2525
+ expect(x.operand.operand2.value).to eq("2")
2526
+ end
2527
+
2528
+ x.variables.find{|x| x.id == "addition_expression"}.expression.tap do |x|
2529
+ expect(x).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2530
+ expect(x.operator).to eq(Expressir::Model::Expressions::BinaryExpression::ADDITION)
2531
+ expect(x.operand1).to be_instance_of(Expressir::Model::Literals::Integer)
2532
+ expect(x.operand1.value).to eq("4")
2533
+ expect(x.operand2).to be_instance_of(Expressir::Model::Literals::Integer)
2534
+ expect(x.operand2.value).to eq("2")
2535
+ end
2536
+
2537
+ x.variables.find{|x| x.id == "subtraction_expression"}.expression.tap do |x|
2538
+ expect(x).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2539
+ expect(x.operator).to eq(Expressir::Model::Expressions::BinaryExpression::SUBTRACTION)
2540
+ expect(x.operand1).to be_instance_of(Expressir::Model::Literals::Integer)
2541
+ expect(x.operand1.value).to eq("4")
2542
+ expect(x.operand2).to be_instance_of(Expressir::Model::Literals::Integer)
2543
+ expect(x.operand2.value).to eq("2")
2544
+ end
2545
+
2546
+ x.variables.find{|x| x.id == "multiplication_expression"}.expression.tap do |x|
2547
+ expect(x).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2548
+ expect(x.operator).to eq(Expressir::Model::Expressions::BinaryExpression::MULTIPLICATION)
2549
+ expect(x.operand1).to be_instance_of(Expressir::Model::Literals::Integer)
2550
+ expect(x.operand1.value).to eq("4")
2551
+ expect(x.operand2).to be_instance_of(Expressir::Model::Literals::Integer)
2552
+ expect(x.operand2.value).to eq("2")
2553
+ end
2554
+
2555
+ x.variables.find{|x| x.id == "real_division_expression"}.expression.tap do |x|
2556
+ expect(x).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2557
+ expect(x.operator).to eq(Expressir::Model::Expressions::BinaryExpression::REAL_DIVISION)
2558
+ expect(x.operand1).to be_instance_of(Expressir::Model::Literals::Integer)
2559
+ expect(x.operand1.value).to eq("4")
2560
+ expect(x.operand2).to be_instance_of(Expressir::Model::Literals::Integer)
2561
+ expect(x.operand2.value).to eq("2")
2562
+ end
2563
+
2564
+ x.variables.find{|x| x.id == "integer_division_expression"}.expression.tap do |x|
2565
+ expect(x).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2566
+ expect(x.operator).to eq(Expressir::Model::Expressions::BinaryExpression::INTEGER_DIVISION)
2567
+ expect(x.operand1).to be_instance_of(Expressir::Model::Literals::Integer)
2568
+ expect(x.operand1.value).to eq("4")
2569
+ expect(x.operand2).to be_instance_of(Expressir::Model::Literals::Integer)
2570
+ expect(x.operand2.value).to eq("2")
2571
+ end
2572
+
2573
+ x.variables.find{|x| x.id == "modulo_expression"}.expression.tap do |x|
2574
+ expect(x).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2575
+ expect(x.operator).to eq(Expressir::Model::Expressions::BinaryExpression::MODULO)
2576
+ expect(x.operand1).to be_instance_of(Expressir::Model::Literals::Integer)
2577
+ expect(x.operand1.value).to eq("4")
2578
+ expect(x.operand2).to be_instance_of(Expressir::Model::Literals::Integer)
2579
+ expect(x.operand2.value).to eq("2")
2580
+ end
2581
+
2582
+ x.variables.find{|x| x.id == "exponentiation_expression"}.expression.tap do |x|
2583
+ expect(x).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2584
+ expect(x.operator).to eq(Expressir::Model::Expressions::BinaryExpression::EXPONENTIATION)
2585
+ expect(x.operand1).to be_instance_of(Expressir::Model::Literals::Integer)
2586
+ expect(x.operand1.value).to eq("4")
2587
+ expect(x.operand2).to be_instance_of(Expressir::Model::Literals::Integer)
2588
+ expect(x.operand2.value).to eq("2")
2589
+ end
2590
+
2591
+ x.variables.find{|x| x.id == "addition_addition_expression"}.expression.tap do |x|
2592
+ expect(x).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2593
+ expect(x.operator).to eq(Expressir::Model::Expressions::BinaryExpression::ADDITION)
2594
+ expect(x.operand1).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2595
+ expect(x.operand1.operator).to eq(Expressir::Model::Expressions::BinaryExpression::ADDITION)
2596
+ expect(x.operand1.operand1).to be_instance_of(Expressir::Model::Literals::Integer)
2597
+ expect(x.operand1.operand1.value).to eq("4")
2598
+ expect(x.operand1.operand2).to be_instance_of(Expressir::Model::Literals::Integer)
2599
+ expect(x.operand1.operand2.value).to eq("2")
2600
+ expect(x.operand2).to be_instance_of(Expressir::Model::Literals::Integer)
2601
+ expect(x.operand2.value).to eq("1")
2602
+ end
2603
+
2604
+ x.variables.find{|x| x.id == "subtraction_subtraction_expression"}.expression.tap do |x|
2605
+ expect(x).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2606
+ expect(x.operator).to eq(Expressir::Model::Expressions::BinaryExpression::SUBTRACTION)
2607
+ expect(x.operand1).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2608
+ expect(x.operand1.operator).to eq(Expressir::Model::Expressions::BinaryExpression::SUBTRACTION)
2609
+ expect(x.operand1.operand1).to be_instance_of(Expressir::Model::Literals::Integer)
2610
+ expect(x.operand1.operand1.value).to eq("4")
2611
+ expect(x.operand1.operand2).to be_instance_of(Expressir::Model::Literals::Integer)
2612
+ expect(x.operand1.operand2.value).to eq("2")
2613
+ expect(x.operand2).to be_instance_of(Expressir::Model::Literals::Integer)
2614
+ expect(x.operand2.value).to eq("1")
2615
+ end
2616
+
2617
+ x.variables.find{|x| x.id == "addition_subtraction_expression"}.expression.tap do |x|
2618
+ expect(x).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2619
+ expect(x.operator).to eq(Expressir::Model::Expressions::BinaryExpression::SUBTRACTION)
2620
+ expect(x.operand1).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2621
+ expect(x.operand1.operator).to eq(Expressir::Model::Expressions::BinaryExpression::ADDITION)
2622
+ expect(x.operand1.operand1).to be_instance_of(Expressir::Model::Literals::Integer)
2623
+ expect(x.operand1.operand1.value).to eq("4")
2624
+ expect(x.operand1.operand2).to be_instance_of(Expressir::Model::Literals::Integer)
2625
+ expect(x.operand1.operand2.value).to eq("2")
2626
+ expect(x.operand2).to be_instance_of(Expressir::Model::Literals::Integer)
2627
+ expect(x.operand2.value).to eq("1")
2628
+ end
2629
+
2630
+ x.variables.find{|x| x.id == "subtraction_addition_expression"}.expression.tap do |x|
2631
+ expect(x).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2632
+ expect(x.operator).to eq(Expressir::Model::Expressions::BinaryExpression::ADDITION)
2633
+ expect(x.operand1).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2634
+ expect(x.operand1.operator).to eq(Expressir::Model::Expressions::BinaryExpression::SUBTRACTION)
2635
+ expect(x.operand1.operand1).to be_instance_of(Expressir::Model::Literals::Integer)
2636
+ expect(x.operand1.operand1.value).to eq("4")
2637
+ expect(x.operand1.operand2).to be_instance_of(Expressir::Model::Literals::Integer)
2638
+ expect(x.operand1.operand2.value).to eq("2")
2639
+ expect(x.operand2).to be_instance_of(Expressir::Model::Literals::Integer)
2640
+ expect(x.operand2.value).to eq("1")
2641
+ end
2642
+
2643
+ x.variables.find{|x| x.id == "addition_multiplication_expression"}.expression.tap do |x|
2644
+ expect(x).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2645
+ expect(x.operator).to eq(Expressir::Model::Expressions::BinaryExpression::ADDITION)
2646
+ expect(x.operand1).to be_instance_of(Expressir::Model::Literals::Integer)
2647
+ expect(x.operand1.value).to eq("8")
2648
+ expect(x.operand2).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2649
+ expect(x.operand2.operator).to eq(Expressir::Model::Expressions::BinaryExpression::MULTIPLICATION)
2650
+ expect(x.operand2.operand1).to be_instance_of(Expressir::Model::Literals::Integer)
2651
+ expect(x.operand2.operand1.value).to eq("4")
2652
+ expect(x.operand2.operand2).to be_instance_of(Expressir::Model::Literals::Integer)
2653
+ expect(x.operand2.operand2.value).to eq("2")
2654
+ end
2655
+
2656
+ x.variables.find{|x| x.id == "multiplication_addition_expression"}.expression.tap do |x|
2657
+ expect(x).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2658
+ expect(x.operator).to eq(Expressir::Model::Expressions::BinaryExpression::ADDITION)
2659
+ expect(x.operand1).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2660
+ expect(x.operand1.operator).to eq(Expressir::Model::Expressions::BinaryExpression::MULTIPLICATION)
2661
+ expect(x.operand1.operand1).to be_instance_of(Expressir::Model::Literals::Integer)
2662
+ expect(x.operand1.operand1.value).to eq("8")
2663
+ expect(x.operand1.operand2).to be_instance_of(Expressir::Model::Literals::Integer)
2664
+ expect(x.operand1.operand2.value).to eq("4")
2665
+ expect(x.operand2).to be_instance_of(Expressir::Model::Literals::Integer)
2666
+ expect(x.operand2.value).to eq("2")
2667
+ end
2668
+
2669
+ x.variables.find{|x| x.id == "parenthesis_addition_multiplication_expression"}.expression.tap do |x|
2670
+ expect(x).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2671
+ expect(x.operator).to eq(Expressir::Model::Expressions::BinaryExpression::MULTIPLICATION)
2672
+ expect(x.operand1).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2673
+ expect(x.operand1.operator).to eq(Expressir::Model::Expressions::BinaryExpression::ADDITION)
2674
+ expect(x.operand1.operand1).to be_instance_of(Expressir::Model::Literals::Integer)
2675
+ expect(x.operand1.operand1.value).to eq("8")
2676
+ expect(x.operand1.operand2).to be_instance_of(Expressir::Model::Literals::Integer)
2677
+ expect(x.operand1.operand2.value).to eq("4")
2678
+ expect(x.operand2).to be_instance_of(Expressir::Model::Literals::Integer)
2679
+ expect(x.operand2.value).to eq("2")
2680
+ end
2681
+
2682
+ x.variables.find{|x| x.id == "multiplication_parenthesis_addition_expression"}.expression.tap do |x|
2683
+ expect(x).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2684
+ expect(x.operator).to eq(Expressir::Model::Expressions::BinaryExpression::MULTIPLICATION)
2685
+ expect(x.operand1).to be_instance_of(Expressir::Model::Literals::Integer)
2686
+ expect(x.operand1.value).to eq("8")
2687
+ expect(x.operand2).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2688
+ expect(x.operand2.operator).to eq(Expressir::Model::Expressions::BinaryExpression::ADDITION)
2689
+ expect(x.operand2.operand1).to be_instance_of(Expressir::Model::Literals::Integer)
2690
+ expect(x.operand2.operand1.value).to eq("4")
2691
+ expect(x.operand2.operand2).to be_instance_of(Expressir::Model::Literals::Integer)
2692
+ expect(x.operand2.operand2.value).to eq("2")
2693
+ end
2694
+
2695
+ x.variables.find{|x| x.id == "equal_expression"}.expression.tap do |x|
2696
+ expect(x).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2697
+ expect(x.operator).to eq(Expressir::Model::Expressions::BinaryExpression::EQUAL)
2698
+ expect(x.operand1).to be_instance_of(Expressir::Model::Literals::Integer)
2699
+ expect(x.operand1.value).to eq("4")
2700
+ expect(x.operand2).to be_instance_of(Expressir::Model::Literals::Integer)
2701
+ expect(x.operand2.value).to eq("2")
2702
+ end
2703
+
2704
+ x.variables.find{|x| x.id == "not_equal_expression"}.expression.tap do |x|
2705
+ expect(x).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2706
+ expect(x.operator).to eq(Expressir::Model::Expressions::BinaryExpression::NOT_EQUAL)
2707
+ expect(x.operand1).to be_instance_of(Expressir::Model::Literals::Integer)
2708
+ expect(x.operand1.value).to eq("4")
2709
+ expect(x.operand2).to be_instance_of(Expressir::Model::Literals::Integer)
2710
+ expect(x.operand2.value).to eq("2")
2711
+ end
2712
+
2713
+ x.variables.find{|x| x.id == "instance_equal_expression"}.expression.tap do |x|
2714
+ expect(x).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2715
+ expect(x.operator).to eq(Expressir::Model::Expressions::BinaryExpression::INSTANCE_EQUAL)
2716
+ expect(x.operand1).to be_instance_of(Expressir::Model::Literals::Integer)
2717
+ expect(x.operand1.value).to eq("4")
2718
+ expect(x.operand2).to be_instance_of(Expressir::Model::Literals::Integer)
2719
+ expect(x.operand2.value).to eq("2")
2720
+ end
2721
+
2722
+ x.variables.find{|x| x.id == "instance_not_equal_expression"}.expression.tap do |x|
2723
+ expect(x).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2724
+ expect(x.operator).to eq(Expressir::Model::Expressions::BinaryExpression::INSTANCE_NOT_EQUAL)
2725
+ expect(x.operand1).to be_instance_of(Expressir::Model::Literals::Integer)
2726
+ expect(x.operand1.value).to eq("4")
2727
+ expect(x.operand2).to be_instance_of(Expressir::Model::Literals::Integer)
2728
+ expect(x.operand2.value).to eq("2")
2729
+ end
2730
+
2731
+ x.variables.find{|x| x.id == "lt_expression"}.expression.tap do |x|
2732
+ expect(x).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2733
+ expect(x.operator).to eq(Expressir::Model::Expressions::BinaryExpression::LESS_THAN)
2734
+ expect(x.operand1).to be_instance_of(Expressir::Model::Literals::Integer)
2735
+ expect(x.operand1.value).to eq("4")
2736
+ expect(x.operand2).to be_instance_of(Expressir::Model::Literals::Integer)
2737
+ expect(x.operand2.value).to eq("2")
2738
+ end
2739
+
2740
+ x.variables.find{|x| x.id == "gt_expression"}.expression.tap do |x|
2741
+ expect(x).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2742
+ expect(x.operator).to eq(Expressir::Model::Expressions::BinaryExpression::GREATER_THAN)
2743
+ expect(x.operand1).to be_instance_of(Expressir::Model::Literals::Integer)
2744
+ expect(x.operand1.value).to eq("4")
2745
+ expect(x.operand2).to be_instance_of(Expressir::Model::Literals::Integer)
2746
+ expect(x.operand2.value).to eq("2")
2747
+ end
2748
+
2749
+ x.variables.find{|x| x.id == "lte_expression"}.expression.tap do |x|
2750
+ expect(x).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2751
+ expect(x.operator).to eq(Expressir::Model::Expressions::BinaryExpression::LESS_THAN_OR_EQUAL)
2752
+ expect(x.operand1).to be_instance_of(Expressir::Model::Literals::Integer)
2753
+ expect(x.operand1.value).to eq("4")
2754
+ expect(x.operand2).to be_instance_of(Expressir::Model::Literals::Integer)
2755
+ expect(x.operand2.value).to eq("2")
2756
+ end
2757
+
2758
+ x.variables.find{|x| x.id == "gte_expression"}.expression.tap do |x|
2759
+ expect(x).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2760
+ expect(x.operator).to eq(Expressir::Model::Expressions::BinaryExpression::GREATER_THAN_OR_EQUAL)
2761
+ expect(x.operand1).to be_instance_of(Expressir::Model::Literals::Integer)
2762
+ expect(x.operand1.value).to eq("4")
2763
+ expect(x.operand2).to be_instance_of(Expressir::Model::Literals::Integer)
2764
+ expect(x.operand2.value).to eq("2")
2765
+ end
2766
+
2767
+ x.variables.find{|x| x.id == "not_expression"}.expression.tap do |x|
2768
+ expect(x).to be_instance_of(Expressir::Model::Expressions::UnaryExpression)
2769
+ expect(x.operator).to eq(Expressir::Model::Expressions::UnaryExpression::NOT)
2770
+ expect(x.operand).to be_instance_of(Expressir::Model::Literals::Logical)
2771
+ expect(x.operand.value).to eq(Expressir::Model::Literals::Logical::TRUE)
2772
+ end
2773
+
2774
+ x.variables.find{|x| x.id == "not_or_expression"}.expression.tap do |x|
2775
+ expect(x).to be_instance_of(Expressir::Model::Expressions::UnaryExpression)
2776
+ expect(x.operator).to eq(Expressir::Model::Expressions::UnaryExpression::NOT)
2777
+ expect(x.operand).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2778
+ expect(x.operand.operator).to eq(Expressir::Model::Expressions::BinaryExpression::OR)
2779
+ expect(x.operand.operand1).to be_instance_of(Expressir::Model::Literals::Logical)
2780
+ expect(x.operand.operand1.value).to eq(Expressir::Model::Literals::Logical::TRUE)
2781
+ expect(x.operand.operand2).to be_instance_of(Expressir::Model::Literals::Logical)
2782
+ expect(x.operand.operand2.value).to eq(Expressir::Model::Literals::Logical::FALSE)
2783
+ end
2784
+
2785
+ x.variables.find{|x| x.id == "or_expression"}.expression.tap do |x|
2786
+ expect(x).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2787
+ expect(x.operator).to eq(Expressir::Model::Expressions::BinaryExpression::OR)
2788
+ expect(x.operand1).to be_instance_of(Expressir::Model::Literals::Logical)
2789
+ expect(x.operand1.value).to eq(Expressir::Model::Literals::Logical::TRUE)
2790
+ expect(x.operand2).to be_instance_of(Expressir::Model::Literals::Logical)
2791
+ expect(x.operand2.value).to eq(Expressir::Model::Literals::Logical::FALSE)
2792
+ end
2793
+
2794
+ x.variables.find{|x| x.id == "and_expression"}.expression.tap do |x|
2795
+ expect(x).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2796
+ expect(x.operator).to eq(Expressir::Model::Expressions::BinaryExpression::AND)
2797
+ expect(x.operand1).to be_instance_of(Expressir::Model::Literals::Logical)
2798
+ expect(x.operand1.value).to eq(Expressir::Model::Literals::Logical::TRUE)
2799
+ expect(x.operand2).to be_instance_of(Expressir::Model::Literals::Logical)
2800
+ expect(x.operand2.value).to eq(Expressir::Model::Literals::Logical::FALSE)
2801
+ end
2802
+
2803
+ x.variables.find{|x| x.id == "or_or_expression"}.expression.tap do |x|
2804
+ expect(x).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2805
+ expect(x.operator).to eq(Expressir::Model::Expressions::BinaryExpression::OR)
2806
+ expect(x.operand1).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2807
+ expect(x.operand1.operator).to eq(Expressir::Model::Expressions::BinaryExpression::OR)
2808
+ expect(x.operand1.operand1).to be_instance_of(Expressir::Model::Literals::Logical)
2809
+ expect(x.operand1.operand1.value).to eq(Expressir::Model::Literals::Logical::TRUE)
2810
+ expect(x.operand1.operand2).to be_instance_of(Expressir::Model::Literals::Logical)
2811
+ expect(x.operand1.operand2.value).to eq(Expressir::Model::Literals::Logical::FALSE)
2812
+ expect(x.operand2).to be_instance_of(Expressir::Model::Literals::Logical)
2813
+ expect(x.operand2.value).to eq(Expressir::Model::Literals::Logical::TRUE)
2814
+ end
2815
+
2816
+ x.variables.find{|x| x.id == "and_and_expression"}.expression.tap do |x|
2817
+ expect(x).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2818
+ expect(x.operator).to eq(Expressir::Model::Expressions::BinaryExpression::AND)
2819
+ expect(x.operand1).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2820
+ expect(x.operand1.operator).to eq(Expressir::Model::Expressions::BinaryExpression::AND)
2821
+ expect(x.operand1.operand1).to be_instance_of(Expressir::Model::Literals::Logical)
2822
+ expect(x.operand1.operand1.value).to eq(Expressir::Model::Literals::Logical::TRUE)
2823
+ expect(x.operand1.operand2).to be_instance_of(Expressir::Model::Literals::Logical)
2824
+ expect(x.operand1.operand2.value).to eq(Expressir::Model::Literals::Logical::FALSE)
2825
+ expect(x.operand2).to be_instance_of(Expressir::Model::Literals::Logical)
2826
+ expect(x.operand2.value).to eq(Expressir::Model::Literals::Logical::TRUE)
2827
+ end
2828
+
2829
+ x.variables.find{|x| x.id == "or_and_expression"}.expression.tap do |x|
2830
+ expect(x).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2831
+ expect(x.operator).to eq(Expressir::Model::Expressions::BinaryExpression::OR)
2832
+ expect(x.operand1).to be_instance_of(Expressir::Model::Literals::Logical)
2833
+ expect(x.operand1.value).to eq(Expressir::Model::Literals::Logical::TRUE)
2834
+ expect(x.operand2).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2835
+ expect(x.operand2.operator).to eq(Expressir::Model::Expressions::BinaryExpression::AND)
2836
+ expect(x.operand2.operand1).to be_instance_of(Expressir::Model::Literals::Logical)
2837
+ expect(x.operand2.operand1.value).to eq(Expressir::Model::Literals::Logical::FALSE)
2838
+ expect(x.operand2.operand2).to be_instance_of(Expressir::Model::Literals::Logical)
2839
+ expect(x.operand2.operand2.value).to eq(Expressir::Model::Literals::Logical::TRUE)
2840
+ end
2841
+
2842
+ x.variables.find{|x| x.id == "and_or_expression"}.expression.tap do |x|
2843
+ expect(x).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2844
+ expect(x.operator).to eq(Expressir::Model::Expressions::BinaryExpression::OR)
2845
+ expect(x.operand1).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2846
+ expect(x.operand1.operator).to eq(Expressir::Model::Expressions::BinaryExpression::AND)
2847
+ expect(x.operand1.operand1).to be_instance_of(Expressir::Model::Literals::Logical)
2848
+ expect(x.operand1.operand1.value).to eq(Expressir::Model::Literals::Logical::TRUE)
2849
+ expect(x.operand1.operand2).to be_instance_of(Expressir::Model::Literals::Logical)
2850
+ expect(x.operand1.operand2.value).to eq(Expressir::Model::Literals::Logical::FALSE)
2851
+ expect(x.operand2).to be_instance_of(Expressir::Model::Literals::Logical)
2852
+ expect(x.operand2.value).to eq(Expressir::Model::Literals::Logical::TRUE)
2853
+ end
2854
+
2855
+ x.variables.find{|x| x.id == "parenthesis_or_and_expression"}.expression.tap do |x|
2856
+ expect(x).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2857
+ expect(x.operator).to eq(Expressir::Model::Expressions::BinaryExpression::AND)
2858
+ expect(x.operand1).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2859
+ expect(x.operand1.operator).to eq(Expressir::Model::Expressions::BinaryExpression::OR)
2860
+ expect(x.operand1.operand1).to be_instance_of(Expressir::Model::Literals::Logical)
2861
+ expect(x.operand1.operand1.value).to eq(Expressir::Model::Literals::Logical::TRUE)
2862
+ expect(x.operand1.operand2).to be_instance_of(Expressir::Model::Literals::Logical)
2863
+ expect(x.operand1.operand2.value).to eq(Expressir::Model::Literals::Logical::FALSE)
2864
+ expect(x.operand2).to be_instance_of(Expressir::Model::Literals::Logical)
2865
+ expect(x.operand2.value).to eq(Expressir::Model::Literals::Logical::TRUE)
2866
+ end
2867
+
2868
+ x.variables.find{|x| x.id == "and_parenthesis_or_expression"}.expression.tap do |x|
2869
+ expect(x).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2870
+ expect(x.operator).to eq(Expressir::Model::Expressions::BinaryExpression::AND)
2871
+ expect(x.operand1).to be_instance_of(Expressir::Model::Literals::Logical)
2872
+ expect(x.operand1.value).to eq(Expressir::Model::Literals::Logical::TRUE)
2873
+ expect(x.operand2).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2874
+ expect(x.operand2.operator).to eq(Expressir::Model::Expressions::BinaryExpression::OR)
2875
+ expect(x.operand2.operand1).to be_instance_of(Expressir::Model::Literals::Logical)
2876
+ expect(x.operand2.operand1.value).to eq(Expressir::Model::Literals::Logical::FALSE)
2877
+ expect(x.operand2.operand2).to be_instance_of(Expressir::Model::Literals::Logical)
2878
+ expect(x.operand2.operand2.value).to eq(Expressir::Model::Literals::Logical::TRUE)
2879
+ end
2880
+
2881
+ # aggregate initializer expressions
2882
+ x.variables.find{|x| x.id == "aggregate_initializer_expression"}.expression.tap do |x|
2883
+ expect(x).to be_instance_of(Expressir::Model::Expressions::AggregateInitializer)
2884
+ expect(x.items).to be_instance_of(Array)
2885
+ expect(x.items.count).to eq(1)
2886
+ expect(x.items[0]).to be_instance_of(Expressir::Model::Literals::Integer)
2887
+ expect(x.items[0].value).to eq("4")
2888
+ end
2889
+
2890
+ x.variables.find{|x| x.id == "repeated_aggregate_initializer_expression"}.expression.tap do |x|
2891
+ expect(x).to be_instance_of(Expressir::Model::Expressions::AggregateInitializer)
2892
+ expect(x.items).to be_instance_of(Array)
2893
+ expect(x.items.count).to eq(1)
2894
+ expect(x.items[0]).to be_instance_of(Expressir::Model::Expressions::AggregateItem)
2895
+ expect(x.items[0].expression).to be_instance_of(Expressir::Model::Literals::Integer)
2896
+ expect(x.items[0].expression.value).to eq("4")
2897
+ expect(x.items[0].repetition).to be_instance_of(Expressir::Model::Literals::Integer)
2898
+ expect(x.items[0].repetition.value).to eq("2")
2899
+ end
2900
+
2901
+ x.variables.find{|x| x.id == "complex_aggregate_initializer_expression"}.expression.tap do |x|
2902
+ expect(x).to be_instance_of(Expressir::Model::Expressions::AggregateInitializer)
2903
+ expect(x.items).to be_instance_of(Array)
2904
+ expect(x.items.count).to eq(1)
2905
+ expect(x.items[0]).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2906
+ expect(x.items[0].operator).to eq(Expressir::Model::Expressions::BinaryExpression::ADDITION)
2907
+ expect(x.items[0].operand1).to be_instance_of(Expressir::Model::Literals::Integer)
2908
+ expect(x.items[0].operand1.value).to eq("4")
2909
+ expect(x.items[0].operand2).to be_instance_of(Expressir::Model::Literals::Integer)
2910
+ expect(x.items[0].operand2.value).to eq("2")
2911
+ end
2912
+
2913
+ x.variables.find{|x| x.id == "complex_repeated_aggregate_initializer_expression"}.expression.tap do |x|
2914
+ expect(x).to be_instance_of(Expressir::Model::Expressions::AggregateInitializer)
2915
+ expect(x.items).to be_instance_of(Array)
2916
+ expect(x.items.count).to eq(1)
2917
+ expect(x.items[0]).to be_instance_of(Expressir::Model::Expressions::AggregateItem)
2918
+ expect(x.items[0].expression).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2919
+ expect(x.items[0].expression.operator).to eq(Expressir::Model::Expressions::BinaryExpression::ADDITION)
2920
+ expect(x.items[0].expression.operand1).to be_instance_of(Expressir::Model::Literals::Integer)
2921
+ expect(x.items[0].expression.operand1.value).to eq("4")
2922
+ expect(x.items[0].expression.operand2).to be_instance_of(Expressir::Model::Literals::Integer)
2923
+ expect(x.items[0].expression.operand2.value).to eq("2")
2924
+ expect(x.items[0].repetition).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2925
+ expect(x.items[0].repetition.operator).to eq(Expressir::Model::Expressions::BinaryExpression::ADDITION)
2926
+ expect(x.items[0].repetition.operand1).to be_instance_of(Expressir::Model::Literals::Integer)
2927
+ expect(x.items[0].repetition.operand1.value).to eq("4")
2928
+ expect(x.items[0].repetition.operand2).to be_instance_of(Expressir::Model::Literals::Integer)
2929
+ expect(x.items[0].repetition.operand2.value).to eq("2")
2930
+ end
2931
+
2932
+ # function call or entity constructor expressions
2933
+ x.variables.find{|x| x.id == "call_expression"}.expression.tap do |x|
2934
+ expect(x).to be_instance_of(Expressir::Model::Expressions::Call)
2935
+ expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2936
+ expect(x.ref.id).to eq("parameter_function")
2937
+ expect(x.parameters).to be_instance_of(Array)
2938
+ expect(x.parameters.count).to eq(1)
2939
+ expect(x.parameters[0]).to be_instance_of(Expressir::Model::Literals::Logical)
2940
+ expect(x.parameters[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
2941
+ end
2942
+
2943
+ # reference expressions
2944
+ x.variables.find{|x| x.id == "simple_reference_expression"}.expression.tap do |x|
2945
+ expect(x).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2946
+ expect(x.id).to eq("test")
2947
+ end
2948
+
2949
+ x.variables.find{|x| x.id == "group_reference_expression"}.expression.tap do |x|
2950
+ expect(x).to be_instance_of(Expressir::Model::Expressions::GroupReference)
2951
+ expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2952
+ expect(x.ref.id).to eq("test")
2953
+ expect(x.entity).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2954
+ expect(x.entity.id).to eq("test2")
2955
+ end
2956
+
2957
+ x.variables.find{|x| x.id == "index_reference_expression"}.expression.tap do |x|
2958
+ expect(x).to be_instance_of(Expressir::Model::Expressions::IndexReference)
2959
+ expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2960
+ expect(x.ref.id).to eq("test")
2961
+ expect(x.index1).to be_instance_of(Expressir::Model::Literals::Integer)
2962
+ expect(x.index1.value).to eq("1")
2963
+ end
2964
+
2965
+ x.variables.find{|x| x.id == "index2_reference_expression"}.expression.tap do |x|
2966
+ expect(x).to be_instance_of(Expressir::Model::Expressions::IndexReference)
2967
+ expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2968
+ expect(x.ref.id).to eq("test")
2969
+ expect(x.index1).to be_instance_of(Expressir::Model::Literals::Integer)
2970
+ expect(x.index1.value).to eq("1")
2971
+ expect(x.index2).to be_instance_of(Expressir::Model::Literals::Integer)
2972
+ expect(x.index2.value).to eq("9")
2973
+ end
2974
+
2975
+ x.variables.find{|x| x.id == "attribute_reference_expression"}.expression.tap do |x|
2976
+ expect(x).to be_instance_of(Expressir::Model::Expressions::AttributeReference)
2977
+ expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2978
+ expect(x.ref.id).to eq("test")
2979
+ expect(x.attribute).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2980
+ expect(x.attribute.id).to eq("test2")
2981
+ end
2982
+
2983
+ # interval expressions
2984
+ x.variables.find{|x| x.id == "lt_lt_interval_expression"}.expression.tap do |x|
2985
+ expect(x).to be_instance_of(Expressir::Model::Expressions::Interval)
2986
+ expect(x.low).to be_instance_of(Expressir::Model::Literals::Integer)
2987
+ expect(x.low.value).to eq("1")
2988
+ expect(x.operator1).to eq(Expressir::Model::Expressions::BinaryExpression::LESS_THAN)
2989
+ expect(x.item).to be_instance_of(Expressir::Model::Literals::Integer)
2990
+ expect(x.item.value).to eq("5")
2991
+ expect(x.operator2).to eq(Expressir::Model::Expressions::BinaryExpression::LESS_THAN)
2992
+ expect(x.high).to be_instance_of(Expressir::Model::Literals::Integer)
2993
+ expect(x.high.value).to eq("9")
2994
+ end
2995
+
2996
+ x.variables.find{|x| x.id == "lte_lt_interval_expression"}.expression.tap do |x|
2997
+ expect(x).to be_instance_of(Expressir::Model::Expressions::Interval)
2998
+ expect(x.low).to be_instance_of(Expressir::Model::Literals::Integer)
2999
+ expect(x.low.value).to eq("1")
3000
+ expect(x.operator1).to eq(Expressir::Model::Expressions::BinaryExpression::LESS_THAN_OR_EQUAL)
3001
+ expect(x.item).to be_instance_of(Expressir::Model::Literals::Integer)
3002
+ expect(x.item.value).to eq("5")
3003
+ expect(x.operator2).to eq(Expressir::Model::Expressions::BinaryExpression::LESS_THAN)
3004
+ expect(x.high).to be_instance_of(Expressir::Model::Literals::Integer)
3005
+ expect(x.high.value).to eq("9")
3006
+ end
3007
+
3008
+ x.variables.find{|x| x.id == "lt_lte_interval_expression"}.expression.tap do |x|
3009
+ expect(x).to be_instance_of(Expressir::Model::Expressions::Interval)
3010
+ expect(x.low).to be_instance_of(Expressir::Model::Literals::Integer)
3011
+ expect(x.low.value).to eq("1")
3012
+ expect(x.operator1).to eq(Expressir::Model::Expressions::BinaryExpression::LESS_THAN)
3013
+ expect(x.item).to be_instance_of(Expressir::Model::Literals::Integer)
3014
+ expect(x.item.value).to eq("5")
3015
+ expect(x.operator2).to eq(Expressir::Model::Expressions::BinaryExpression::LESS_THAN_OR_EQUAL)
3016
+ expect(x.high).to be_instance_of(Expressir::Model::Literals::Integer)
3017
+ expect(x.high.value).to eq("9")
3018
+ end
3019
+
3020
+ x.variables.find{|x| x.id == "lte_lte_interval_expression"}.expression.tap do |x|
3021
+ expect(x).to be_instance_of(Expressir::Model::Expressions::Interval)
3022
+ expect(x.low).to be_instance_of(Expressir::Model::Literals::Integer)
3023
+ expect(x.low.value).to eq("1")
3024
+ expect(x.operator1).to eq(Expressir::Model::Expressions::BinaryExpression::LESS_THAN_OR_EQUAL)
3025
+ expect(x.item).to be_instance_of(Expressir::Model::Literals::Integer)
3026
+ expect(x.item.value).to eq("5")
3027
+ expect(x.operator2).to eq(Expressir::Model::Expressions::BinaryExpression::LESS_THAN_OR_EQUAL)
3028
+ expect(x.high).to be_instance_of(Expressir::Model::Literals::Integer)
3029
+ expect(x.high.value).to eq("9")
3030
+ end
3031
+
3032
+ x.variables.find{|x| x.id == "combine_expression"}.expression.tap do |x|
3033
+ expect(x).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
3034
+ expect(x.operator).to eq(Expressir::Model::Expressions::BinaryExpression::COMBINE)
3035
+ expect(x.operand1).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
3036
+ expect(x.operand1.id).to eq("test")
3037
+ expect(x.operand2).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
3038
+ expect(x.operand2.id).to eq("test2")
3039
+ end
3040
+
3041
+ x.variables.find{|x| x.id == "in_expression"}.expression.tap do |x|
3042
+ expect(x).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
3043
+ expect(x.operator).to eq(Expressir::Model::Expressions::BinaryExpression::IN)
3044
+ expect(x.operand1).to be_instance_of(Expressir::Model::Literals::Logical)
3045
+ expect(x.operand1.value).to eq(Expressir::Model::Literals::Logical::TRUE)
3046
+ expect(x.operand2).to be_instance_of(Expressir::Model::Expressions::AggregateInitializer)
3047
+ expect(x.operand2.items).to be_instance_of(Array)
3048
+ expect(x.operand2.items.count).to eq(1)
3049
+ expect(x.operand2.items[0]).to be_instance_of(Expressir::Model::Literals::Logical)
3050
+ expect(x.operand2.items[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
3051
+ end
3052
+
3053
+ x.variables.find{|x| x.id == "like_expression"}.expression.tap do |x|
3054
+ expect(x).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
3055
+ expect(x.operator).to eq(Expressir::Model::Expressions::BinaryExpression::LIKE)
3056
+ expect(x.operand1).to be_instance_of(Expressir::Model::Literals::String)
3057
+ expect(x.operand1.value).to eq("xxx")
3058
+ expect(x.operand2).to be_instance_of(Expressir::Model::Literals::String)
3059
+ expect(x.operand2.value).to eq("xxx")
3060
+ end
3061
+
3062
+ # query expressions
3063
+ x.variables.find{|x| x.id == "query_expression"}.expression.tap do |x|
3064
+ expect(x).to be_instance_of(Expressir::Model::Expressions::QueryExpression)
3065
+ expect(x.id).to eq("test")
3066
+ expect(x.aggregate_source).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
3067
+ expect(x.aggregate_source.id).to eq("test2")
3068
+ expect(x.expression).to be_instance_of(Expressir::Model::Literals::Logical)
3069
+ expect(x.expression.value).to eq(Expressir::Model::Literals::Logical::TRUE)
3070
+ end
3071
+ end
3072
+ end
3073
+ end
3074
+
3075
+ def sample_file
3076
+ @sample_file ||= Expressir.root_path.join(
3077
+ "original", "examples", "syntax", "syntax.exp"
3078
+ )
3079
+ end
3080
+ end