expressir 0.2.15-arm64-darwin → 0.2.21-arm64-darwin

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