expressir 0.2.2 → 0.2.3

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