expressir 0.2.9-arm64-darwin → 0.2.14-arm64-darwin

Sign up to get free protection for your applications and to get access to all the features.
Files changed (100) hide show
  1. checksums.yaml +4 -4
  2. data/exe/format +20 -0
  3. data/expressir.gemspec +1 -0
  4. data/lib/expressir/express_exp/2.4/express_parser.bundle +0 -0
  5. data/lib/expressir/express_exp/2.5/express_parser.bundle +0 -0
  6. data/lib/expressir/express_exp/2.6/express_parser.bundle +0 -0
  7. data/lib/expressir/express_exp/2.7/express_parser.bundle +0 -0
  8. data/lib/expressir/express_exp/3.0/express_parser.bundle +0 -0
  9. data/lib/expressir/express_exp/formatter.rb +146 -105
  10. data/lib/expressir/express_exp/hyperlink_formatter.rb +25 -0
  11. data/lib/expressir/express_exp/parser.rb +2 -0
  12. data/lib/expressir/express_exp/schema_head_formatter.rb +14 -0
  13. data/lib/expressir/express_exp/visitor.rb +132 -82
  14. data/lib/expressir/model.rb +2 -1
  15. data/lib/expressir/model/attribute.rb +5 -1
  16. data/lib/expressir/model/constant.rb +5 -1
  17. data/lib/expressir/model/entity.rb +13 -22
  18. data/lib/expressir/model/enumeration_item.rb +5 -1
  19. data/lib/expressir/model/expressions/aggregate_initializer.rb +4 -2
  20. data/lib/expressir/model/expressions/aggregate_item.rb +3 -1
  21. data/lib/expressir/model/expressions/attribute_reference.rb +3 -1
  22. data/lib/expressir/model/expressions/binary_expression.rb +3 -1
  23. data/lib/expressir/model/expressions/call.rb +4 -2
  24. data/lib/expressir/model/expressions/entity_constructor.rb +4 -2
  25. data/lib/expressir/model/expressions/group_reference.rb +3 -1
  26. data/lib/expressir/model/expressions/index_reference.rb +3 -1
  27. data/lib/expressir/model/expressions/interval.rb +3 -1
  28. data/lib/expressir/model/expressions/query_expression.rb +5 -2
  29. data/lib/expressir/model/expressions/simple_reference.rb +3 -1
  30. data/lib/expressir/model/expressions/unary_expression.rb +3 -1
  31. data/lib/expressir/model/function.rb +28 -39
  32. data/lib/expressir/model/identifier.rb +1 -3
  33. data/lib/expressir/model/informal_proposition.rb +5 -1
  34. data/lib/expressir/model/interface.rb +4 -2
  35. data/lib/expressir/model/literals/binary.rb +3 -1
  36. data/lib/expressir/model/literals/integer.rb +3 -1
  37. data/lib/expressir/model/literals/logical.rb +3 -1
  38. data/lib/expressir/model/literals/real.rb +3 -1
  39. data/lib/expressir/model/literals/string.rb +3 -1
  40. data/lib/expressir/model/model_element.rb +140 -0
  41. data/lib/expressir/model/parameter.rb +5 -1
  42. data/lib/expressir/model/procedure.rb +29 -40
  43. data/lib/expressir/model/renamed_ref.rb +3 -1
  44. data/lib/expressir/model/repository.rb +5 -5
  45. data/lib/expressir/model/rule.rb +32 -43
  46. data/lib/expressir/model/schema.rb +48 -48
  47. data/lib/expressir/model/statements/alias.rb +6 -3
  48. data/lib/expressir/model/statements/assignment.rb +3 -1
  49. data/lib/expressir/model/statements/call.rb +4 -2
  50. data/lib/expressir/model/statements/case.rb +4 -2
  51. data/lib/expressir/model/statements/case_action.rb +4 -2
  52. data/lib/expressir/model/statements/compound.rb +4 -2
  53. data/lib/expressir/model/statements/escape.rb +1 -1
  54. data/lib/expressir/model/statements/if.rb +5 -3
  55. data/lib/expressir/model/statements/null.rb +1 -1
  56. data/lib/expressir/model/statements/repeat.rb +6 -3
  57. data/lib/expressir/model/statements/return.rb +3 -1
  58. data/lib/expressir/model/statements/skip.rb +1 -1
  59. data/lib/expressir/model/subtype_constraint.rb +5 -2
  60. data/lib/expressir/model/type.rb +10 -11
  61. data/lib/expressir/model/types/aggregate.rb +5 -1
  62. data/lib/expressir/model/types/array.rb +3 -1
  63. data/lib/expressir/model/types/bag.rb +3 -1
  64. data/lib/expressir/model/types/binary.rb +3 -1
  65. data/lib/expressir/model/types/boolean.rb +1 -1
  66. data/lib/expressir/model/types/enumeration.rb +5 -3
  67. data/lib/expressir/model/types/generic.rb +5 -1
  68. data/lib/expressir/model/types/generic_entity.rb +5 -1
  69. data/lib/expressir/model/types/integer.rb +1 -1
  70. data/lib/expressir/model/types/list.rb +3 -1
  71. data/lib/expressir/model/types/logical.rb +1 -1
  72. data/lib/expressir/model/types/number.rb +1 -1
  73. data/lib/expressir/model/types/real.rb +3 -1
  74. data/lib/expressir/model/types/select.rb +5 -3
  75. data/lib/expressir/model/types/set.rb +3 -1
  76. data/lib/expressir/model/types/string.rb +3 -1
  77. data/lib/expressir/model/unique.rb +6 -2
  78. data/lib/expressir/model/variable.rb +5 -1
  79. data/lib/expressir/model/where.rb +5 -1
  80. data/lib/expressir/version.rb +1 -1
  81. data/original/examples/syntax/hyperlink.exp +8 -0
  82. data/original/examples/syntax/hyperlink_formatted.exp +19 -0
  83. data/original/examples/syntax/remark_formatted.exp +0 -5
  84. data/original/examples/syntax/simple.exp +3 -0
  85. data/original/examples/syntax/syntax.exp +197 -189
  86. data/original/examples/syntax/syntax_formatted.exp +362 -800
  87. data/spec/expressir/express_exp/{format_remark_spec.rb → formatter/remark_spec.rb} +2 -2
  88. data/spec/expressir/express_exp/{format_syntax_spec.rb → formatter/syntax_spec.rb} +2 -2
  89. data/spec/expressir/express_exp/hyperlink_formatter_spec.rb +24 -0
  90. data/spec/expressir/express_exp/{head_source_spec.rb → parser/head_source_spec.rb} +2 -5
  91. data/spec/expressir/express_exp/{parse_multiple_spec.rb → parser/multiple_spec.rb} +6 -1
  92. data/spec/expressir/express_exp/{parse_remark_spec.rb → parser/remark_spec.rb} +5 -5
  93. data/spec/expressir/express_exp/{source_spec.rb → parser/source_spec.rb} +2 -5
  94. data/spec/expressir/express_exp/{parse_syntax_spec.rb → parser/syntax_spec.rb} +1619 -1582
  95. data/spec/expressir/express_exp/schema_head_formatter_spec.rb +36 -0
  96. data/spec/expressir/model/{find_spec.rb → model_element/find_spec.rb} +7 -2
  97. data/spec/expressir/model/model_element/hash_spec.rb +66 -0
  98. metadata +34 -12
  99. data/lib/expressir/model/scope.rb +0 -66
  100. data/spec/expressir/express_exp/ap233_spec.rb +0 -22
@@ -4,8 +4,8 @@ require "expressir/express_exp/formatter"
4
4
 
5
5
  RSpec.describe Expressir::ExpressExp::Formatter do
6
6
  describe ".format" do
7
- it "formats a file" do
8
- repo = Expressir::ExpressExp::Parser.from_exp(input_file)
7
+ it "formats remark" do
8
+ repo = Expressir::ExpressExp::Parser.from_file(input_file)
9
9
 
10
10
  result = Expressir::ExpressExp::Formatter.format(repo)
11
11
  expected_result = File.read(output_file)
@@ -4,8 +4,8 @@ require "expressir/express_exp/formatter"
4
4
 
5
5
  RSpec.describe Expressir::ExpressExp::Formatter do
6
6
  describe ".format" do
7
- it "formats a file" do
8
- repo = Expressir::ExpressExp::Parser.from_exp(input_file)
7
+ it "formats syntax" do
8
+ repo = Expressir::ExpressExp::Parser.from_file(input_file)
9
9
 
10
10
  result = Expressir::ExpressExp::Formatter.format(repo)
11
11
  expected_result = File.read(output_file)
@@ -0,0 +1,24 @@
1
+ require "spec_helper"
2
+ require "expressir/express_exp/parser"
3
+ require "expressir/express_exp/hyperlink_formatter"
4
+
5
+ RSpec.describe Expressir::ExpressExp::HyperlinkFormatter do
6
+ describe ".format" do
7
+ it "formats hyperlink" do
8
+ repo = Expressir::ExpressExp::Parser.from_file(input_file)
9
+
10
+ result = Expressir::ExpressExp::HyperlinkFormatter.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("original", "examples", "syntax", "hyperlink.exp")
19
+ end
20
+
21
+ def output_file
22
+ @output_file ||= Expressir.root_path.join("original", "examples", "syntax", "hyperlink_formatted.exp")
23
+ end
24
+ end
@@ -1,14 +1,11 @@
1
1
  require "spec_helper"
2
2
  require "expressir/express_exp/parser"
3
3
 
4
- RSpec.describe Expressir::Model::Scope do
4
+ RSpec.describe Expressir::ExpressExp::Parser do
5
5
  describe ".head_source" do
6
6
  it "contains original head source" do
7
7
  input = File.read(sample_file)
8
- repo = Expressir::ExpressExp::Parser.from_exp(sample_file)
9
-
10
- expected_result = input
11
- expect(repo.source).to eq(expected_result)
8
+ repo = Expressir::ExpressExp::Parser.from_file(sample_file)
12
9
 
13
10
  repo.schemas[0].tap do |x|
14
11
  start_index = x.source.index("SCHEMA")
@@ -3,15 +3,20 @@ require "expressir/express_exp/parser"
3
3
 
4
4
  RSpec.describe Expressir::ExpressExp::Parser do
5
5
  describe ".from_files" do
6
- it "build an instance from multiple files file" do
6
+ it "parses multiple files" do
7
7
  repo = Expressir::ExpressExp::Parser.from_files(sample_files)
8
8
 
9
9
  schemas = repo.schemas
10
10
  expect(schemas.count).to eq(5)
11
+ expect(schemas[0].file).to eq(sample_files[0])
11
12
  expect(schemas[0].id).to eq("syntax_schema")
13
+ expect(schemas[1].file).to eq(sample_files[1])
12
14
  expect(schemas[1].id).to eq("remark_schema")
15
+ expect(schemas[2].file).to eq(sample_files[2])
13
16
  expect(schemas[2].id).to eq("entity_schema")
17
+ expect(schemas[3].file).to eq(sample_files[2])
14
18
  expect(schemas[3].id).to eq("version_entity_schema")
19
+ expect(schemas[4].file).to eq(sample_files[2])
15
20
  expect(schemas[4].id).to eq("version_interface_entity_schema")
16
21
  end
17
22
  end
@@ -3,8 +3,8 @@ require "expressir/express_exp/parser"
3
3
 
4
4
  RSpec.describe Expressir::ExpressExp::Parser do
5
5
  describe ".from_file" do
6
- it "build an instance from a file" do
7
- repo = Expressir::ExpressExp::Parser.from_exp(sample_file)
6
+ it "parses remark" do
7
+ repo = Expressir::ExpressExp::Parser.from_file(sample_file)
8
8
 
9
9
  schema = repo.schemas.first
10
10
 
@@ -78,7 +78,7 @@ RSpec.describe Expressir::ExpressExp::Parser do
78
78
  expect(x.remarks[1]).to eq("universal scope - entity")
79
79
  end
80
80
 
81
- schema.entities.first.explicit_attributes.first.tap do |x|
81
+ schema.entities.first.attributes.find{|x| x.kind == Expressir::Model::Attribute::EXPLICIT}.tap do |x|
82
82
  expect(x).to be_instance_of(Expressir::Model::Attribute)
83
83
  expect(x.kind).to eq(Expressir::Model::Attribute::EXPLICIT)
84
84
  expect(x.remarks).to be_instance_of(Array)
@@ -88,7 +88,7 @@ RSpec.describe Expressir::ExpressExp::Parser do
88
88
  expect(x.remarks[2]).to eq("universal scope - entity attribute")
89
89
  end
90
90
 
91
- schema.entities.first.derived_attributes.first.tap do |x|
91
+ schema.entities.first.attributes.find{|x| x.kind == Expressir::Model::Attribute::DERIVED}.tap do |x|
92
92
  expect(x).to be_instance_of(Expressir::Model::Attribute)
93
93
  expect(x.kind).to eq(Expressir::Model::Attribute::DERIVED)
94
94
  expect(x.remarks).to be_instance_of(Array)
@@ -98,7 +98,7 @@ RSpec.describe Expressir::ExpressExp::Parser do
98
98
  expect(x.remarks[2]).to eq("universal scope - entity derived attribute")
99
99
  end
100
100
 
101
- schema.entities.first.inverse_attributes.first.tap do |x|
101
+ schema.entities.first.attributes.find{|x| x.kind == Expressir::Model::Attribute::INVERSE}.tap do |x|
102
102
  expect(x).to be_instance_of(Expressir::Model::Attribute)
103
103
  expect(x.kind).to eq(Expressir::Model::Attribute::INVERSE)
104
104
  expect(x.remarks).to be_instance_of(Array)
@@ -1,14 +1,11 @@
1
1
  require "spec_helper"
2
2
  require "expressir/express_exp/parser"
3
3
 
4
- RSpec.describe Expressir::Model::Scope do
4
+ RSpec.describe Expressir::ExpressExp::Parser do
5
5
  describe ".source" do
6
6
  it "contains original source" do
7
7
  input = File.read(sample_file)
8
- repo = Expressir::ExpressExp::Parser.from_exp(sample_file)
9
-
10
- expected_result = input
11
- expect(repo.source).to eq(expected_result)
8
+ repo = Expressir::ExpressExp::Parser.from_file(sample_file)
12
9
 
13
10
  schema = repo.schemas.first
14
11
  start_index = input.index("SCHEMA")
@@ -3,8 +3,8 @@ require "expressir/express_exp/parser"
3
3
 
4
4
  RSpec.describe Expressir::ExpressExp::Parser do
5
5
  describe ".from_file" do
6
- it "build an instance from a file" do
7
- repo = Expressir::ExpressExp::Parser.from_exp(sample_file)
6
+ it "parses syntax" do
7
+ repo = Expressir::ExpressExp::Parser.from_file(sample_file)
8
8
 
9
9
  schemas = repo.schemas
10
10
 
@@ -12,8 +12,7 @@ RSpec.describe Expressir::ExpressExp::Parser do
12
12
  expect(schema.version).to be_instance_of(Expressir::Model::Literals::String)
13
13
  expect(schema.version.value).to eq("version")
14
14
 
15
- use_interfaces = schema.use_interfaces
16
- reference_interfaces = schema.reference_interfaces
15
+ interfaces = schema.interfaces
17
16
  constants = schema.constants
18
17
  types = schema.types
19
18
  entities = schema.entities
@@ -23,14 +22,14 @@ RSpec.describe Expressir::ExpressExp::Parser do
23
22
  rules = schema.rules
24
23
 
25
24
  # intefaces
26
- use_interfaces[0].tap do |x|
25
+ interfaces[0].tap do |x|
27
26
  expect(x).to be_instance_of(Expressir::Model::Interface)
28
27
  expect(x.kind).to eq(Expressir::Model::Interface::USE)
29
28
  expect(x.schema).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
30
29
  expect(x.schema.id).to eq("contract_schema")
31
30
  end
32
31
 
33
- use_interfaces[1].tap do |x|
32
+ interfaces[1].tap do |x|
34
33
  expect(x).to be_instance_of(Expressir::Model::Interface)
35
34
  expect(x.kind).to eq(Expressir::Model::Interface::USE)
36
35
  expect(x.schema).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
@@ -41,7 +40,7 @@ RSpec.describe Expressir::ExpressExp::Parser do
41
40
  expect(x.items[0].id).to eq("contract")
42
41
  end
43
42
 
44
- use_interfaces[2].tap do |x|
43
+ interfaces[2].tap do |x|
45
44
  expect(x).to be_instance_of(Expressir::Model::Interface)
46
45
  expect(x.kind).to eq(Expressir::Model::Interface::USE)
47
46
  expect(x.schema).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
@@ -54,7 +53,7 @@ RSpec.describe Expressir::ExpressExp::Parser do
54
53
  expect(x.items[1].id).to eq("contract2")
55
54
  end
56
55
 
57
- use_interfaces[3].tap do |x|
56
+ interfaces[3].tap do |x|
58
57
  expect(x).to be_instance_of(Expressir::Model::Interface)
59
58
  expect(x.kind).to eq(Expressir::Model::Interface::USE)
60
59
  expect(x.schema).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
@@ -67,14 +66,14 @@ RSpec.describe Expressir::ExpressExp::Parser do
67
66
  expect(x.items[0].id).to eq("contract2")
68
67
  end
69
68
 
70
- reference_interfaces[0].tap do |x|
69
+ interfaces[4].tap do |x|
71
70
  expect(x).to be_instance_of(Expressir::Model::Interface)
72
71
  expect(x.kind).to eq(Expressir::Model::Interface::REFERENCE)
73
72
  expect(x.schema).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
74
73
  expect(x.schema.id).to eq("contract_schema")
75
74
  end
76
75
 
77
- reference_interfaces[1].tap do |x|
76
+ interfaces[5].tap do |x|
78
77
  expect(x).to be_instance_of(Expressir::Model::Interface)
79
78
  expect(x.kind).to eq(Expressir::Model::Interface::REFERENCE)
80
79
  expect(x.schema).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
@@ -85,7 +84,7 @@ RSpec.describe Expressir::ExpressExp::Parser do
85
84
  expect(x.items[0].id).to eq("contract")
86
85
  end
87
86
 
88
- reference_interfaces[2].tap do |x|
87
+ interfaces[6].tap do |x|
89
88
  expect(x).to be_instance_of(Expressir::Model::Interface)
90
89
  expect(x.kind).to eq(Expressir::Model::Interface::REFERENCE)
91
90
  expect(x.schema).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
@@ -98,7 +97,7 @@ RSpec.describe Expressir::ExpressExp::Parser do
98
97
  expect(x.items[1].id).to eq("contract2")
99
98
  end
100
99
 
101
- reference_interfaces[3].tap do |x|
100
+ interfaces[7].tap do |x|
102
101
  expect(x).to be_instance_of(Expressir::Model::Interface)
103
102
  expect(x.kind).to eq(Expressir::Model::Interface::REFERENCE)
104
103
  expect(x.schema).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
@@ -243,6 +242,10 @@ RSpec.describe Expressir::ExpressExp::Parser do
243
242
 
244
243
  entities.find{|x| x.id == "attribute_redeclared_entity"}.tap do |x|
245
244
  expect(x).to be_instance_of(Expressir::Model::Entity)
245
+ expect(x.subtype_of).to be_instance_of(Array)
246
+ expect(x.subtype_of.count).to eq(1)
247
+ expect(x.subtype_of[0]).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
248
+ expect(x.subtype_of[0].id).to eq("attribute_entity")
246
249
  expect(x.attributes).to be_instance_of(Array)
247
250
  expect(x.attributes.count).to eq(1)
248
251
  expect(x.attributes[0]).to be_instance_of(Expressir::Model::Attribute)
@@ -260,6 +263,10 @@ RSpec.describe Expressir::ExpressExp::Parser do
260
263
 
261
264
  entities.find{|x| x.id == "attribute_redeclared_renamed_entity"}.tap do |x|
262
265
  expect(x).to be_instance_of(Expressir::Model::Entity)
266
+ expect(x.subtype_of).to be_instance_of(Array)
267
+ expect(x.subtype_of.count).to eq(1)
268
+ expect(x.subtype_of[0]).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
269
+ expect(x.subtype_of[0].id).to eq("attribute_entity")
263
270
  expect(x.attributes).to be_instance_of(Array)
264
271
  expect(x.attributes.count).to eq(1)
265
272
  expect(x.attributes[0]).to be_instance_of(Expressir::Model::Attribute)
@@ -290,6 +297,10 @@ RSpec.describe Expressir::ExpressExp::Parser do
290
297
 
291
298
  entities.find{|x| x.id == "derived_attribute_redeclared_entity"}.tap do |x|
292
299
  expect(x).to be_instance_of(Expressir::Model::Entity)
300
+ expect(x.subtype_of).to be_instance_of(Array)
301
+ expect(x.subtype_of.count).to eq(1)
302
+ expect(x.subtype_of[0]).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
303
+ expect(x.subtype_of[0].id).to eq("attribute_entity")
293
304
  expect(x.attributes).to be_instance_of(Array)
294
305
  expect(x.attributes.count).to eq(1)
295
306
  expect(x.attributes[0]).to be_instance_of(Expressir::Model::Attribute)
@@ -309,6 +320,10 @@ RSpec.describe Expressir::ExpressExp::Parser do
309
320
 
310
321
  entities.find{|x| x.id == "derived_attribute_redeclared_renamed_entity"}.tap do |x|
311
322
  expect(x).to be_instance_of(Expressir::Model::Entity)
323
+ expect(x.subtype_of).to be_instance_of(Array)
324
+ expect(x.subtype_of.count).to eq(1)
325
+ expect(x.subtype_of[0]).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
326
+ expect(x.subtype_of[0].id).to eq("attribute_entity")
312
327
  expect(x.attributes).to be_instance_of(Array)
313
328
  expect(x.attributes.count).to eq(1)
314
329
  expect(x.attributes[0]).to be_instance_of(Expressir::Model::Attribute)
@@ -422,6 +437,10 @@ RSpec.describe Expressir::ExpressExp::Parser do
422
437
 
423
438
  entities.find{|x| x.id == "inverse_attribute_redeclared_entity"}.tap do |x|
424
439
  expect(x).to be_instance_of(Expressir::Model::Entity)
440
+ expect(x.subtype_of).to be_instance_of(Array)
441
+ expect(x.subtype_of.count).to eq(1)
442
+ expect(x.subtype_of[0]).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
443
+ expect(x.subtype_of[0].id).to eq("attribute_entity")
425
444
  expect(x.attributes).to be_instance_of(Array)
426
445
  expect(x.attributes.count).to eq(1)
427
446
  expect(x.attributes[0]).to be_instance_of(Expressir::Model::Attribute)
@@ -442,6 +461,10 @@ RSpec.describe Expressir::ExpressExp::Parser do
442
461
 
443
462
  entities.find{|x| x.id == "inverse_attribute_redeclared_renamed_entity"}.tap do |x|
444
463
  expect(x).to be_instance_of(Expressir::Model::Entity)
464
+ expect(x.subtype_of).to be_instance_of(Array)
465
+ expect(x.subtype_of.count).to eq(1)
466
+ expect(x.subtype_of[0]).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
467
+ expect(x.subtype_of[0].id).to eq("attribute_entity")
445
468
  expect(x.attributes).to be_instance_of(Array)
446
469
  expect(x.attributes.count).to eq(1)
447
470
  expect(x.attributes[0]).to be_instance_of(Expressir::Model::Attribute)
@@ -496,8 +519,12 @@ RSpec.describe Expressir::ExpressExp::Parser do
496
519
  expect(x.unique[0].attributes[0].id).to eq("test")
497
520
  end
498
521
 
499
- entities.find{|x| x.id == "unique_qualified_entity"}.tap do |x|
522
+ entities.find{|x| x.id == "unique_redeclared_entity"}.tap do |x|
500
523
  expect(x).to be_instance_of(Expressir::Model::Entity)
524
+ expect(x.subtype_of).to be_instance_of(Array)
525
+ expect(x.subtype_of.count).to eq(1)
526
+ expect(x.subtype_of[0]).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
527
+ expect(x.subtype_of[0].id).to eq("attribute_entity")
501
528
  expect(x.unique).to be_instance_of(Array)
502
529
  expect(x.unique.count).to eq(1)
503
530
  expect(x.unique[0]).to be_instance_of(Expressir::Model::Unique)
@@ -525,8 +552,12 @@ RSpec.describe Expressir::ExpressExp::Parser do
525
552
  expect(x.unique[0].attributes[0].id).to eq("test")
526
553
  end
527
554
 
528
- entities.find{|x| x.id == "unique_label_qualified_entity"}.tap do |x|
555
+ entities.find{|x| x.id == "unique_label_redeclared_entity"}.tap do |x|
529
556
  expect(x).to be_instance_of(Expressir::Model::Entity)
557
+ expect(x.subtype_of).to be_instance_of(Array)
558
+ expect(x.subtype_of.count).to eq(1)
559
+ expect(x.subtype_of[0]).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
560
+ expect(x.subtype_of[0].id).to eq("attribute_entity")
530
561
  expect(x.unique).to be_instance_of(Array)
531
562
  expect(x.unique.count).to eq(1)
532
563
  expect(x.unique[0]).to be_instance_of(Expressir::Model::Unique)
@@ -882,11 +913,11 @@ RSpec.describe Expressir::ExpressExp::Parser do
882
913
  functions.find{|x| x.id == "type_function"}.tap do |x|
883
914
  expect(x).to be_instance_of(Expressir::Model::Function)
884
915
  expect(x.return_type).to be_instance_of(Expressir::Model::Types::Boolean)
885
- expect(x.declarations).to be_instance_of(Array)
886
- expect(x.declarations.count).to eq(1)
887
- expect(x.declarations[0]).to be_instance_of(Expressir::Model::Type)
888
- expect(x.declarations[0].id).to eq("test")
889
- expect(x.declarations[0].type).to be_instance_of(Expressir::Model::Types::Boolean)
916
+ expect(x.types).to be_instance_of(Array)
917
+ expect(x.types.count).to eq(1)
918
+ expect(x.types[0]).to be_instance_of(Expressir::Model::Type)
919
+ expect(x.types[0].id).to eq("test")
920
+ expect(x.types[0].type).to be_instance_of(Expressir::Model::Types::Boolean)
890
921
  expect(x.statements).to be_instance_of(Array)
891
922
  expect(x.statements.count).to eq(1)
892
923
  expect(x.statements[0]).to be_instance_of(Expressir::Model::Statements::Null)
@@ -1124,11 +1155,11 @@ RSpec.describe Expressir::ExpressExp::Parser do
1124
1155
 
1125
1156
  procedures.find{|x| x.id == "type_procedure"}.tap do |x|
1126
1157
  expect(x).to be_instance_of(Expressir::Model::Procedure)
1127
- expect(x.declarations).to be_instance_of(Array)
1128
- expect(x.declarations.count).to eq(1)
1129
- expect(x.declarations[0]).to be_instance_of(Expressir::Model::Type)
1130
- expect(x.declarations[0].id).to eq("test")
1131
- expect(x.declarations[0].type).to be_instance_of(Expressir::Model::Types::Boolean)
1158
+ expect(x.types).to be_instance_of(Array)
1159
+ expect(x.types.count).to eq(1)
1160
+ expect(x.types[0]).to be_instance_of(Expressir::Model::Type)
1161
+ expect(x.types[0].id).to eq("test")
1162
+ expect(x.types[0].type).to be_instance_of(Expressir::Model::Types::Boolean)
1132
1163
  end
1133
1164
 
1134
1165
  procedures.find{|x| x.id == "constant_procedure"}.tap do |x|
@@ -1261,11 +1292,11 @@ RSpec.describe Expressir::ExpressExp::Parser do
1261
1292
  expect(x.applies_to.count).to eq(1)
1262
1293
  expect(x.applies_to[0]).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
1263
1294
  expect(x.applies_to[0].id).to eq("empty_entity")
1264
- expect(x.declarations).to be_instance_of(Array)
1265
- expect(x.declarations.count).to eq(1)
1266
- expect(x.declarations[0]).to be_instance_of(Expressir::Model::Type)
1267
- expect(x.declarations[0].id).to eq("test")
1268
- expect(x.declarations[0].type).to be_instance_of(Expressir::Model::Types::Boolean)
1295
+ expect(x.types).to be_instance_of(Array)
1296
+ expect(x.types.count).to eq(1)
1297
+ expect(x.types[0]).to be_instance_of(Expressir::Model::Type)
1298
+ expect(x.types[0].id).to eq("test")
1299
+ expect(x.types[0].type).to be_instance_of(Expressir::Model::Types::Boolean)
1269
1300
  expect(x.where).to be_instance_of(Array)
1270
1301
  expect(x.where.count).to eq(1)
1271
1302
  expect(x.where[0]).to be_instance_of(Expressir::Model::Where)
@@ -1478,1559 +1509,1565 @@ RSpec.describe Expressir::ExpressExp::Parser do
1478
1509
  expect(x.where[0].expression.value).to eq(Expressir::Model::Literals::Logical::TRUE)
1479
1510
  end
1480
1511
 
1481
- # simple types
1482
- types.find{|x| x.id == "binary_type"}.type.tap do |x|
1483
- expect(x).to be_instance_of(Expressir::Model::Types::Binary)
1484
- end
1485
-
1486
- types.find{|x| x.id == "binary_width_type"}.type.tap do |x|
1487
- expect(x).to be_instance_of(Expressir::Model::Types::Binary)
1488
- expect(x.width).to be_instance_of(Expressir::Model::Literals::Integer)
1489
- expect(x.width.value).to eq("3")
1490
- end
1491
-
1492
- types.find{|x| x.id == "binary_width_fixed_type"}.type.tap do |x|
1493
- expect(x).to be_instance_of(Expressir::Model::Types::Binary)
1494
- expect(x.width).to be_instance_of(Expressir::Model::Literals::Integer)
1495
- expect(x.width.value).to eq("3")
1496
- expect(x.fixed).to eq(true)
1497
- end
1498
-
1499
- types.find{|x| x.id == "boolean_type"}.type.tap do |x|
1500
- expect(x).to be_instance_of(Expressir::Model::Types::Boolean)
1501
- end
1502
-
1503
- types.find{|x| x.id == "integer_type"}.type.tap do |x|
1504
- expect(x).to be_instance_of(Expressir::Model::Types::Integer)
1505
- end
1506
-
1507
- types.find{|x| x.id == "logical_type"}.type.tap do |x|
1508
- expect(x).to be_instance_of(Expressir::Model::Types::Logical)
1509
- end
1510
-
1511
- types.find{|x| x.id == "number_type"}.type.tap do |x|
1512
- expect(x).to be_instance_of(Expressir::Model::Types::Number)
1513
- end
1514
-
1515
- types.find{|x| x.id == "real_type"}.type.tap do |x|
1516
- expect(x).to be_instance_of(Expressir::Model::Types::Real)
1517
- end
1518
-
1519
- types.find{|x| x.id == "real_precision_type"}.type.tap do |x|
1520
- expect(x).to be_instance_of(Expressir::Model::Types::Real)
1521
- expect(x.precision).to be_instance_of(Expressir::Model::Literals::Integer)
1522
- expect(x.precision.value).to eq("3")
1523
- end
1524
-
1525
- types.find{|x| x.id == "string_type"}.type.tap do |x|
1526
- expect(x).to be_instance_of(Expressir::Model::Types::String)
1527
- end
1528
-
1529
- types.find{|x| x.id == "string_width_type"}.type.tap do |x|
1530
- expect(x).to be_instance_of(Expressir::Model::Types::String)
1531
- expect(x.width).to be_instance_of(Expressir::Model::Literals::Integer)
1532
- expect(x.width.value).to eq("3")
1533
- end
1534
-
1535
- types.find{|x| x.id == "string_width_fixed_type"}.type.tap do |x|
1536
- expect(x).to be_instance_of(Expressir::Model::Types::String)
1537
- expect(x.width).to be_instance_of(Expressir::Model::Literals::Integer)
1538
- expect(x.width.value).to eq("3")
1539
- expect(x.fixed).to eq(true)
1540
- end
1541
-
1542
- # aggregation types
1543
- types.find{|x| x.id == "array_type"}.type.tap do |x|
1544
- expect(x).to be_instance_of(Expressir::Model::Types::Array)
1545
- expect(x.bound1).to be_instance_of(Expressir::Model::Literals::Integer)
1546
- expect(x.bound1.value).to eq("1")
1547
- expect(x.bound2).to be_instance_of(Expressir::Model::Literals::Integer)
1548
- expect(x.bound2.value).to eq("9")
1549
- expect(x.base_type).to be_instance_of(Expressir::Model::Types::String)
1550
- end
1551
-
1552
- types.find{|x| x.id == "array_optional_type"}.type.tap do |x|
1553
- expect(x).to be_instance_of(Expressir::Model::Types::Array)
1554
- expect(x.bound1).to be_instance_of(Expressir::Model::Literals::Integer)
1555
- expect(x.bound1.value).to eq("1")
1556
- expect(x.bound2).to be_instance_of(Expressir::Model::Literals::Integer)
1557
- expect(x.bound2.value).to eq("9")
1558
- expect(x.optional).to eq(true)
1559
- expect(x.base_type).to be_instance_of(Expressir::Model::Types::String)
1560
- end
1561
-
1562
- types.find{|x| x.id == "array_unique_type"}.type.tap do |x|
1563
- expect(x).to be_instance_of(Expressir::Model::Types::Array)
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.unique).to eq(true)
1569
- expect(x.base_type).to be_instance_of(Expressir::Model::Types::String)
1570
- end
1571
-
1572
- types.find{|x| x.id == "array_optional_unique_type"}.type.tap do |x|
1573
- expect(x).to be_instance_of(Expressir::Model::Types::Array)
1574
- expect(x.bound1).to be_instance_of(Expressir::Model::Literals::Integer)
1575
- expect(x.bound1.value).to eq("1")
1576
- expect(x.bound2).to be_instance_of(Expressir::Model::Literals::Integer)
1577
- expect(x.bound2.value).to eq("9")
1578
- expect(x.optional).to eq(true)
1579
- expect(x.unique).to eq(true)
1580
- expect(x.base_type).to be_instance_of(Expressir::Model::Types::String)
1581
- end
1582
-
1583
- types.find{|x| x.id == "bag_type"}.type.tap do |x|
1584
- expect(x).to be_instance_of(Expressir::Model::Types::Bag)
1585
- expect(x.base_type).to be_instance_of(Expressir::Model::Types::String)
1586
- end
1587
-
1588
- types.find{|x| x.id == "bag_bound_type"}.type.tap do |x|
1589
- expect(x).to be_instance_of(Expressir::Model::Types::Bag)
1590
- expect(x.bound1).to be_instance_of(Expressir::Model::Literals::Integer)
1591
- expect(x.bound1.value).to eq("1")
1592
- expect(x.bound2).to be_instance_of(Expressir::Model::Literals::Integer)
1593
- expect(x.bound2.value).to eq("9")
1594
- expect(x.base_type).to be_instance_of(Expressir::Model::Types::String)
1595
- end
1596
-
1597
- types.find{|x| x.id == "list_type"}.type.tap do |x|
1598
- expect(x).to be_instance_of(Expressir::Model::Types::List)
1599
- expect(x.base_type).to be_instance_of(Expressir::Model::Types::String)
1600
- end
1601
-
1602
- types.find{|x| x.id == "list_bound_type"}.type.tap do |x|
1603
- expect(x).to be_instance_of(Expressir::Model::Types::List)
1604
- expect(x.bound1).to be_instance_of(Expressir::Model::Literals::Integer)
1605
- expect(x.bound1.value).to eq("1")
1606
- expect(x.bound2).to be_instance_of(Expressir::Model::Literals::Integer)
1607
- expect(x.bound2.value).to eq("9")
1608
- expect(x.base_type).to be_instance_of(Expressir::Model::Types::String)
1609
- end
1610
-
1611
- types.find{|x| x.id == "list_unique_type"}.type.tap do |x|
1612
- expect(x).to be_instance_of(Expressir::Model::Types::List)
1613
- expect(x.unique).to eq(true)
1614
- expect(x.base_type).to be_instance_of(Expressir::Model::Types::String)
1615
- end
1616
-
1617
- types.find{|x| x.id == "list_bound_unique_type"}.type.tap do |x|
1618
- expect(x).to be_instance_of(Expressir::Model::Types::List)
1619
- expect(x.bound1).to be_instance_of(Expressir::Model::Literals::Integer)
1620
- expect(x.bound1.value).to eq("1")
1621
- expect(x.bound2).to be_instance_of(Expressir::Model::Literals::Integer)
1622
- expect(x.bound2.value).to eq("9")
1623
- expect(x.unique).to eq(true)
1624
- expect(x.base_type).to be_instance_of(Expressir::Model::Types::String)
1625
- end
1626
-
1627
- types.find{|x| x.id == "set_type"}.type.tap do |x|
1628
- expect(x).to be_instance_of(Expressir::Model::Types::Set)
1629
- expect(x.base_type).to be_instance_of(Expressir::Model::Types::String)
1630
- end
1631
-
1632
- types.find{|x| x.id == "set_bound_type"}.type.tap do |x|
1633
- expect(x).to be_instance_of(Expressir::Model::Types::Set)
1634
- expect(x.bound1).to be_instance_of(Expressir::Model::Literals::Integer)
1635
- expect(x.bound1.value).to eq("1")
1636
- expect(x.bound2).to be_instance_of(Expressir::Model::Literals::Integer)
1637
- expect(x.bound2.value).to eq("9")
1638
- expect(x.base_type).to be_instance_of(Expressir::Model::Types::String)
1639
- end
1640
-
1641
- # constructed types
1642
- types.find{|x| x.id == "select_type"}.type.tap do |x|
1643
- expect(x).to be_instance_of(Expressir::Model::Types::Select)
1644
- end
1645
-
1646
- types.find{|x| x.id == "select_extensible_type"}.type.tap do |x|
1647
- expect(x).to be_instance_of(Expressir::Model::Types::Select)
1648
- expect(x.extensible).to eq(true)
1649
- end
1650
-
1651
- types.find{|x| x.id == "select_extensible_generic_entity_type"}.type.tap do |x|
1652
- expect(x).to be_instance_of(Expressir::Model::Types::Select)
1653
- expect(x.extensible).to eq(true)
1654
- expect(x.generic_entity).to eq(true)
1655
- end
1656
-
1657
- types.find{|x| x.id == "select_list_type"}.type.tap do |x|
1658
- expect(x).to be_instance_of(Expressir::Model::Types::Select)
1659
- expect(x.items).to be_instance_of(Array)
1660
- expect(x.items.count).to eq(1)
1661
- expect(x.items[0]).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
1662
- expect(x.items[0].id).to eq("empty_type")
1663
- end
1664
-
1665
- types.find{|x| x.id == "select_extension_type_ref_type"}.type.tap do |x|
1666
- expect(x).to be_instance_of(Expressir::Model::Types::Select)
1667
- expect(x.extension_type).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
1668
- expect(x.extension_type.id).to eq("select_type")
1669
- end
1670
-
1671
- types.find{|x| x.id == "select_extension_type_ref_list_type"}.type.tap do |x|
1672
- expect(x).to be_instance_of(Expressir::Model::Types::Select)
1673
- expect(x.extension_type).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
1674
- expect(x.extension_type.id).to eq("select_type")
1675
- expect(x.extension_items).to be_instance_of(Array)
1676
- expect(x.extension_items.count).to eq(1)
1677
- expect(x.extension_items[0]).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
1678
- expect(x.extension_items[0].id).to eq("empty_type")
1679
- end
1680
-
1681
- types.find{|x| x.id == "enumeration_type"}.type.tap do |x|
1682
- expect(x).to be_instance_of(Expressir::Model::Types::Enumeration)
1683
- end
1684
-
1685
- types.find{|x| x.id == "enumeration_extensible_type"}.type.tap do |x|
1686
- expect(x).to be_instance_of(Expressir::Model::Types::Enumeration)
1687
- expect(x.extensible).to eq(true)
1688
- end
1689
-
1690
- types.find{|x| x.id == "enumeration_list_type"}.type.tap do |x|
1691
- expect(x).to be_instance_of(Expressir::Model::Types::Enumeration)
1692
- expect(x.items).to be_instance_of(Array)
1693
- expect(x.items.count).to eq(1)
1694
- expect(x.items[0]).to be_instance_of(Expressir::Model::EnumerationItem)
1695
- expect(x.items[0].id).to eq("test")
1696
- end
1697
-
1698
- types.find{|x| x.id == "enumeration_extension_type_ref_type"}.type.tap do |x|
1699
- expect(x).to be_instance_of(Expressir::Model::Types::Enumeration)
1700
- expect(x.extension_type).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
1701
- expect(x.extension_type.id).to eq("enumeration_type")
1702
- end
1703
-
1704
- types.find{|x| x.id == "enumeration_extension_type_ref_list_type"}.type.tap do |x|
1705
- expect(x).to be_instance_of(Expressir::Model::Types::Enumeration)
1706
- expect(x.extension_type).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
1707
- expect(x.extension_type.id).to eq("enumeration_type")
1708
- expect(x.extension_items).to be_instance_of(Array)
1709
- expect(x.extension_items[0]).to be_instance_of(Expressir::Model::EnumerationItem)
1710
- expect(x.extension_items[0].id).to eq("test")
1711
- end
1712
-
1713
- # statements
1714
- functions.find{|x| x.id == "alias_simple_reference_statement"}.statements[0].tap do |x|
1715
- expect(x).to be_instance_of(Expressir::Model::Statements::Alias)
1716
- expect(x.id).to eq("test")
1717
- expect(x.expression).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
1718
- expect(x.expression.id).to eq("test")
1719
- expect(x.statements).to be_instance_of(Array)
1720
- expect(x.statements.count).to eq(1)
1721
- expect(x.statements[0]).to be_instance_of(Expressir::Model::Statements::Null)
1722
- end
1723
-
1724
- functions.find{|x| x.id == "alias_attribute_reference_statement"}.statements[0].tap do |x|
1725
- expect(x).to be_instance_of(Expressir::Model::Statements::Alias)
1726
- expect(x.id).to eq("test")
1727
- expect(x.expression).to be_instance_of(Expressir::Model::Expressions::AttributeReference)
1728
- expect(x.expression.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
1729
- expect(x.expression.ref.id).to eq("test")
1730
- expect(x.expression.attribute).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
1731
- expect(x.expression.attribute.id).to eq("test")
1732
- expect(x.statements).to be_instance_of(Array)
1733
- expect(x.statements.count).to eq(1)
1734
- expect(x.statements[0]).to be_instance_of(Expressir::Model::Statements::Null)
1735
- end
1736
-
1737
- functions.find{|x| x.id == "alias_group_reference_statement"}.statements[0].tap do |x|
1738
- expect(x).to be_instance_of(Expressir::Model::Statements::Alias)
1739
- expect(x.id).to eq("test")
1740
- expect(x.expression).to be_instance_of(Expressir::Model::Expressions::GroupReference)
1741
- expect(x.expression.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
1742
- expect(x.expression.ref.id).to eq("test")
1743
- expect(x.expression.entity).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
1744
- expect(x.expression.entity.id).to eq("test")
1745
- expect(x.statements).to be_instance_of(Array)
1746
- expect(x.statements.count).to eq(1)
1747
- expect(x.statements[0]).to be_instance_of(Expressir::Model::Statements::Null)
1748
- end
1749
-
1750
- functions.find{|x| x.id == "alias_index_reference_statement"}.statements[0].tap do |x|
1751
- expect(x).to be_instance_of(Expressir::Model::Statements::Alias)
1752
- expect(x.id).to eq("test")
1753
- expect(x.expression).to be_instance_of(Expressir::Model::Expressions::IndexReference)
1754
- expect(x.expression.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
1755
- expect(x.expression.ref.id).to eq("test")
1756
- expect(x.expression.index1).to be_instance_of(Expressir::Model::Literals::Integer)
1757
- expect(x.expression.index1.value).to eq("1")
1758
- expect(x.statements).to be_instance_of(Array)
1759
- expect(x.statements.count).to eq(1)
1760
- expect(x.statements[0]).to be_instance_of(Expressir::Model::Statements::Null)
1761
- end
1762
-
1763
- functions.find{|x| x.id == "alias_index2_reference_statement"}.statements[0].tap do |x|
1764
- expect(x).to be_instance_of(Expressir::Model::Statements::Alias)
1765
- expect(x.id).to eq("test")
1766
- expect(x.expression).to be_instance_of(Expressir::Model::Expressions::IndexReference)
1767
- expect(x.expression.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
1768
- expect(x.expression.ref.id).to eq("test")
1769
- expect(x.expression.index1).to be_instance_of(Expressir::Model::Literals::Integer)
1770
- expect(x.expression.index1.value).to eq("1")
1771
- expect(x.expression.index2).to be_instance_of(Expressir::Model::Literals::Integer)
1772
- expect(x.expression.index2.value).to eq("9")
1773
- expect(x.statements).to be_instance_of(Array)
1774
- expect(x.statements.count).to eq(1)
1775
- expect(x.statements[0]).to be_instance_of(Expressir::Model::Statements::Null)
1776
- end
1777
-
1778
- functions.find{|x| x.id == "assignment_simple_reference_statement"}.statements[0].tap do |x|
1779
- expect(x).to be_instance_of(Expressir::Model::Statements::Assignment)
1780
- expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
1781
- expect(x.ref.id).to eq("test")
1782
- expect(x.expression).to be_instance_of(Expressir::Model::Literals::Logical)
1783
- expect(x.expression.value).to eq(Expressir::Model::Literals::Logical::TRUE)
1784
- end
1785
-
1786
- functions.find{|x| x.id == "assignment_attribute_reference_statement"}.statements[0].tap do |x|
1787
- expect(x).to be_instance_of(Expressir::Model::Statements::Assignment)
1788
- expect(x.ref).to be_instance_of(Expressir::Model::Expressions::AttributeReference)
1789
- expect(x.ref.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
1790
- expect(x.ref.ref.id).to eq("test")
1791
- expect(x.ref.attribute).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
1792
- expect(x.ref.attribute.id).to eq("test")
1793
- expect(x.expression).to be_instance_of(Expressir::Model::Literals::Logical)
1794
- expect(x.expression.value).to eq(Expressir::Model::Literals::Logical::TRUE)
1795
- end
1796
-
1797
- functions.find{|x| x.id == "assignment_group_reference_statement"}.statements[0].tap do |x|
1798
- expect(x).to be_instance_of(Expressir::Model::Statements::Assignment)
1799
- expect(x.ref).to be_instance_of(Expressir::Model::Expressions::GroupReference)
1800
- expect(x.ref.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
1801
- expect(x.ref.ref.id).to eq("test")
1802
- expect(x.ref.entity).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
1803
- expect(x.ref.entity.id).to eq("test")
1804
- expect(x.expression).to be_instance_of(Expressir::Model::Literals::Logical)
1805
- expect(x.expression.value).to eq(Expressir::Model::Literals::Logical::TRUE)
1806
- end
1807
-
1808
- functions.find{|x| x.id == "assignment_index_reference_statement"}.statements[0].tap do |x|
1809
- expect(x).to be_instance_of(Expressir::Model::Statements::Assignment)
1810
- expect(x.ref).to be_instance_of(Expressir::Model::Expressions::IndexReference)
1811
- expect(x.ref.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
1812
- expect(x.ref.ref.id).to eq("test")
1813
- expect(x.ref.index1).to be_instance_of(Expressir::Model::Literals::Integer)
1814
- expect(x.ref.index1.value).to eq("1")
1815
- expect(x.expression).to be_instance_of(Expressir::Model::Literals::Logical)
1816
- expect(x.expression.value).to eq(Expressir::Model::Literals::Logical::TRUE)
1817
- end
1818
-
1819
- functions.find{|x| x.id == "assignment_index2_reference_statement"}.statements[0].tap do |x|
1820
- expect(x).to be_instance_of(Expressir::Model::Statements::Assignment)
1821
- expect(x.ref).to be_instance_of(Expressir::Model::Expressions::IndexReference)
1822
- expect(x.ref.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
1823
- expect(x.ref.ref.id).to eq("test")
1824
- expect(x.ref.index1).to be_instance_of(Expressir::Model::Literals::Integer)
1825
- expect(x.ref.index1.value).to eq("1")
1826
- expect(x.ref.index2).to be_instance_of(Expressir::Model::Literals::Integer)
1827
- expect(x.ref.index2.value).to eq("9")
1828
- expect(x.expression).to be_instance_of(Expressir::Model::Literals::Logical)
1829
- expect(x.expression.value).to eq(Expressir::Model::Literals::Logical::TRUE)
1830
- end
1831
-
1832
- functions.find{|x| x.id == "case_statement"}.statements[0].tap do |x|
1833
- expect(x).to be_instance_of(Expressir::Model::Statements::Case)
1834
- expect(x.expression).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
1835
- expect(x.expression.id).to eq("test")
1836
- expect(x.actions).to be_instance_of(Array)
1837
- expect(x.actions.count).to eq(1)
1838
- expect(x.actions[0]).to be_instance_of(Expressir::Model::Statements::CaseAction)
1839
- expect(x.actions[0].labels).to be_instance_of(Array)
1840
- expect(x.actions[0].labels.count).to eq(1)
1841
- expect(x.actions[0].labels[0]).to be_instance_of(Expressir::Model::Literals::Logical)
1842
- expect(x.actions[0].labels[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
1843
- expect(x.actions[0].statement).to be_instance_of(Expressir::Model::Statements::Null)
1844
- end
1845
-
1846
- functions.find{|x| x.id == "case_multiple_statement"}.statements[0].tap do |x|
1847
- expect(x).to be_instance_of(Expressir::Model::Statements::Case)
1848
- expect(x.expression).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
1849
- expect(x.expression.id).to eq("test")
1850
- expect(x.actions).to be_instance_of(Array)
1851
- expect(x.actions.count).to eq(2)
1852
- expect(x.actions[0]).to be_instance_of(Expressir::Model::Statements::CaseAction)
1853
- expect(x.actions[0].labels).to be_instance_of(Array)
1854
- expect(x.actions[0].labels.count).to eq(1)
1855
- expect(x.actions[0].labels[0]).to be_instance_of(Expressir::Model::Literals::Logical)
1856
- expect(x.actions[0].labels[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
1857
- expect(x.actions[0].statement).to be_instance_of(Expressir::Model::Statements::Null)
1858
- expect(x.actions[1]).to be_instance_of(Expressir::Model::Statements::CaseAction)
1859
- expect(x.actions[1].labels).to be_instance_of(Array)
1860
- expect(x.actions[1].labels.count).to eq(1)
1861
- expect(x.actions[1].labels[0]).to be_instance_of(Expressir::Model::Literals::Logical)
1862
- expect(x.actions[1].labels[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
1863
- expect(x.actions[1].statement).to be_instance_of(Expressir::Model::Statements::Null)
1864
- end
1865
-
1866
- functions.find{|x| x.id == "case_multiple_shorthand_statement"}.statements[0].tap do |x|
1867
- expect(x).to be_instance_of(Expressir::Model::Statements::Case)
1868
- expect(x.expression).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
1869
- expect(x.expression.id).to eq("test")
1870
- expect(x.actions).to be_instance_of(Array)
1871
- expect(x.actions.count).to eq(1)
1872
- expect(x.actions[0]).to be_instance_of(Expressir::Model::Statements::CaseAction)
1873
- expect(x.actions[0].labels).to be_instance_of(Array)
1874
- expect(x.actions[0].labels.count).to eq(2)
1875
- expect(x.actions[0].labels[0]).to be_instance_of(Expressir::Model::Literals::Logical)
1876
- expect(x.actions[0].labels[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
1877
- expect(x.actions[0].labels[1]).to be_instance_of(Expressir::Model::Literals::Logical)
1878
- expect(x.actions[0].labels[1].value).to eq(Expressir::Model::Literals::Logical::TRUE)
1879
- expect(x.actions[0].statement).to be_instance_of(Expressir::Model::Statements::Null)
1880
- end
1881
-
1882
- functions.find{|x| x.id == "case_otherwise_statement"}.statements[0].tap do |x|
1883
- expect(x).to be_instance_of(Expressir::Model::Statements::Case)
1884
- expect(x.expression).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
1885
- expect(x.expression.id).to eq("test")
1886
- expect(x.actions).to be_instance_of(Array)
1887
- expect(x.actions.count).to eq(1)
1888
- expect(x.actions[0]).to be_instance_of(Expressir::Model::Statements::CaseAction)
1889
- expect(x.actions[0].labels).to be_instance_of(Array)
1890
- expect(x.actions[0].labels.count).to eq(1)
1891
- expect(x.actions[0].labels[0]).to be_instance_of(Expressir::Model::Literals::Logical)
1892
- expect(x.actions[0].labels[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
1893
- expect(x.actions[0].statement).to be_instance_of(Expressir::Model::Statements::Null)
1894
- expect(x.otherwise_statement).to be_instance_of(Expressir::Model::Statements::Null)
1895
- end
1896
-
1897
- functions.find{|x| x.id == "compound_statement"}.statements[0].tap do |x|
1898
- expect(x).to be_instance_of(Expressir::Model::Statements::Compound)
1899
- expect(x.statements).to be_instance_of(Array)
1900
- expect(x.statements.count).to eq(1)
1901
- expect(x.statements[0]).to be_instance_of(Expressir::Model::Statements::Null)
1902
- end
1903
-
1904
- functions.find{|x| x.id == "escape_statement"}.statements[0].tap do |x|
1905
- expect(x).to be_instance_of(Expressir::Model::Statements::Escape)
1906
- end
1907
-
1908
- functions.find{|x| x.id == "if_statement"}.statements[0].tap do |x|
1909
- expect(x).to be_instance_of(Expressir::Model::Statements::If)
1910
- expect(x.expression).to be_instance_of(Expressir::Model::Literals::Logical)
1911
- expect(x.expression.value).to eq(Expressir::Model::Literals::Logical::TRUE)
1912
- expect(x.statements).to be_instance_of(Array)
1913
- expect(x.statements.count).to eq(1)
1914
- expect(x.statements[0]).to be_instance_of(Expressir::Model::Statements::Null)
1915
- end
1916
-
1917
- functions.find{|x| x.id == "if2_statement"}.statements[0].tap do |x|
1918
- expect(x).to be_instance_of(Expressir::Model::Statements::If)
1919
- expect(x.expression).to be_instance_of(Expressir::Model::Literals::Logical)
1920
- expect(x.expression.value).to eq(Expressir::Model::Literals::Logical::TRUE)
1921
- expect(x.statements).to be_instance_of(Array)
1922
- expect(x.statements.count).to eq(2)
1923
- expect(x.statements[0]).to be_instance_of(Expressir::Model::Statements::Null)
1924
- expect(x.statements[1]).to be_instance_of(Expressir::Model::Statements::Null)
1925
- end
1926
-
1927
- functions.find{|x| x.id == "if_else_statement"}.statements[0].tap do |x|
1928
- expect(x).to be_instance_of(Expressir::Model::Statements::If)
1929
- expect(x.expression).to be_instance_of(Expressir::Model::Literals::Logical)
1930
- expect(x.expression.value).to eq(Expressir::Model::Literals::Logical::TRUE)
1931
- expect(x.statements).to be_instance_of(Array)
1932
- expect(x.statements.count).to eq(1)
1933
- expect(x.statements[0]).to be_instance_of(Expressir::Model::Statements::Null)
1934
- expect(x.else_statements).to be_instance_of(Array)
1935
- expect(x.else_statements.count).to eq(1)
1936
- expect(x.else_statements[0]).to be_instance_of(Expressir::Model::Statements::Null)
1937
- end
1938
-
1939
- functions.find{|x| x.id == "if2_else_statement"}.statements[0].tap do |x|
1940
- expect(x).to be_instance_of(Expressir::Model::Statements::If)
1941
- expect(x.expression).to be_instance_of(Expressir::Model::Literals::Logical)
1942
- expect(x.expression.value).to eq(Expressir::Model::Literals::Logical::TRUE)
1943
- expect(x.statements).to be_instance_of(Array)
1944
- expect(x.statements.count).to eq(2)
1945
- expect(x.statements[0]).to be_instance_of(Expressir::Model::Statements::Null)
1946
- expect(x.statements[1]).to be_instance_of(Expressir::Model::Statements::Null)
1947
- expect(x.else_statements).to be_instance_of(Array)
1948
- expect(x.else_statements.count).to eq(1)
1949
- expect(x.else_statements[0]).to be_instance_of(Expressir::Model::Statements::Null)
1950
- end
1951
-
1952
- functions.find{|x| x.id == "if_else2_statement"}.statements[0].tap do |x|
1953
- expect(x).to be_instance_of(Expressir::Model::Statements::If)
1954
- expect(x.expression).to be_instance_of(Expressir::Model::Literals::Logical)
1955
- expect(x.expression.value).to eq(Expressir::Model::Literals::Logical::TRUE)
1956
- expect(x.statements).to be_instance_of(Array)
1957
- expect(x.statements.count).to eq(1)
1958
- expect(x.statements[0]).to be_instance_of(Expressir::Model::Statements::Null)
1959
- expect(x.else_statements).to be_instance_of(Array)
1960
- expect(x.else_statements.count).to eq(2)
1961
- expect(x.else_statements[0]).to be_instance_of(Expressir::Model::Statements::Null)
1962
- expect(x.else_statements[1]).to be_instance_of(Expressir::Model::Statements::Null)
1963
- end
1964
-
1965
- functions.find{|x| x.id == "if2_else2_statement"}.statements[0].tap do |x|
1966
- expect(x).to be_instance_of(Expressir::Model::Statements::If)
1967
- expect(x.expression).to be_instance_of(Expressir::Model::Literals::Logical)
1968
- expect(x.expression.value).to eq(Expressir::Model::Literals::Logical::TRUE)
1969
- expect(x.statements).to be_instance_of(Array)
1970
- expect(x.statements.count).to eq(2)
1971
- expect(x.statements[0]).to be_instance_of(Expressir::Model::Statements::Null)
1972
- expect(x.statements[1]).to be_instance_of(Expressir::Model::Statements::Null)
1973
- expect(x.else_statements).to be_instance_of(Array)
1974
- expect(x.else_statements.count).to eq(2)
1975
- expect(x.else_statements[0]).to be_instance_of(Expressir::Model::Statements::Null)
1976
- expect(x.else_statements[1]).to be_instance_of(Expressir::Model::Statements::Null)
1977
- end
1978
-
1979
- functions.find{|x| x.id == "null_statement"}.statements[0].tap do |x|
1980
- expect(x).to be_instance_of(Expressir::Model::Statements::Null)
1981
- end
1982
-
1983
- functions.find{|x| x.id == "call_statement"}.statements[0].tap do |x|
1984
- expect(x).to be_instance_of(Expressir::Model::Statements::Call)
1985
- expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
1986
- expect(x.ref.id).to eq("empty_procedure")
1987
- end
1988
-
1989
- functions.find{|x| x.id == "call_parameter_statement"}.statements[0].tap do |x|
1990
- expect(x).to be_instance_of(Expressir::Model::Statements::Call)
1991
- expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
1992
- expect(x.ref.id).to eq("empty_procedure")
1993
- expect(x.parameters).to be_instance_of(Array)
1994
- expect(x.parameters.count).to eq(1)
1995
- expect(x.parameters[0]).to be_instance_of(Expressir::Model::Literals::Logical)
1996
- expect(x.parameters[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
1997
- end
1998
-
1999
- functions.find{|x| x.id == "call_parameter2_statement"}.statements[0].tap do |x|
2000
- expect(x).to be_instance_of(Expressir::Model::Statements::Call)
2001
- expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2002
- expect(x.ref.id).to eq("empty_procedure")
2003
- expect(x.parameters).to be_instance_of(Array)
2004
- expect(x.parameters.count).to eq(2)
2005
- expect(x.parameters[0]).to be_instance_of(Expressir::Model::Literals::Logical)
2006
- expect(x.parameters[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
2007
- expect(x.parameters[1]).to be_instance_of(Expressir::Model::Literals::Logical)
2008
- expect(x.parameters[1].value).to eq(Expressir::Model::Literals::Logical::TRUE)
2009
- end
2010
-
2011
- functions.find{|x| x.id == "call_insert_statement"}.statements[0].tap do |x|
2012
- expect(x).to be_instance_of(Expressir::Model::Statements::Call)
2013
- expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2014
- expect(x.ref.id).to eq("INSERT")
2015
- expect(x.parameters).to be_instance_of(Array)
2016
- expect(x.parameters.count).to eq(1)
2017
- expect(x.parameters[0]).to be_instance_of(Expressir::Model::Literals::Logical)
2018
- expect(x.parameters[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
2019
- end
2020
-
2021
- functions.find{|x| x.id == "call_remove_statement"}.statements[0].tap do |x|
2022
- expect(x).to be_instance_of(Expressir::Model::Statements::Call)
2023
- expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2024
- expect(x.ref.id).to eq("REMOVE")
2025
- expect(x.parameters).to be_instance_of(Array)
2026
- expect(x.parameters.count).to eq(1)
2027
- expect(x.parameters[0]).to be_instance_of(Expressir::Model::Literals::Logical)
2028
- expect(x.parameters[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
2029
- end
2030
-
2031
- functions.find{|x| x.id == "repeat_statement"}.statements[0].tap do |x|
2032
- expect(x).to be_instance_of(Expressir::Model::Statements::Repeat)
2033
- expect(x.statements).to be_instance_of(Array)
2034
- expect(x.statements.count).to eq(1)
2035
- expect(x.statements[0]).to be_instance_of(Expressir::Model::Statements::Null)
2036
- end
2037
-
2038
- functions.find{|x| x.id == "repeat_variable_statement"}.statements[0].tap do |x|
2039
- expect(x).to be_instance_of(Expressir::Model::Statements::Repeat)
2040
- expect(x.id).to eq("test")
2041
- expect(x.bound1).to be_instance_of(Expressir::Model::Literals::Integer)
2042
- expect(x.bound1.value).to eq("1")
2043
- expect(x.bound2).to be_instance_of(Expressir::Model::Literals::Integer)
2044
- expect(x.bound2.value).to eq("9")
2045
- expect(x.statements).to be_instance_of(Array)
2046
- expect(x.statements.count).to eq(1)
2047
- expect(x.statements[0]).to be_instance_of(Expressir::Model::Statements::Null)
2048
- end
2049
-
2050
- functions.find{|x| x.id == "repeat_variable_increment_statement"}.statements[0].tap do |x|
2051
- expect(x).to be_instance_of(Expressir::Model::Statements::Repeat)
2052
- expect(x.id).to eq("test")
2053
- expect(x.bound1).to be_instance_of(Expressir::Model::Literals::Integer)
2054
- expect(x.bound1.value).to eq("1")
2055
- expect(x.bound2).to be_instance_of(Expressir::Model::Literals::Integer)
2056
- expect(x.bound2.value).to eq("9")
2057
- expect(x.increment).to be_instance_of(Expressir::Model::Literals::Integer)
2058
- expect(x.increment.value).to eq("2")
2059
- expect(x.statements).to be_instance_of(Array)
2060
- expect(x.statements.count).to eq(1)
2061
- expect(x.statements[0]).to be_instance_of(Expressir::Model::Statements::Null)
2062
- end
2063
-
2064
- functions.find{|x| x.id == "repeat_while_statement"}.statements[0].tap do |x|
2065
- expect(x).to be_instance_of(Expressir::Model::Statements::Repeat)
2066
- expect(x.while_expression).to be_instance_of(Expressir::Model::Literals::Logical)
2067
- expect(x.while_expression.value).to eq(Expressir::Model::Literals::Logical::TRUE)
2068
- expect(x.statements).to be_instance_of(Array)
2069
- expect(x.statements.count).to eq(1)
2070
- expect(x.statements[0]).to be_instance_of(Expressir::Model::Statements::Null)
2071
- end
2072
-
2073
- functions.find{|x| x.id == "repeat_until_statement"}.statements[0].tap do |x|
2074
- expect(x).to be_instance_of(Expressir::Model::Statements::Repeat)
2075
- expect(x.until_expression).to be_instance_of(Expressir::Model::Literals::Logical)
2076
- expect(x.until_expression.value).to eq(Expressir::Model::Literals::Logical::TRUE)
2077
- expect(x.statements).to be_instance_of(Array)
2078
- expect(x.statements.count).to eq(1)
2079
- expect(x.statements[0]).to be_instance_of(Expressir::Model::Statements::Null)
2080
- end
2081
-
2082
- functions.find{|x| x.id == "return_statement"}.statements[0].tap do |x|
2083
- expect(x).to be_instance_of(Expressir::Model::Statements::Return)
2084
- end
2085
-
2086
- functions.find{|x| x.id == "return_expression_statement"}.statements[0].tap do |x|
2087
- expect(x).to be_instance_of(Expressir::Model::Statements::Return)
2088
- expect(x.expression).to be_instance_of(Expressir::Model::Literals::Logical)
2089
- expect(x.expression.value).to eq(Expressir::Model::Literals::Logical::TRUE)
2090
- end
2091
-
2092
- functions.find{|x| x.id == "skip_statement"}.statements[0].tap do |x|
2093
- expect(x).to be_instance_of(Expressir::Model::Statements::Skip)
2094
- end
2095
-
2096
- # literal expressions
2097
- functions.find{|x| x.id == "binary_expression"}.statements[0].expression.tap do |x|
2098
- expect(x).to be_instance_of(Expressir::Model::Literals::Binary)
2099
- expect(x.value).to eq("011110000111100001111000")
2100
- end
2101
-
2102
- functions.find{|x| x.id == "integer_expression"}.statements[0].expression.tap do |x|
2103
- expect(x).to be_instance_of(Expressir::Model::Literals::Integer)
2104
- expect(x.value).to eq("999")
2105
- end
2106
-
2107
- functions.find{|x| x.id == "true_logical_expression"}.statements[0].expression.tap do |x|
2108
- expect(x).to be_instance_of(Expressir::Model::Literals::Logical)
2109
- expect(x.value).to eq(Expressir::Model::Literals::Logical::TRUE)
2110
- end
2111
-
2112
- functions.find{|x| x.id == "false_logical_expression"}.statements[0].expression.tap do |x|
2113
- expect(x).to be_instance_of(Expressir::Model::Literals::Logical)
2114
- expect(x.value).to eq(Expressir::Model::Literals::Logical::FALSE)
2115
- end
2116
-
2117
- functions.find{|x| x.id == "unknown_logical_expression"}.statements[0].expression.tap do |x|
2118
- expect(x).to be_instance_of(Expressir::Model::Literals::Logical)
2119
- expect(x.value).to eq(Expressir::Model::Literals::Logical::UNKNOWN)
2120
- end
2121
-
2122
- functions.find{|x| x.id == "real_expression"}.statements[0].expression.tap do |x|
2123
- expect(x).to be_instance_of(Expressir::Model::Literals::Real)
2124
- expect(x.value).to eq("999.999")
2125
- end
2126
-
2127
- functions.find{|x| x.id == "simple_string_expression"}.statements[0].expression.tap do |x|
2128
- expect(x).to be_instance_of(Expressir::Model::Literals::String)
2129
- expect(x.value).to eq("xxx")
2130
- end
2131
-
2132
- functions.find{|x| x.id == "utf8_simple_string_expression"}.statements[0].expression.tap do |x|
2133
- expect(x).to be_instance_of(Expressir::Model::Literals::String)
2134
- expect(x.value).to eq("UTF8 test: Příliš žluťoučký kůň úpěl ďábelské ódy.")
2135
- end
2136
-
2137
- functions.find{|x| x.id == "encoded_string_expression"}.statements[0].expression.tap do |x|
2138
- expect(x).to be_instance_of(Expressir::Model::Literals::String)
2139
- expect(x.value).to eq("000000780000007800000078")
2140
- expect(x.encoded).to eq(true)
2141
- end
2142
-
2143
- # constant expressions
2144
- functions.find{|x| x.id == "const_e_expression"}.statements[0].expression.tap do |x|
2145
- expect(x).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2146
- expect(x.id).to eq("CONST_E")
2147
- end
2148
-
2149
- functions.find{|x| x.id == "indeterminate_expression"}.statements[0].expression.tap do |x|
2150
- expect(x).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2151
- expect(x.id).to eq("?")
2152
- end
2153
-
2154
- functions.find{|x| x.id == "pi_expression"}.statements[0].expression.tap do |x|
2155
- expect(x).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2156
- expect(x.id).to eq("PI")
2157
- end
2158
-
2159
- functions.find{|x| x.id == "self_expression"}.statements[0].expression.tap do |x|
2160
- expect(x).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2161
- expect(x.id).to eq("SELF")
2162
- end
2163
-
2164
- # function expressions
2165
- functions.find{|x| x.id == "abs_expression"}.statements[0].expression.tap do |x|
2166
- expect(x).to be_instance_of(Expressir::Model::Expressions::Call)
2167
- expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2168
- expect(x.ref.id).to eq("ABS")
2169
- expect(x.parameters).to be_instance_of(Array)
2170
- expect(x.parameters.count).to eq(1)
2171
- expect(x.parameters[0]).to be_instance_of(Expressir::Model::Literals::Logical)
2172
- expect(x.parameters[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
2173
- end
2174
-
2175
- functions.find{|x| x.id == "acos_expression"}.statements[0].expression.tap do |x|
2176
- expect(x).to be_instance_of(Expressir::Model::Expressions::Call)
2177
- expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2178
- expect(x.ref.id).to eq("ACOS")
2179
- expect(x.parameters).to be_instance_of(Array)
2180
- expect(x.parameters.count).to eq(1)
2181
- expect(x.parameters[0]).to be_instance_of(Expressir::Model::Literals::Logical)
2182
- expect(x.parameters[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
2183
- end
2184
-
2185
- functions.find{|x| x.id == "asin_expression"}.statements[0].expression.tap do |x|
2186
- expect(x).to be_instance_of(Expressir::Model::Expressions::Call)
2187
- expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2188
- expect(x.ref.id).to eq("ASIN")
2189
- expect(x.parameters).to be_instance_of(Array)
2190
- expect(x.parameters.count).to eq(1)
2191
- expect(x.parameters[0]).to be_instance_of(Expressir::Model::Literals::Logical)
2192
- expect(x.parameters[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
2193
- end
2194
-
2195
- functions.find{|x| x.id == "atan_expression"}.statements[0].expression.tap do |x|
2196
- expect(x).to be_instance_of(Expressir::Model::Expressions::Call)
2197
- expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2198
- expect(x.ref.id).to eq("ATAN")
2199
- expect(x.parameters).to be_instance_of(Array)
2200
- expect(x.parameters.count).to eq(1)
2201
- expect(x.parameters[0]).to be_instance_of(Expressir::Model::Literals::Logical)
2202
- expect(x.parameters[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
2203
- end
2204
-
2205
- functions.find{|x| x.id == "blength_expression"}.statements[0].expression.tap do |x|
2206
- expect(x).to be_instance_of(Expressir::Model::Expressions::Call)
2207
- expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2208
- expect(x.ref.id).to eq("BLENGTH")
2209
- expect(x.parameters).to be_instance_of(Array)
2210
- expect(x.parameters.count).to eq(1)
2211
- expect(x.parameters[0]).to be_instance_of(Expressir::Model::Literals::Logical)
2212
- expect(x.parameters[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
2213
- end
2214
-
2215
- functions.find{|x| x.id == "cos_expression"}.statements[0].expression.tap do |x|
2216
- expect(x).to be_instance_of(Expressir::Model::Expressions::Call)
2217
- expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2218
- expect(x.ref.id).to eq("COS")
2219
- expect(x.parameters).to be_instance_of(Array)
2220
- expect(x.parameters.count).to eq(1)
2221
- expect(x.parameters[0]).to be_instance_of(Expressir::Model::Literals::Logical)
2222
- expect(x.parameters[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
2223
- end
2224
-
2225
- functions.find{|x| x.id == "exists_expression"}.statements[0].expression.tap do |x|
2226
- expect(x).to be_instance_of(Expressir::Model::Expressions::Call)
2227
- expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2228
- expect(x.ref.id).to eq("EXISTS")
2229
- expect(x.parameters).to be_instance_of(Array)
2230
- expect(x.parameters.count).to eq(1)
2231
- expect(x.parameters[0]).to be_instance_of(Expressir::Model::Literals::Logical)
2232
- expect(x.parameters[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
2233
- end
2234
-
2235
- functions.find{|x| x.id == "exp_expression"}.statements[0].expression.tap do |x|
2236
- expect(x).to be_instance_of(Expressir::Model::Expressions::Call)
2237
- expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2238
- expect(x.ref.id).to eq("EXP")
2239
- expect(x.parameters).to be_instance_of(Array)
2240
- expect(x.parameters.count).to eq(1)
2241
- expect(x.parameters[0]).to be_instance_of(Expressir::Model::Literals::Logical)
2242
- expect(x.parameters[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
2243
- end
2244
-
2245
- functions.find{|x| x.id == "format_expression"}.statements[0].expression.tap do |x|
2246
- expect(x).to be_instance_of(Expressir::Model::Expressions::Call)
2247
- expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2248
- expect(x.ref.id).to eq("FORMAT")
2249
- expect(x.parameters).to be_instance_of(Array)
2250
- expect(x.parameters.count).to eq(1)
2251
- expect(x.parameters[0]).to be_instance_of(Expressir::Model::Literals::Logical)
2252
- expect(x.parameters[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
2253
- end
2254
-
2255
- functions.find{|x| x.id == "hibound_expression"}.statements[0].expression.tap do |x|
2256
- expect(x).to be_instance_of(Expressir::Model::Expressions::Call)
2257
- expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2258
- expect(x.ref.id).to eq("HIBOUND")
2259
- expect(x.parameters).to be_instance_of(Array)
2260
- expect(x.parameters.count).to eq(1)
2261
- expect(x.parameters[0]).to be_instance_of(Expressir::Model::Literals::Logical)
2262
- expect(x.parameters[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
2263
- end
2264
-
2265
- functions.find{|x| x.id == "hiindex_expression"}.statements[0].expression.tap do |x|
2266
- expect(x).to be_instance_of(Expressir::Model::Expressions::Call)
2267
- expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2268
- expect(x.ref.id).to eq("HIINDEX")
2269
- expect(x.parameters).to be_instance_of(Array)
2270
- expect(x.parameters.count).to eq(1)
2271
- expect(x.parameters[0]).to be_instance_of(Expressir::Model::Literals::Logical)
2272
- expect(x.parameters[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
2273
- end
2274
-
2275
- functions.find{|x| x.id == "length_expression"}.statements[0].expression.tap do |x|
2276
- expect(x).to be_instance_of(Expressir::Model::Expressions::Call)
2277
- expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2278
- expect(x.ref.id).to eq("LENGTH")
2279
- expect(x.parameters).to be_instance_of(Array)
2280
- expect(x.parameters.count).to eq(1)
2281
- expect(x.parameters[0]).to be_instance_of(Expressir::Model::Literals::Logical)
2282
- expect(x.parameters[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
2283
- end
2284
-
2285
- functions.find{|x| x.id == "lobound_expression"}.statements[0].expression.tap do |x|
2286
- expect(x).to be_instance_of(Expressir::Model::Expressions::Call)
2287
- expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2288
- expect(x.ref.id).to eq("LOBOUND")
2289
- expect(x.parameters).to be_instance_of(Array)
2290
- expect(x.parameters.count).to eq(1)
2291
- expect(x.parameters[0]).to be_instance_of(Expressir::Model::Literals::Logical)
2292
- expect(x.parameters[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
2293
- end
2294
-
2295
- functions.find{|x| x.id == "loindex_expression"}.statements[0].expression.tap do |x|
2296
- expect(x).to be_instance_of(Expressir::Model::Expressions::Call)
2297
- expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2298
- expect(x.ref.id).to eq("LOINDEX")
2299
- expect(x.parameters).to be_instance_of(Array)
2300
- expect(x.parameters.count).to eq(1)
2301
- expect(x.parameters[0]).to be_instance_of(Expressir::Model::Literals::Logical)
2302
- expect(x.parameters[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
2303
- end
2304
-
2305
- functions.find{|x| x.id == "log_expression"}.statements[0].expression.tap do |x|
2306
- expect(x).to be_instance_of(Expressir::Model::Expressions::Call)
2307
- expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2308
- expect(x.ref.id).to eq("LOG")
2309
- expect(x.parameters).to be_instance_of(Array)
2310
- expect(x.parameters.count).to eq(1)
2311
- expect(x.parameters[0]).to be_instance_of(Expressir::Model::Literals::Logical)
2312
- expect(x.parameters[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
2313
- end
2314
-
2315
- functions.find{|x| x.id == "log2_expression"}.statements[0].expression.tap do |x|
2316
- expect(x).to be_instance_of(Expressir::Model::Expressions::Call)
2317
- expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2318
- expect(x.ref.id).to eq("LOG2")
2319
- expect(x.parameters).to be_instance_of(Array)
2320
- expect(x.parameters.count).to eq(1)
2321
- expect(x.parameters[0]).to be_instance_of(Expressir::Model::Literals::Logical)
2322
- expect(x.parameters[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
2323
- end
2324
-
2325
- functions.find{|x| x.id == "log10_expression"}.statements[0].expression.tap do |x|
2326
- expect(x).to be_instance_of(Expressir::Model::Expressions::Call)
2327
- expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2328
- expect(x.ref.id).to eq("LOG10")
2329
- expect(x.parameters).to be_instance_of(Array)
2330
- expect(x.parameters.count).to eq(1)
2331
- expect(x.parameters[0]).to be_instance_of(Expressir::Model::Literals::Logical)
2332
- expect(x.parameters[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
2333
- end
2334
-
2335
- functions.find{|x| x.id == "nvl_expression"}.statements[0].expression.tap do |x|
2336
- expect(x).to be_instance_of(Expressir::Model::Expressions::Call)
2337
- expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2338
- expect(x.ref.id).to eq("NVL")
2339
- expect(x.parameters).to be_instance_of(Array)
2340
- expect(x.parameters.count).to eq(1)
2341
- expect(x.parameters[0]).to be_instance_of(Expressir::Model::Literals::Logical)
2342
- expect(x.parameters[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
2343
- end
2344
-
2345
- functions.find{|x| x.id == "odd_expression"}.statements[0].expression.tap do |x|
2346
- expect(x).to be_instance_of(Expressir::Model::Expressions::Call)
2347
- expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2348
- expect(x.ref.id).to eq("ODD")
2349
- expect(x.parameters).to be_instance_of(Array)
2350
- expect(x.parameters.count).to eq(1)
2351
- expect(x.parameters[0]).to be_instance_of(Expressir::Model::Literals::Logical)
2352
- expect(x.parameters[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
2353
- end
2354
-
2355
- functions.find{|x| x.id == "rolesof_expression"}.statements[0].expression.tap do |x|
2356
- expect(x).to be_instance_of(Expressir::Model::Expressions::Call)
2357
- expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2358
- expect(x.ref.id).to eq("ROLESOF")
2359
- expect(x.parameters).to be_instance_of(Array)
2360
- expect(x.parameters.count).to eq(1)
2361
- expect(x.parameters[0]).to be_instance_of(Expressir::Model::Literals::Logical)
2362
- expect(x.parameters[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
2363
- end
2364
-
2365
- functions.find{|x| x.id == "sin_expression"}.statements[0].expression.tap do |x|
2366
- expect(x).to be_instance_of(Expressir::Model::Expressions::Call)
2367
- expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2368
- expect(x.ref.id).to eq("SIN")
2369
- expect(x.parameters).to be_instance_of(Array)
2370
- expect(x.parameters.count).to eq(1)
2371
- expect(x.parameters[0]).to be_instance_of(Expressir::Model::Literals::Logical)
2372
- expect(x.parameters[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
2373
- end
2374
-
2375
- functions.find{|x| x.id == "sizeof_expression"}.statements[0].expression.tap do |x|
2376
- expect(x).to be_instance_of(Expressir::Model::Expressions::Call)
2377
- expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2378
- expect(x.ref.id).to eq("SIZEOF")
2379
- expect(x.parameters).to be_instance_of(Array)
2380
- expect(x.parameters.count).to eq(1)
2381
- expect(x.parameters[0]).to be_instance_of(Expressir::Model::Literals::Logical)
2382
- expect(x.parameters[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
2383
- end
2384
-
2385
- functions.find{|x| x.id == "sqrt_expression"}.statements[0].expression.tap do |x|
2386
- expect(x).to be_instance_of(Expressir::Model::Expressions::Call)
2387
- expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2388
- expect(x.ref.id).to eq("SQRT")
2389
- expect(x.parameters).to be_instance_of(Array)
2390
- expect(x.parameters.count).to eq(1)
2391
- expect(x.parameters[0]).to be_instance_of(Expressir::Model::Literals::Logical)
2392
- expect(x.parameters[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
2393
- end
2394
-
2395
- functions.find{|x| x.id == "tan_expression"}.statements[0].expression.tap do |x|
2396
- expect(x).to be_instance_of(Expressir::Model::Expressions::Call)
2397
- expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2398
- expect(x.ref.id).to eq("TAN")
2399
- expect(x.parameters).to be_instance_of(Array)
2400
- expect(x.parameters.count).to eq(1)
2401
- expect(x.parameters[0]).to be_instance_of(Expressir::Model::Literals::Logical)
2402
- expect(x.parameters[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
2403
- end
2404
-
2405
- functions.find{|x| x.id == "typeof_expression"}.statements[0].expression.tap do |x|
2406
- expect(x).to be_instance_of(Expressir::Model::Expressions::Call)
2407
- expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2408
- expect(x.ref.id).to eq("TYPEOF")
2409
- expect(x.parameters).to be_instance_of(Array)
2410
- expect(x.parameters.count).to eq(1)
2411
- expect(x.parameters[0]).to be_instance_of(Expressir::Model::Literals::Logical)
2412
- expect(x.parameters[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
2413
- end
2414
-
2415
- functions.find{|x| x.id == "usedin_expression"}.statements[0].expression.tap do |x|
2416
- expect(x).to be_instance_of(Expressir::Model::Expressions::Call)
2417
- expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2418
- expect(x.ref.id).to eq("USEDIN")
2419
- expect(x.parameters).to be_instance_of(Array)
2420
- expect(x.parameters.count).to eq(1)
2421
- expect(x.parameters[0]).to be_instance_of(Expressir::Model::Literals::Logical)
2422
- expect(x.parameters[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
2423
- end
2424
-
2425
- functions.find{|x| x.id == "value_expression"}.statements[0].expression.tap do |x|
2426
- expect(x).to be_instance_of(Expressir::Model::Expressions::Call)
2427
- expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2428
- expect(x.ref.id).to eq("VALUE")
2429
- expect(x.parameters).to be_instance_of(Array)
2430
- expect(x.parameters.count).to eq(1)
2431
- expect(x.parameters[0]).to be_instance_of(Expressir::Model::Literals::Logical)
2432
- expect(x.parameters[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
2433
- end
2434
-
2435
- functions.find{|x| x.id == "value_in_expression"}.statements[0].expression.tap do |x|
2436
- expect(x).to be_instance_of(Expressir::Model::Expressions::Call)
2437
- expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2438
- expect(x.ref.id).to eq("VALUE_IN")
2439
- expect(x.parameters).to be_instance_of(Array)
2440
- expect(x.parameters.count).to eq(1)
2441
- expect(x.parameters[0]).to be_instance_of(Expressir::Model::Literals::Logical)
2442
- expect(x.parameters[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
2443
- end
2444
-
2445
- functions.find{|x| x.id == "value_unique_expression"}.statements[0].expression.tap do |x|
2446
- expect(x).to be_instance_of(Expressir::Model::Expressions::Call)
2447
- expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2448
- expect(x.ref.id).to eq("VALUE_UNIQUE")
2449
- expect(x.parameters).to be_instance_of(Array)
2450
- expect(x.parameters.count).to eq(1)
2451
- expect(x.parameters[0]).to be_instance_of(Expressir::Model::Literals::Logical)
2452
- expect(x.parameters[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
2453
- end
2454
-
2455
- # operator expressions
2456
- functions.find{|x| x.id == "plus_expression"}.statements[0].expression.tap do |x|
2457
- expect(x).to be_instance_of(Expressir::Model::Expressions::UnaryExpression)
2458
- expect(x.operator).to eq(Expressir::Model::Expressions::UnaryExpression::PLUS)
2459
- expect(x.operand).to be_instance_of(Expressir::Model::Literals::Integer)
2460
- expect(x.operand.value).to eq("4")
2461
- end
2462
-
2463
- functions.find{|x| x.id == "plus_addition_expression"}.statements[0].expression.tap do |x|
2464
- expect(x).to be_instance_of(Expressir::Model::Expressions::UnaryExpression)
2465
- expect(x.operator).to eq(Expressir::Model::Expressions::UnaryExpression::PLUS)
2466
- expect(x.operand).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2467
- expect(x.operand.operator).to eq(Expressir::Model::Expressions::BinaryExpression::ADDITION)
2468
- expect(x.operand.operand1).to be_instance_of(Expressir::Model::Literals::Integer)
2469
- expect(x.operand.operand1.value).to eq("4")
2470
- expect(x.operand.operand2).to be_instance_of(Expressir::Model::Literals::Integer)
2471
- expect(x.operand.operand2.value).to eq("2")
2472
- end
2473
-
2474
- functions.find{|x| x.id == "minus_expression"}.statements[0].expression.tap do |x|
2475
- expect(x).to be_instance_of(Expressir::Model::Expressions::UnaryExpression)
2476
- expect(x.operator).to eq(Expressir::Model::Expressions::UnaryExpression::MINUS)
2477
- expect(x.operand).to be_instance_of(Expressir::Model::Literals::Integer)
2478
- expect(x.operand.value).to eq("4")
2479
- end
2480
-
2481
- functions.find{|x| x.id == "minus_addition_expression"}.statements[0].expression.tap do |x|
2482
- expect(x).to be_instance_of(Expressir::Model::Expressions::UnaryExpression)
2483
- expect(x.operator).to eq(Expressir::Model::Expressions::UnaryExpression::MINUS)
2484
- expect(x.operand).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2485
- expect(x.operand.operator).to eq(Expressir::Model::Expressions::BinaryExpression::ADDITION)
2486
- expect(x.operand.operand1).to be_instance_of(Expressir::Model::Literals::Integer)
2487
- expect(x.operand.operand1.value).to eq("4")
2488
- expect(x.operand.operand2).to be_instance_of(Expressir::Model::Literals::Integer)
2489
- expect(x.operand.operand2.value).to eq("2")
2490
- end
2491
-
2492
- functions.find{|x| x.id == "addition_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::ADDITION)
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 == "subtraction_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::SUBTRACTION)
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 == "multiplication_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::MULTIPLICATION)
2513
- expect(x.operand1).to be_instance_of(Expressir::Model::Literals::Integer)
2514
- expect(x.operand1.value).to eq("4")
2515
- expect(x.operand2).to be_instance_of(Expressir::Model::Literals::Integer)
2516
- expect(x.operand2.value).to eq("2")
2517
- end
2518
-
2519
- functions.find{|x| x.id == "real_division_expression"}.statements[0].expression.tap do |x|
2520
- expect(x).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2521
- expect(x.operator).to eq(Expressir::Model::Expressions::BinaryExpression::REAL_DIVISION)
2522
- expect(x.operand1).to be_instance_of(Expressir::Model::Literals::Integer)
2523
- expect(x.operand1.value).to eq("4")
2524
- expect(x.operand2).to be_instance_of(Expressir::Model::Literals::Integer)
2525
- expect(x.operand2.value).to eq("2")
2526
- end
2527
-
2528
- functions.find{|x| x.id == "integer_division_expression"}.statements[0].expression.tap do |x|
2529
- expect(x).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2530
- expect(x.operator).to eq(Expressir::Model::Expressions::BinaryExpression::INTEGER_DIVISION)
2531
- expect(x.operand1).to be_instance_of(Expressir::Model::Literals::Integer)
2532
- expect(x.operand1.value).to eq("4")
2533
- expect(x.operand2).to be_instance_of(Expressir::Model::Literals::Integer)
2534
- expect(x.operand2.value).to eq("2")
2535
- end
2536
-
2537
- functions.find{|x| x.id == "modulo_expression"}.statements[0].expression.tap do |x|
2538
- expect(x).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2539
- expect(x.operator).to eq(Expressir::Model::Expressions::BinaryExpression::MODULO)
2540
- expect(x.operand1).to be_instance_of(Expressir::Model::Literals::Integer)
2541
- expect(x.operand1.value).to eq("4")
2542
- expect(x.operand2).to be_instance_of(Expressir::Model::Literals::Integer)
2543
- expect(x.operand2.value).to eq("2")
2544
- end
2545
-
2546
- functions.find{|x| x.id == "exponentiation_expression"}.statements[0].expression.tap do |x|
2547
- expect(x).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2548
- expect(x.operator).to eq(Expressir::Model::Expressions::BinaryExpression::EXPONENTIATION)
2549
- expect(x.operand1).to be_instance_of(Expressir::Model::Literals::Integer)
2550
- expect(x.operand1.value).to eq("4")
2551
- expect(x.operand2).to be_instance_of(Expressir::Model::Literals::Integer)
2552
- expect(x.operand2.value).to eq("2")
2553
- end
2554
-
2555
- functions.find{|x| x.id == "addition_addition_expression"}.statements[0].expression.tap do |x|
2556
- expect(x).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2557
- expect(x.operator).to eq(Expressir::Model::Expressions::BinaryExpression::ADDITION)
2558
- expect(x.operand1).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2559
- expect(x.operand1.operator).to eq(Expressir::Model::Expressions::BinaryExpression::ADDITION)
2560
- expect(x.operand1.operand1).to be_instance_of(Expressir::Model::Literals::Integer)
2561
- expect(x.operand1.operand1.value).to eq("4")
2562
- expect(x.operand1.operand2).to be_instance_of(Expressir::Model::Literals::Integer)
2563
- expect(x.operand1.operand2.value).to eq("2")
2564
- expect(x.operand2).to be_instance_of(Expressir::Model::Literals::Integer)
2565
- expect(x.operand2.value).to eq("1")
2566
- end
2567
-
2568
- functions.find{|x| x.id == "subtraction_subtraction_expression"}.statements[0].expression.tap do |x|
2569
- expect(x).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2570
- expect(x.operator).to eq(Expressir::Model::Expressions::BinaryExpression::SUBTRACTION)
2571
- expect(x.operand1).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2572
- expect(x.operand1.operator).to eq(Expressir::Model::Expressions::BinaryExpression::SUBTRACTION)
2573
- expect(x.operand1.operand1).to be_instance_of(Expressir::Model::Literals::Integer)
2574
- expect(x.operand1.operand1.value).to eq("4")
2575
- expect(x.operand1.operand2).to be_instance_of(Expressir::Model::Literals::Integer)
2576
- expect(x.operand1.operand2.value).to eq("2")
2577
- expect(x.operand2).to be_instance_of(Expressir::Model::Literals::Integer)
2578
- expect(x.operand2.value).to eq("1")
2579
- end
2580
-
2581
- functions.find{|x| x.id == "addition_subtraction_expression"}.statements[0].expression.tap do |x|
2582
- expect(x).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2583
- expect(x.operator).to eq(Expressir::Model::Expressions::BinaryExpression::SUBTRACTION)
2584
- expect(x.operand1).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2585
- expect(x.operand1.operator).to eq(Expressir::Model::Expressions::BinaryExpression::ADDITION)
2586
- expect(x.operand1.operand1).to be_instance_of(Expressir::Model::Literals::Integer)
2587
- expect(x.operand1.operand1.value).to eq("4")
2588
- expect(x.operand1.operand2).to be_instance_of(Expressir::Model::Literals::Integer)
2589
- expect(x.operand1.operand2.value).to eq("2")
2590
- expect(x.operand2).to be_instance_of(Expressir::Model::Literals::Integer)
2591
- expect(x.operand2.value).to eq("1")
2592
- end
2593
-
2594
- functions.find{|x| x.id == "subtraction_addition_expression"}.statements[0].expression.tap do |x|
2595
- expect(x).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2596
- expect(x.operator).to eq(Expressir::Model::Expressions::BinaryExpression::ADDITION)
2597
- expect(x.operand1).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2598
- expect(x.operand1.operator).to eq(Expressir::Model::Expressions::BinaryExpression::SUBTRACTION)
2599
- expect(x.operand1.operand1).to be_instance_of(Expressir::Model::Literals::Integer)
2600
- expect(x.operand1.operand1.value).to eq("4")
2601
- expect(x.operand1.operand2).to be_instance_of(Expressir::Model::Literals::Integer)
2602
- expect(x.operand1.operand2.value).to eq("2")
2603
- expect(x.operand2).to be_instance_of(Expressir::Model::Literals::Integer)
2604
- expect(x.operand2.value).to eq("1")
2605
- end
2606
-
2607
- functions.find{|x| x.id == "addition_multiplication_expression"}.statements[0].expression.tap do |x|
2608
- expect(x).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2609
- expect(x.operator).to eq(Expressir::Model::Expressions::BinaryExpression::ADDITION)
2610
- expect(x.operand1).to be_instance_of(Expressir::Model::Literals::Integer)
2611
- expect(x.operand1.value).to eq("8")
2612
- expect(x.operand2).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2613
- expect(x.operand2.operator).to eq(Expressir::Model::Expressions::BinaryExpression::MULTIPLICATION)
2614
- expect(x.operand2.operand1).to be_instance_of(Expressir::Model::Literals::Integer)
2615
- expect(x.operand2.operand1.value).to eq("4")
2616
- expect(x.operand2.operand2).to be_instance_of(Expressir::Model::Literals::Integer)
2617
- expect(x.operand2.operand2.value).to eq("2")
2618
- end
2619
-
2620
- functions.find{|x| x.id == "multiplication_addition_expression"}.statements[0].expression.tap do |x|
2621
- expect(x).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2622
- expect(x.operator).to eq(Expressir::Model::Expressions::BinaryExpression::ADDITION)
2623
- expect(x.operand1).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2624
- expect(x.operand1.operator).to eq(Expressir::Model::Expressions::BinaryExpression::MULTIPLICATION)
2625
- expect(x.operand1.operand1).to be_instance_of(Expressir::Model::Literals::Integer)
2626
- expect(x.operand1.operand1.value).to eq("8")
2627
- expect(x.operand1.operand2).to be_instance_of(Expressir::Model::Literals::Integer)
2628
- expect(x.operand1.operand2.value).to eq("4")
2629
- expect(x.operand2).to be_instance_of(Expressir::Model::Literals::Integer)
2630
- expect(x.operand2.value).to eq("2")
2631
- end
2632
-
2633
- functions.find{|x| x.id == "parenthesis_addition_multiplication_expression"}.statements[0].expression.tap do |x|
2634
- expect(x).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2635
- expect(x.operator).to eq(Expressir::Model::Expressions::BinaryExpression::MULTIPLICATION)
2636
- expect(x.operand1).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2637
- expect(x.operand1.operator).to eq(Expressir::Model::Expressions::BinaryExpression::ADDITION)
2638
- expect(x.operand1.operand1).to be_instance_of(Expressir::Model::Literals::Integer)
2639
- expect(x.operand1.operand1.value).to eq("8")
2640
- expect(x.operand1.operand2).to be_instance_of(Expressir::Model::Literals::Integer)
2641
- expect(x.operand1.operand2.value).to eq("4")
2642
- expect(x.operand2).to be_instance_of(Expressir::Model::Literals::Integer)
2643
- expect(x.operand2.value).to eq("2")
2644
- end
2645
-
2646
- functions.find{|x| x.id == "multiplication_parenthesis_addition_expression"}.statements[0].expression.tap do |x|
2647
- expect(x).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2648
- expect(x.operator).to eq(Expressir::Model::Expressions::BinaryExpression::MULTIPLICATION)
2649
- expect(x.operand1).to be_instance_of(Expressir::Model::Literals::Integer)
2650
- expect(x.operand1.value).to eq("8")
2651
- expect(x.operand2).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2652
- expect(x.operand2.operator).to eq(Expressir::Model::Expressions::BinaryExpression::ADDITION)
2653
- expect(x.operand2.operand1).to be_instance_of(Expressir::Model::Literals::Integer)
2654
- expect(x.operand2.operand1.value).to eq("4")
2655
- expect(x.operand2.operand2).to be_instance_of(Expressir::Model::Literals::Integer)
2656
- expect(x.operand2.operand2.value).to eq("2")
2657
- end
2658
-
2659
- functions.find{|x| x.id == "equal_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::EQUAL)
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 == "not_equal_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::NOT_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 == "instance_equal_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::INSTANCE_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 == "instance_not_equal_expression"}.statements[0].expression.tap do |x|
2687
- expect(x).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2688
- expect(x.operator).to eq(Expressir::Model::Expressions::BinaryExpression::INSTANCE_NOT_EQUAL)
2689
- expect(x.operand1).to be_instance_of(Expressir::Model::Literals::Integer)
2690
- expect(x.operand1.value).to eq("4")
2691
- expect(x.operand2).to be_instance_of(Expressir::Model::Literals::Integer)
2692
- expect(x.operand2.value).to eq("2")
2693
- end
2694
-
2695
- functions.find{|x| x.id == "lt_expression"}.statements[0].expression.tap do |x|
2696
- expect(x).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2697
- expect(x.operator).to eq(Expressir::Model::Expressions::BinaryExpression::LESS_THAN)
2698
- expect(x.operand1).to be_instance_of(Expressir::Model::Literals::Integer)
2699
- expect(x.operand1.value).to eq("4")
2700
- expect(x.operand2).to be_instance_of(Expressir::Model::Literals::Integer)
2701
- expect(x.operand2.value).to eq("2")
2702
- end
2703
-
2704
- functions.find{|x| x.id == "gt_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::GREATER_THAN)
2707
- expect(x.operand1).to be_instance_of(Expressir::Model::Literals::Integer)
2708
- expect(x.operand1.value).to eq("4")
2709
- expect(x.operand2).to be_instance_of(Expressir::Model::Literals::Integer)
2710
- expect(x.operand2.value).to eq("2")
2711
- end
2712
-
2713
- functions.find{|x| x.id == "lte_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::LESS_THAN_OR_EQUAL)
2716
- expect(x.operand1).to be_instance_of(Expressir::Model::Literals::Integer)
2717
- expect(x.operand1.value).to eq("4")
2718
- expect(x.operand2).to be_instance_of(Expressir::Model::Literals::Integer)
2719
- expect(x.operand2.value).to eq("2")
2720
- end
2721
-
2722
- functions.find{|x| x.id == "gte_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::GREATER_THAN_OR_EQUAL)
2725
- expect(x.operand1).to be_instance_of(Expressir::Model::Literals::Integer)
2726
- expect(x.operand1.value).to eq("4")
2727
- expect(x.operand2).to be_instance_of(Expressir::Model::Literals::Integer)
2728
- expect(x.operand2.value).to eq("2")
2729
- end
2730
-
2731
- functions.find{|x| x.id == "not_expression"}.statements[0].expression.tap do |x|
2732
- expect(x).to be_instance_of(Expressir::Model::Expressions::UnaryExpression)
2733
- expect(x.operator).to eq(Expressir::Model::Expressions::UnaryExpression::NOT)
2734
- expect(x.operand).to be_instance_of(Expressir::Model::Literals::Logical)
2735
- expect(x.operand.value).to eq(Expressir::Model::Literals::Logical::TRUE)
2736
- end
2737
-
2738
- functions.find{|x| x.id == "not_or_expression"}.statements[0].expression.tap do |x|
2739
- expect(x).to be_instance_of(Expressir::Model::Expressions::UnaryExpression)
2740
- expect(x.operator).to eq(Expressir::Model::Expressions::UnaryExpression::NOT)
2741
- expect(x.operand).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2742
- expect(x.operand.operator).to eq(Expressir::Model::Expressions::BinaryExpression::OR)
2743
- expect(x.operand.operand1).to be_instance_of(Expressir::Model::Literals::Logical)
2744
- expect(x.operand.operand1.value).to eq(Expressir::Model::Literals::Logical::TRUE)
2745
- expect(x.operand.operand2).to be_instance_of(Expressir::Model::Literals::Logical)
2746
- expect(x.operand.operand2.value).to eq(Expressir::Model::Literals::Logical::FALSE)
2747
- end
2748
-
2749
- functions.find{|x| x.id == "or_expression"}.statements[0].expression.tap do |x|
2750
- expect(x).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2751
- expect(x.operator).to eq(Expressir::Model::Expressions::BinaryExpression::OR)
2752
- expect(x.operand1).to be_instance_of(Expressir::Model::Literals::Logical)
2753
- expect(x.operand1.value).to eq(Expressir::Model::Literals::Logical::TRUE)
2754
- expect(x.operand2).to be_instance_of(Expressir::Model::Literals::Logical)
2755
- expect(x.operand2.value).to eq(Expressir::Model::Literals::Logical::FALSE)
2756
- end
2757
-
2758
- functions.find{|x| x.id == "and_expression"}.statements[0].expression.tap do |x|
2759
- expect(x).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2760
- expect(x.operator).to eq(Expressir::Model::Expressions::BinaryExpression::AND)
2761
- expect(x.operand1).to be_instance_of(Expressir::Model::Literals::Logical)
2762
- expect(x.operand1.value).to eq(Expressir::Model::Literals::Logical::TRUE)
2763
- expect(x.operand2).to be_instance_of(Expressir::Model::Literals::Logical)
2764
- expect(x.operand2.value).to eq(Expressir::Model::Literals::Logical::FALSE)
2765
- end
2766
-
2767
- functions.find{|x| x.id == "or_or_expression"}.statements[0].expression.tap do |x|
2768
- expect(x).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2769
- expect(x.operator).to eq(Expressir::Model::Expressions::BinaryExpression::OR)
2770
- expect(x.operand1).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2771
- expect(x.operand1.operator).to eq(Expressir::Model::Expressions::BinaryExpression::OR)
2772
- expect(x.operand1.operand1).to be_instance_of(Expressir::Model::Literals::Logical)
2773
- expect(x.operand1.operand1.value).to eq(Expressir::Model::Literals::Logical::TRUE)
2774
- expect(x.operand1.operand2).to be_instance_of(Expressir::Model::Literals::Logical)
2775
- expect(x.operand1.operand2.value).to eq(Expressir::Model::Literals::Logical::FALSE)
2776
- expect(x.operand2).to be_instance_of(Expressir::Model::Literals::Logical)
2777
- expect(x.operand2.value).to eq(Expressir::Model::Literals::Logical::TRUE)
2778
- end
2779
-
2780
- functions.find{|x| x.id == "and_and_expression"}.statements[0].expression.tap do |x|
2781
- expect(x).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2782
- expect(x.operator).to eq(Expressir::Model::Expressions::BinaryExpression::AND)
2783
- expect(x.operand1).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2784
- expect(x.operand1.operator).to eq(Expressir::Model::Expressions::BinaryExpression::AND)
2785
- expect(x.operand1.operand1).to be_instance_of(Expressir::Model::Literals::Logical)
2786
- expect(x.operand1.operand1.value).to eq(Expressir::Model::Literals::Logical::TRUE)
2787
- expect(x.operand1.operand2).to be_instance_of(Expressir::Model::Literals::Logical)
2788
- expect(x.operand1.operand2.value).to eq(Expressir::Model::Literals::Logical::FALSE)
2789
- expect(x.operand2).to be_instance_of(Expressir::Model::Literals::Logical)
2790
- expect(x.operand2.value).to eq(Expressir::Model::Literals::Logical::TRUE)
2791
- end
2792
-
2793
- functions.find{|x| x.id == "or_and_expression"}.statements[0].expression.tap do |x|
2794
- expect(x).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2795
- expect(x.operator).to eq(Expressir::Model::Expressions::BinaryExpression::OR)
2796
- expect(x.operand1).to be_instance_of(Expressir::Model::Literals::Logical)
2797
- expect(x.operand1.value).to eq(Expressir::Model::Literals::Logical::TRUE)
2798
- expect(x.operand2).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2799
- expect(x.operand2.operator).to eq(Expressir::Model::Expressions::BinaryExpression::AND)
2800
- expect(x.operand2.operand1).to be_instance_of(Expressir::Model::Literals::Logical)
2801
- expect(x.operand2.operand1.value).to eq(Expressir::Model::Literals::Logical::FALSE)
2802
- expect(x.operand2.operand2).to be_instance_of(Expressir::Model::Literals::Logical)
2803
- expect(x.operand2.operand2.value).to eq(Expressir::Model::Literals::Logical::TRUE)
2804
- end
2805
-
2806
- functions.find{|x| x.id == "and_or_expression"}.statements[0].expression.tap do |x|
2807
- expect(x).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2808
- expect(x.operator).to eq(Expressir::Model::Expressions::BinaryExpression::OR)
2809
- expect(x.operand1).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2810
- expect(x.operand1.operator).to eq(Expressir::Model::Expressions::BinaryExpression::AND)
2811
- expect(x.operand1.operand1).to be_instance_of(Expressir::Model::Literals::Logical)
2812
- expect(x.operand1.operand1.value).to eq(Expressir::Model::Literals::Logical::TRUE)
2813
- expect(x.operand1.operand2).to be_instance_of(Expressir::Model::Literals::Logical)
2814
- expect(x.operand1.operand2.value).to eq(Expressir::Model::Literals::Logical::FALSE)
2815
- expect(x.operand2).to be_instance_of(Expressir::Model::Literals::Logical)
2816
- expect(x.operand2.value).to eq(Expressir::Model::Literals::Logical::TRUE)
2817
- end
2818
-
2819
- functions.find{|x| x.id == "parenthesis_or_and_expression"}.statements[0].expression.tap do |x|
2820
- expect(x).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2821
- expect(x.operator).to eq(Expressir::Model::Expressions::BinaryExpression::AND)
2822
- expect(x.operand1).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2823
- expect(x.operand1.operator).to eq(Expressir::Model::Expressions::BinaryExpression::OR)
2824
- expect(x.operand1.operand1).to be_instance_of(Expressir::Model::Literals::Logical)
2825
- expect(x.operand1.operand1.value).to eq(Expressir::Model::Literals::Logical::TRUE)
2826
- expect(x.operand1.operand2).to be_instance_of(Expressir::Model::Literals::Logical)
2827
- expect(x.operand1.operand2.value).to eq(Expressir::Model::Literals::Logical::FALSE)
2828
- expect(x.operand2).to be_instance_of(Expressir::Model::Literals::Logical)
2829
- expect(x.operand2.value).to eq(Expressir::Model::Literals::Logical::TRUE)
2830
- end
2831
-
2832
- functions.find{|x| x.id == "and_parenthesis_or_expression"}.statements[0].expression.tap do |x|
2833
- expect(x).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2834
- expect(x.operator).to eq(Expressir::Model::Expressions::BinaryExpression::AND)
2835
- expect(x.operand1).to be_instance_of(Expressir::Model::Literals::Logical)
2836
- expect(x.operand1.value).to eq(Expressir::Model::Literals::Logical::TRUE)
2837
- expect(x.operand2).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2838
- expect(x.operand2.operator).to eq(Expressir::Model::Expressions::BinaryExpression::OR)
2839
- expect(x.operand2.operand1).to be_instance_of(Expressir::Model::Literals::Logical)
2840
- expect(x.operand2.operand1.value).to eq(Expressir::Model::Literals::Logical::FALSE)
2841
- expect(x.operand2.operand2).to be_instance_of(Expressir::Model::Literals::Logical)
2842
- expect(x.operand2.operand2.value).to eq(Expressir::Model::Literals::Logical::TRUE)
2843
- end
2844
-
2845
- # aggregate initializer expressions
2846
- functions.find{|x| x.id == "aggregate_initializer_expression"}.statements[0].expression.tap do |x|
2847
- expect(x).to be_instance_of(Expressir::Model::Expressions::AggregateInitializer)
2848
- expect(x.items).to be_instance_of(Array)
2849
- expect(x.items.count).to eq(1)
2850
- expect(x.items[0]).to be_instance_of(Expressir::Model::Literals::Integer)
2851
- expect(x.items[0].value).to eq("4")
2852
- end
2853
-
2854
- functions.find{|x| x.id == "repeated_aggregate_initializer_expression"}.statements[0].expression.tap do |x|
2855
- expect(x).to be_instance_of(Expressir::Model::Expressions::AggregateInitializer)
2856
- expect(x.items).to be_instance_of(Array)
2857
- expect(x.items.count).to eq(1)
2858
- expect(x.items[0]).to be_instance_of(Expressir::Model::Expressions::AggregateItem)
2859
- expect(x.items[0].expression).to be_instance_of(Expressir::Model::Literals::Integer)
2860
- expect(x.items[0].expression.value).to eq("4")
2861
- expect(x.items[0].repetition).to be_instance_of(Expressir::Model::Literals::Integer)
2862
- expect(x.items[0].repetition.value).to eq("2")
2863
- end
2864
-
2865
- functions.find{|x| x.id == "complex_aggregate_initializer_expression"}.statements[0].expression.tap do |x|
2866
- expect(x).to be_instance_of(Expressir::Model::Expressions::AggregateInitializer)
2867
- expect(x.items).to be_instance_of(Array)
2868
- expect(x.items.count).to eq(1)
2869
- expect(x.items[0]).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2870
- expect(x.items[0].operator).to eq(Expressir::Model::Expressions::BinaryExpression::ADDITION)
2871
- expect(x.items[0].operand1).to be_instance_of(Expressir::Model::Literals::Integer)
2872
- expect(x.items[0].operand1.value).to eq("4")
2873
- expect(x.items[0].operand2).to be_instance_of(Expressir::Model::Literals::Integer)
2874
- expect(x.items[0].operand2.value).to eq("2")
2875
- end
2876
-
2877
- functions.find{|x| x.id == "complex_repeated_aggregate_initializer_expression"}.statements[0].expression.tap do |x|
2878
- expect(x).to be_instance_of(Expressir::Model::Expressions::AggregateInitializer)
2879
- expect(x.items).to be_instance_of(Array)
2880
- expect(x.items.count).to eq(1)
2881
- expect(x.items[0]).to be_instance_of(Expressir::Model::Expressions::AggregateItem)
2882
- expect(x.items[0].expression).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2883
- expect(x.items[0].expression.operator).to eq(Expressir::Model::Expressions::BinaryExpression::ADDITION)
2884
- expect(x.items[0].expression.operand1).to be_instance_of(Expressir::Model::Literals::Integer)
2885
- expect(x.items[0].expression.operand1.value).to eq("4")
2886
- expect(x.items[0].expression.operand2).to be_instance_of(Expressir::Model::Literals::Integer)
2887
- expect(x.items[0].expression.operand2.value).to eq("2")
2888
- expect(x.items[0].repetition).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2889
- expect(x.items[0].repetition.operator).to eq(Expressir::Model::Expressions::BinaryExpression::ADDITION)
2890
- expect(x.items[0].repetition.operand1).to be_instance_of(Expressir::Model::Literals::Integer)
2891
- expect(x.items[0].repetition.operand1.value).to eq("4")
2892
- expect(x.items[0].repetition.operand2).to be_instance_of(Expressir::Model::Literals::Integer)
2893
- expect(x.items[0].repetition.operand2.value).to eq("2")
2894
- end
2895
-
2896
- # function call or entity constructor expressions
2897
- functions.find{|x| x.id == "call_expression"}.statements[0].expression.tap do |x|
2898
- expect(x).to be_instance_of(Expressir::Model::Expressions::Call)
2899
- expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2900
- expect(x.ref.id).to eq("parameter_function")
2901
- expect(x.parameters).to be_instance_of(Array)
2902
- expect(x.parameters.count).to eq(1)
2903
- expect(x.parameters[0]).to be_instance_of(Expressir::Model::Literals::Logical)
2904
- expect(x.parameters[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
2905
- end
2906
-
2907
- # reference expressions
2908
- functions.find{|x| x.id == "simple_reference_expression"}.statements[0].expression.tap do |x|
2909
- expect(x).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2910
- expect(x.id).to eq("simple_string_expression")
2911
- end
2912
-
2913
- functions.find{|x| x.id == "attribute_reference_expression"}.statements[0].expression.tap do |x|
2914
- expect(x).to be_instance_of(Expressir::Model::Expressions::AttributeReference)
2915
- expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2916
- expect(x.ref.id).to eq("simple_string_expression")
2917
- expect(x.attribute).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2918
- expect(x.attribute.id).to eq("test")
2919
- end
2920
-
2921
- functions.find{|x| x.id == "group_reference_expression"}.statements[0].expression.tap do |x|
2922
- expect(x).to be_instance_of(Expressir::Model::Expressions::GroupReference)
2923
- expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2924
- expect(x.ref.id).to eq("simple_string_expression")
2925
- expect(x.entity).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2926
- expect(x.entity.id).to eq("test")
2927
- end
2928
-
2929
- functions.find{|x| x.id == "index_reference_expression"}.statements[0].expression.tap do |x|
2930
- expect(x).to be_instance_of(Expressir::Model::Expressions::IndexReference)
2931
- expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2932
- expect(x.ref.id).to eq("simple_string_expression")
2933
- expect(x.index1).to be_instance_of(Expressir::Model::Literals::Integer)
2934
- expect(x.index1.value).to eq("1")
2935
- end
2936
-
2937
- functions.find{|x| x.id == "index2_reference_expression"}.statements[0].expression.tap do |x|
2938
- expect(x).to be_instance_of(Expressir::Model::Expressions::IndexReference)
2939
- expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2940
- expect(x.ref.id).to eq("simple_string_expression")
2941
- expect(x.index1).to be_instance_of(Expressir::Model::Literals::Integer)
2942
- expect(x.index1.value).to eq("1")
2943
- expect(x.index2).to be_instance_of(Expressir::Model::Literals::Integer)
2944
- expect(x.index2.value).to eq("9")
2945
- end
2946
-
2947
- # interval expressions
2948
- functions.find{|x| x.id == "lt_lt_interval_expression"}.statements[0].expression.tap do |x|
2949
- expect(x).to be_instance_of(Expressir::Model::Expressions::Interval)
2950
- expect(x.low).to be_instance_of(Expressir::Model::Literals::Integer)
2951
- expect(x.low.value).to eq("1")
2952
- expect(x.operator1).to eq(Expressir::Model::Expressions::BinaryExpression::LESS_THAN)
2953
- expect(x.item).to be_instance_of(Expressir::Model::Literals::Integer)
2954
- expect(x.item.value).to eq("5")
2955
- expect(x.operator2).to eq(Expressir::Model::Expressions::BinaryExpression::LESS_THAN)
2956
- expect(x.high).to be_instance_of(Expressir::Model::Literals::Integer)
2957
- expect(x.high.value).to eq("9")
2958
- end
2959
-
2960
- functions.find{|x| x.id == "lte_lt_interval_expression"}.statements[0].expression.tap do |x|
2961
- expect(x).to be_instance_of(Expressir::Model::Expressions::Interval)
2962
- expect(x.low).to be_instance_of(Expressir::Model::Literals::Integer)
2963
- expect(x.low.value).to eq("1")
2964
- expect(x.operator1).to eq(Expressir::Model::Expressions::BinaryExpression::LESS_THAN_OR_EQUAL)
2965
- expect(x.item).to be_instance_of(Expressir::Model::Literals::Integer)
2966
- expect(x.item.value).to eq("5")
2967
- expect(x.operator2).to eq(Expressir::Model::Expressions::BinaryExpression::LESS_THAN)
2968
- expect(x.high).to be_instance_of(Expressir::Model::Literals::Integer)
2969
- expect(x.high.value).to eq("9")
2970
- end
2971
-
2972
- functions.find{|x| x.id == "lt_lte_interval_expression"}.statements[0].expression.tap do |x|
2973
- expect(x).to be_instance_of(Expressir::Model::Expressions::Interval)
2974
- expect(x.low).to be_instance_of(Expressir::Model::Literals::Integer)
2975
- expect(x.low.value).to eq("1")
2976
- expect(x.operator1).to eq(Expressir::Model::Expressions::BinaryExpression::LESS_THAN)
2977
- expect(x.item).to be_instance_of(Expressir::Model::Literals::Integer)
2978
- expect(x.item.value).to eq("5")
2979
- expect(x.operator2).to eq(Expressir::Model::Expressions::BinaryExpression::LESS_THAN_OR_EQUAL)
2980
- expect(x.high).to be_instance_of(Expressir::Model::Literals::Integer)
2981
- expect(x.high.value).to eq("9")
2982
- end
2983
-
2984
- functions.find{|x| x.id == "lte_lte_interval_expression"}.statements[0].expression.tap do |x|
2985
- expect(x).to be_instance_of(Expressir::Model::Expressions::Interval)
2986
- expect(x.low).to be_instance_of(Expressir::Model::Literals::Integer)
2987
- expect(x.low.value).to eq("1")
2988
- expect(x.operator1).to eq(Expressir::Model::Expressions::BinaryExpression::LESS_THAN_OR_EQUAL)
2989
- expect(x.item).to be_instance_of(Expressir::Model::Literals::Integer)
2990
- expect(x.item.value).to eq("5")
2991
- expect(x.operator2).to eq(Expressir::Model::Expressions::BinaryExpression::LESS_THAN_OR_EQUAL)
2992
- expect(x.high).to be_instance_of(Expressir::Model::Literals::Integer)
2993
- expect(x.high.value).to eq("9")
2994
- end
2995
-
2996
- functions.find{|x| x.id == "combine_expression"}.statements[0].expression.tap do |x|
2997
- expect(x).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2998
- expect(x.operator).to eq(Expressir::Model::Expressions::BinaryExpression::COMBINE)
2999
- expect(x.operand1).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
3000
- expect(x.operand1.id).to eq("test")
3001
- expect(x.operand2).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
3002
- expect(x.operand2.id).to eq("test")
3003
- end
3004
-
3005
- functions.find{|x| x.id == "in_expression"}.statements[0].expression.tap do |x|
3006
- expect(x).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
3007
- expect(x.operator).to eq(Expressir::Model::Expressions::BinaryExpression::IN)
3008
- expect(x.operand1).to be_instance_of(Expressir::Model::Literals::Logical)
3009
- expect(x.operand1.value).to eq(Expressir::Model::Literals::Logical::TRUE)
3010
- expect(x.operand2).to be_instance_of(Expressir::Model::Expressions::AggregateInitializer)
3011
- expect(x.operand2.items).to be_instance_of(Array)
3012
- expect(x.operand2.items.count).to eq(1)
3013
- expect(x.operand2.items[0]).to be_instance_of(Expressir::Model::Literals::Logical)
3014
- expect(x.operand2.items[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
3015
- end
3016
-
3017
- functions.find{|x| x.id == "like_expression"}.statements[0].expression.tap do |x|
3018
- expect(x).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
3019
- expect(x.operator).to eq(Expressir::Model::Expressions::BinaryExpression::LIKE)
3020
- expect(x.operand1).to be_instance_of(Expressir::Model::Literals::String)
3021
- expect(x.operand1.value).to eq("xxx")
3022
- expect(x.operand2).to be_instance_of(Expressir::Model::Literals::String)
3023
- expect(x.operand2.value).to eq("xxx")
3024
- end
3025
-
3026
- # query expressions
3027
- functions.find{|x| x.id == "query_expression"}.statements[0].expression.tap do |x|
3028
- expect(x).to be_instance_of(Expressir::Model::Expressions::QueryExpression)
3029
- expect(x.id).to eq("test")
3030
- expect(x.aggregate_source).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
3031
- expect(x.aggregate_source.id).to eq("test2")
3032
- expect(x.expression).to be_instance_of(Expressir::Model::Literals::Logical)
3033
- expect(x.expression.value).to eq(Expressir::Model::Literals::Logical::TRUE)
1512
+ procedures.find{|x| x.id == "statements"}.tap do |x|
1513
+ # statements
1514
+ x.procedures.find{|x| x.id == "alias_simple_reference_statement"}.statements[0].tap do |x|
1515
+ expect(x).to be_instance_of(Expressir::Model::Statements::Alias)
1516
+ expect(x.id).to eq("test")
1517
+ expect(x.expression).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
1518
+ expect(x.expression.id).to eq("test")
1519
+ expect(x.statements).to be_instance_of(Array)
1520
+ expect(x.statements.count).to eq(1)
1521
+ expect(x.statements[0]).to be_instance_of(Expressir::Model::Statements::Null)
1522
+ end
1523
+
1524
+ x.procedures.find{|x| x.id == "alias_group_reference_statement"}.statements[0].tap do |x|
1525
+ expect(x).to be_instance_of(Expressir::Model::Statements::Alias)
1526
+ expect(x.id).to eq("test")
1527
+ expect(x.expression).to be_instance_of(Expressir::Model::Expressions::GroupReference)
1528
+ expect(x.expression.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
1529
+ expect(x.expression.ref.id).to eq("test")
1530
+ expect(x.expression.entity).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
1531
+ expect(x.expression.entity.id).to eq("test2")
1532
+ expect(x.statements).to be_instance_of(Array)
1533
+ expect(x.statements.count).to eq(1)
1534
+ expect(x.statements[0]).to be_instance_of(Expressir::Model::Statements::Null)
1535
+ end
1536
+
1537
+ x.procedures.find{|x| x.id == "alias_index_reference_statement"}.statements[0].tap do |x|
1538
+ expect(x).to be_instance_of(Expressir::Model::Statements::Alias)
1539
+ expect(x.id).to eq("test")
1540
+ expect(x.expression).to be_instance_of(Expressir::Model::Expressions::IndexReference)
1541
+ expect(x.expression.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
1542
+ expect(x.expression.ref.id).to eq("test")
1543
+ expect(x.expression.index1).to be_instance_of(Expressir::Model::Literals::Integer)
1544
+ expect(x.expression.index1.value).to eq("1")
1545
+ expect(x.statements).to be_instance_of(Array)
1546
+ expect(x.statements.count).to eq(1)
1547
+ expect(x.statements[0]).to be_instance_of(Expressir::Model::Statements::Null)
1548
+ end
1549
+
1550
+ x.procedures.find{|x| x.id == "alias_index2_reference_statement"}.statements[0].tap do |x|
1551
+ expect(x).to be_instance_of(Expressir::Model::Statements::Alias)
1552
+ expect(x.id).to eq("test")
1553
+ expect(x.expression).to be_instance_of(Expressir::Model::Expressions::IndexReference)
1554
+ expect(x.expression.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
1555
+ expect(x.expression.ref.id).to eq("test")
1556
+ expect(x.expression.index1).to be_instance_of(Expressir::Model::Literals::Integer)
1557
+ expect(x.expression.index1.value).to eq("1")
1558
+ expect(x.expression.index2).to be_instance_of(Expressir::Model::Literals::Integer)
1559
+ expect(x.expression.index2.value).to eq("9")
1560
+ expect(x.statements).to be_instance_of(Array)
1561
+ expect(x.statements.count).to eq(1)
1562
+ expect(x.statements[0]).to be_instance_of(Expressir::Model::Statements::Null)
1563
+ end
1564
+
1565
+ x.procedures.find{|x| x.id == "alias_attribute_reference_statement"}.statements[0].tap do |x|
1566
+ expect(x).to be_instance_of(Expressir::Model::Statements::Alias)
1567
+ expect(x.id).to eq("test")
1568
+ expect(x.expression).to be_instance_of(Expressir::Model::Expressions::AttributeReference)
1569
+ expect(x.expression.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
1570
+ expect(x.expression.ref.id).to eq("test")
1571
+ expect(x.expression.attribute).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
1572
+ expect(x.expression.attribute.id).to eq("test2")
1573
+ expect(x.statements).to be_instance_of(Array)
1574
+ expect(x.statements.count).to eq(1)
1575
+ expect(x.statements[0]).to be_instance_of(Expressir::Model::Statements::Null)
1576
+ end
1577
+
1578
+ x.procedures.find{|x| x.id == "assignment_simple_reference_statement"}.statements[0].tap do |x|
1579
+ expect(x).to be_instance_of(Expressir::Model::Statements::Assignment)
1580
+ expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
1581
+ expect(x.ref.id).to eq("test")
1582
+ expect(x.expression).to be_instance_of(Expressir::Model::Literals::Logical)
1583
+ expect(x.expression.value).to eq(Expressir::Model::Literals::Logical::TRUE)
1584
+ end
1585
+
1586
+ x.procedures.find{|x| x.id == "assignment_group_reference_statement"}.statements[0].tap do |x|
1587
+ expect(x).to be_instance_of(Expressir::Model::Statements::Assignment)
1588
+ expect(x.ref).to be_instance_of(Expressir::Model::Expressions::GroupReference)
1589
+ expect(x.ref.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
1590
+ expect(x.ref.ref.id).to eq("test")
1591
+ expect(x.ref.entity).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
1592
+ expect(x.ref.entity.id).to eq("test2")
1593
+ expect(x.expression).to be_instance_of(Expressir::Model::Literals::Logical)
1594
+ expect(x.expression.value).to eq(Expressir::Model::Literals::Logical::TRUE)
1595
+ end
1596
+
1597
+ x.procedures.find{|x| x.id == "assignment_index_reference_statement"}.statements[0].tap do |x|
1598
+ expect(x).to be_instance_of(Expressir::Model::Statements::Assignment)
1599
+ expect(x.ref).to be_instance_of(Expressir::Model::Expressions::IndexReference)
1600
+ expect(x.ref.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
1601
+ expect(x.ref.ref.id).to eq("test")
1602
+ expect(x.ref.index1).to be_instance_of(Expressir::Model::Literals::Integer)
1603
+ expect(x.ref.index1.value).to eq("1")
1604
+ expect(x.expression).to be_instance_of(Expressir::Model::Literals::Logical)
1605
+ expect(x.expression.value).to eq(Expressir::Model::Literals::Logical::TRUE)
1606
+ end
1607
+
1608
+ x.procedures.find{|x| x.id == "assignment_index2_reference_statement"}.statements[0].tap do |x|
1609
+ expect(x).to be_instance_of(Expressir::Model::Statements::Assignment)
1610
+ expect(x.ref).to be_instance_of(Expressir::Model::Expressions::IndexReference)
1611
+ expect(x.ref.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
1612
+ expect(x.ref.ref.id).to eq("test")
1613
+ expect(x.ref.index1).to be_instance_of(Expressir::Model::Literals::Integer)
1614
+ expect(x.ref.index1.value).to eq("1")
1615
+ expect(x.ref.index2).to be_instance_of(Expressir::Model::Literals::Integer)
1616
+ expect(x.ref.index2.value).to eq("9")
1617
+ expect(x.expression).to be_instance_of(Expressir::Model::Literals::Logical)
1618
+ expect(x.expression.value).to eq(Expressir::Model::Literals::Logical::TRUE)
1619
+ end
1620
+
1621
+ x.procedures.find{|x| x.id == "assignment_attribute_reference_statement"}.statements[0].tap do |x|
1622
+ expect(x).to be_instance_of(Expressir::Model::Statements::Assignment)
1623
+ expect(x.ref).to be_instance_of(Expressir::Model::Expressions::AttributeReference)
1624
+ expect(x.ref.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
1625
+ expect(x.ref.ref.id).to eq("test")
1626
+ expect(x.ref.attribute).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
1627
+ expect(x.ref.attribute.id).to eq("test2")
1628
+ expect(x.expression).to be_instance_of(Expressir::Model::Literals::Logical)
1629
+ expect(x.expression.value).to eq(Expressir::Model::Literals::Logical::TRUE)
1630
+ end
1631
+
1632
+ x.procedures.find{|x| x.id == "case_statement"}.statements[0].tap do |x|
1633
+ expect(x).to be_instance_of(Expressir::Model::Statements::Case)
1634
+ expect(x.expression).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
1635
+ expect(x.expression.id).to eq("test")
1636
+ expect(x.actions).to be_instance_of(Array)
1637
+ expect(x.actions.count).to eq(1)
1638
+ expect(x.actions[0]).to be_instance_of(Expressir::Model::Statements::CaseAction)
1639
+ expect(x.actions[0].labels).to be_instance_of(Array)
1640
+ expect(x.actions[0].labels.count).to eq(1)
1641
+ expect(x.actions[0].labels[0]).to be_instance_of(Expressir::Model::Literals::Logical)
1642
+ expect(x.actions[0].labels[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
1643
+ expect(x.actions[0].statement).to be_instance_of(Expressir::Model::Statements::Null)
1644
+ end
1645
+
1646
+ x.procedures.find{|x| x.id == "case_multiple_statement"}.statements[0].tap do |x|
1647
+ expect(x).to be_instance_of(Expressir::Model::Statements::Case)
1648
+ expect(x.expression).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
1649
+ expect(x.expression.id).to eq("test")
1650
+ expect(x.actions).to be_instance_of(Array)
1651
+ expect(x.actions.count).to eq(2)
1652
+ expect(x.actions[0]).to be_instance_of(Expressir::Model::Statements::CaseAction)
1653
+ expect(x.actions[0].labels).to be_instance_of(Array)
1654
+ expect(x.actions[0].labels.count).to eq(1)
1655
+ expect(x.actions[0].labels[0]).to be_instance_of(Expressir::Model::Literals::Logical)
1656
+ expect(x.actions[0].labels[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
1657
+ expect(x.actions[0].statement).to be_instance_of(Expressir::Model::Statements::Null)
1658
+ expect(x.actions[1]).to be_instance_of(Expressir::Model::Statements::CaseAction)
1659
+ expect(x.actions[1].labels).to be_instance_of(Array)
1660
+ expect(x.actions[1].labels.count).to eq(1)
1661
+ expect(x.actions[1].labels[0]).to be_instance_of(Expressir::Model::Literals::Logical)
1662
+ expect(x.actions[1].labels[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
1663
+ expect(x.actions[1].statement).to be_instance_of(Expressir::Model::Statements::Null)
1664
+ end
1665
+
1666
+ x.procedures.find{|x| x.id == "case_multiple_shorthand_statement"}.statements[0].tap do |x|
1667
+ expect(x).to be_instance_of(Expressir::Model::Statements::Case)
1668
+ expect(x.expression).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
1669
+ expect(x.expression.id).to eq("test")
1670
+ expect(x.actions).to be_instance_of(Array)
1671
+ expect(x.actions.count).to eq(1)
1672
+ expect(x.actions[0]).to be_instance_of(Expressir::Model::Statements::CaseAction)
1673
+ expect(x.actions[0].labels).to be_instance_of(Array)
1674
+ expect(x.actions[0].labels.count).to eq(2)
1675
+ expect(x.actions[0].labels[0]).to be_instance_of(Expressir::Model::Literals::Logical)
1676
+ expect(x.actions[0].labels[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
1677
+ expect(x.actions[0].labels[1]).to be_instance_of(Expressir::Model::Literals::Logical)
1678
+ expect(x.actions[0].labels[1].value).to eq(Expressir::Model::Literals::Logical::TRUE)
1679
+ expect(x.actions[0].statement).to be_instance_of(Expressir::Model::Statements::Null)
1680
+ end
1681
+
1682
+ x.procedures.find{|x| x.id == "case_otherwise_statement"}.statements[0].tap do |x|
1683
+ expect(x).to be_instance_of(Expressir::Model::Statements::Case)
1684
+ expect(x.expression).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
1685
+ expect(x.expression.id).to eq("test")
1686
+ expect(x.actions).to be_instance_of(Array)
1687
+ expect(x.actions.count).to eq(1)
1688
+ expect(x.actions[0]).to be_instance_of(Expressir::Model::Statements::CaseAction)
1689
+ expect(x.actions[0].labels).to be_instance_of(Array)
1690
+ expect(x.actions[0].labels.count).to eq(1)
1691
+ expect(x.actions[0].labels[0]).to be_instance_of(Expressir::Model::Literals::Logical)
1692
+ expect(x.actions[0].labels[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
1693
+ expect(x.actions[0].statement).to be_instance_of(Expressir::Model::Statements::Null)
1694
+ expect(x.otherwise_statement).to be_instance_of(Expressir::Model::Statements::Null)
1695
+ end
1696
+
1697
+ x.procedures.find{|x| x.id == "compound_statement"}.statements[0].tap do |x|
1698
+ expect(x).to be_instance_of(Expressir::Model::Statements::Compound)
1699
+ expect(x.statements).to be_instance_of(Array)
1700
+ expect(x.statements.count).to eq(1)
1701
+ expect(x.statements[0]).to be_instance_of(Expressir::Model::Statements::Null)
1702
+ end
1703
+
1704
+ x.procedures.find{|x| x.id == "escape_statement"}.statements[0].tap do |x|
1705
+ expect(x).to be_instance_of(Expressir::Model::Statements::Escape)
1706
+ end
1707
+
1708
+ x.procedures.find{|x| x.id == "if_statement"}.statements[0].tap do |x|
1709
+ expect(x).to be_instance_of(Expressir::Model::Statements::If)
1710
+ expect(x.expression).to be_instance_of(Expressir::Model::Literals::Logical)
1711
+ expect(x.expression.value).to eq(Expressir::Model::Literals::Logical::TRUE)
1712
+ expect(x.statements).to be_instance_of(Array)
1713
+ expect(x.statements.count).to eq(1)
1714
+ expect(x.statements[0]).to be_instance_of(Expressir::Model::Statements::Null)
1715
+ end
1716
+
1717
+ x.procedures.find{|x| x.id == "if2_statement"}.statements[0].tap do |x|
1718
+ expect(x).to be_instance_of(Expressir::Model::Statements::If)
1719
+ expect(x.expression).to be_instance_of(Expressir::Model::Literals::Logical)
1720
+ expect(x.expression.value).to eq(Expressir::Model::Literals::Logical::TRUE)
1721
+ expect(x.statements).to be_instance_of(Array)
1722
+ expect(x.statements.count).to eq(2)
1723
+ expect(x.statements[0]).to be_instance_of(Expressir::Model::Statements::Null)
1724
+ expect(x.statements[1]).to be_instance_of(Expressir::Model::Statements::Null)
1725
+ end
1726
+
1727
+ x.procedures.find{|x| x.id == "if_else_statement"}.statements[0].tap do |x|
1728
+ expect(x).to be_instance_of(Expressir::Model::Statements::If)
1729
+ expect(x.expression).to be_instance_of(Expressir::Model::Literals::Logical)
1730
+ expect(x.expression.value).to eq(Expressir::Model::Literals::Logical::TRUE)
1731
+ expect(x.statements).to be_instance_of(Array)
1732
+ expect(x.statements.count).to eq(1)
1733
+ expect(x.statements[0]).to be_instance_of(Expressir::Model::Statements::Null)
1734
+ expect(x.else_statements).to be_instance_of(Array)
1735
+ expect(x.else_statements.count).to eq(1)
1736
+ expect(x.else_statements[0]).to be_instance_of(Expressir::Model::Statements::Null)
1737
+ end
1738
+
1739
+ x.procedures.find{|x| x.id == "if2_else_statement"}.statements[0].tap do |x|
1740
+ expect(x).to be_instance_of(Expressir::Model::Statements::If)
1741
+ expect(x.expression).to be_instance_of(Expressir::Model::Literals::Logical)
1742
+ expect(x.expression.value).to eq(Expressir::Model::Literals::Logical::TRUE)
1743
+ expect(x.statements).to be_instance_of(Array)
1744
+ expect(x.statements.count).to eq(2)
1745
+ expect(x.statements[0]).to be_instance_of(Expressir::Model::Statements::Null)
1746
+ expect(x.statements[1]).to be_instance_of(Expressir::Model::Statements::Null)
1747
+ expect(x.else_statements).to be_instance_of(Array)
1748
+ expect(x.else_statements.count).to eq(1)
1749
+ expect(x.else_statements[0]).to be_instance_of(Expressir::Model::Statements::Null)
1750
+ end
1751
+
1752
+ x.procedures.find{|x| x.id == "if_else2_statement"}.statements[0].tap do |x|
1753
+ expect(x).to be_instance_of(Expressir::Model::Statements::If)
1754
+ expect(x.expression).to be_instance_of(Expressir::Model::Literals::Logical)
1755
+ expect(x.expression.value).to eq(Expressir::Model::Literals::Logical::TRUE)
1756
+ expect(x.statements).to be_instance_of(Array)
1757
+ expect(x.statements.count).to eq(1)
1758
+ expect(x.statements[0]).to be_instance_of(Expressir::Model::Statements::Null)
1759
+ expect(x.else_statements).to be_instance_of(Array)
1760
+ expect(x.else_statements.count).to eq(2)
1761
+ expect(x.else_statements[0]).to be_instance_of(Expressir::Model::Statements::Null)
1762
+ expect(x.else_statements[1]).to be_instance_of(Expressir::Model::Statements::Null)
1763
+ end
1764
+
1765
+ x.procedures.find{|x| x.id == "if2_else2_statement"}.statements[0].tap do |x|
1766
+ expect(x).to be_instance_of(Expressir::Model::Statements::If)
1767
+ expect(x.expression).to be_instance_of(Expressir::Model::Literals::Logical)
1768
+ expect(x.expression.value).to eq(Expressir::Model::Literals::Logical::TRUE)
1769
+ expect(x.statements).to be_instance_of(Array)
1770
+ expect(x.statements.count).to eq(2)
1771
+ expect(x.statements[0]).to be_instance_of(Expressir::Model::Statements::Null)
1772
+ expect(x.statements[1]).to be_instance_of(Expressir::Model::Statements::Null)
1773
+ expect(x.else_statements).to be_instance_of(Array)
1774
+ expect(x.else_statements.count).to eq(2)
1775
+ expect(x.else_statements[0]).to be_instance_of(Expressir::Model::Statements::Null)
1776
+ expect(x.else_statements[1]).to be_instance_of(Expressir::Model::Statements::Null)
1777
+ end
1778
+
1779
+ x.procedures.find{|x| x.id == "null_statement"}.statements[0].tap do |x|
1780
+ expect(x).to be_instance_of(Expressir::Model::Statements::Null)
1781
+ end
1782
+
1783
+ x.procedures.find{|x| x.id == "call_statement"}.statements[0].tap do |x|
1784
+ expect(x).to be_instance_of(Expressir::Model::Statements::Call)
1785
+ expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
1786
+ expect(x.ref.id).to eq("empty_procedure")
1787
+ end
1788
+
1789
+ x.procedures.find{|x| x.id == "call_parameter_statement"}.statements[0].tap do |x|
1790
+ expect(x).to be_instance_of(Expressir::Model::Statements::Call)
1791
+ expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
1792
+ expect(x.ref.id).to eq("empty_procedure")
1793
+ expect(x.parameters).to be_instance_of(Array)
1794
+ expect(x.parameters.count).to eq(1)
1795
+ expect(x.parameters[0]).to be_instance_of(Expressir::Model::Literals::Logical)
1796
+ expect(x.parameters[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
1797
+ end
1798
+
1799
+ x.procedures.find{|x| x.id == "call_parameter2_statement"}.statements[0].tap do |x|
1800
+ expect(x).to be_instance_of(Expressir::Model::Statements::Call)
1801
+ expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
1802
+ expect(x.ref.id).to eq("empty_procedure")
1803
+ expect(x.parameters).to be_instance_of(Array)
1804
+ expect(x.parameters.count).to eq(2)
1805
+ expect(x.parameters[0]).to be_instance_of(Expressir::Model::Literals::Logical)
1806
+ expect(x.parameters[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
1807
+ expect(x.parameters[1]).to be_instance_of(Expressir::Model::Literals::Logical)
1808
+ expect(x.parameters[1].value).to eq(Expressir::Model::Literals::Logical::TRUE)
1809
+ end
1810
+
1811
+ x.procedures.find{|x| x.id == "call_insert_statement"}.statements[0].tap do |x|
1812
+ expect(x).to be_instance_of(Expressir::Model::Statements::Call)
1813
+ expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
1814
+ expect(x.ref.id).to eq("INSERT")
1815
+ expect(x.parameters).to be_instance_of(Array)
1816
+ expect(x.parameters.count).to eq(1)
1817
+ expect(x.parameters[0]).to be_instance_of(Expressir::Model::Literals::Logical)
1818
+ expect(x.parameters[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
1819
+ end
1820
+
1821
+ x.procedures.find{|x| x.id == "call_remove_statement"}.statements[0].tap do |x|
1822
+ expect(x).to be_instance_of(Expressir::Model::Statements::Call)
1823
+ expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
1824
+ expect(x.ref.id).to eq("REMOVE")
1825
+ expect(x.parameters).to be_instance_of(Array)
1826
+ expect(x.parameters.count).to eq(1)
1827
+ expect(x.parameters[0]).to be_instance_of(Expressir::Model::Literals::Logical)
1828
+ expect(x.parameters[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
1829
+ end
1830
+
1831
+ x.procedures.find{|x| x.id == "repeat_statement"}.statements[0].tap do |x|
1832
+ expect(x).to be_instance_of(Expressir::Model::Statements::Repeat)
1833
+ expect(x.statements).to be_instance_of(Array)
1834
+ expect(x.statements.count).to eq(1)
1835
+ expect(x.statements[0]).to be_instance_of(Expressir::Model::Statements::Null)
1836
+ end
1837
+
1838
+ x.procedures.find{|x| x.id == "repeat_variable_statement"}.statements[0].tap do |x|
1839
+ expect(x).to be_instance_of(Expressir::Model::Statements::Repeat)
1840
+ expect(x.id).to eq("test")
1841
+ expect(x.bound1).to be_instance_of(Expressir::Model::Literals::Integer)
1842
+ expect(x.bound1.value).to eq("1")
1843
+ expect(x.bound2).to be_instance_of(Expressir::Model::Literals::Integer)
1844
+ expect(x.bound2.value).to eq("9")
1845
+ expect(x.statements).to be_instance_of(Array)
1846
+ expect(x.statements.count).to eq(1)
1847
+ expect(x.statements[0]).to be_instance_of(Expressir::Model::Statements::Null)
1848
+ end
1849
+
1850
+ x.procedures.find{|x| x.id == "repeat_variable_increment_statement"}.statements[0].tap do |x|
1851
+ expect(x).to be_instance_of(Expressir::Model::Statements::Repeat)
1852
+ expect(x.id).to eq("test")
1853
+ expect(x.bound1).to be_instance_of(Expressir::Model::Literals::Integer)
1854
+ expect(x.bound1.value).to eq("1")
1855
+ expect(x.bound2).to be_instance_of(Expressir::Model::Literals::Integer)
1856
+ expect(x.bound2.value).to eq("9")
1857
+ expect(x.increment).to be_instance_of(Expressir::Model::Literals::Integer)
1858
+ expect(x.increment.value).to eq("2")
1859
+ expect(x.statements).to be_instance_of(Array)
1860
+ expect(x.statements.count).to eq(1)
1861
+ expect(x.statements[0]).to be_instance_of(Expressir::Model::Statements::Null)
1862
+ end
1863
+
1864
+ x.procedures.find{|x| x.id == "repeat_while_statement"}.statements[0].tap do |x|
1865
+ expect(x).to be_instance_of(Expressir::Model::Statements::Repeat)
1866
+ expect(x.while_expression).to be_instance_of(Expressir::Model::Literals::Logical)
1867
+ expect(x.while_expression.value).to eq(Expressir::Model::Literals::Logical::TRUE)
1868
+ expect(x.statements).to be_instance_of(Array)
1869
+ expect(x.statements.count).to eq(1)
1870
+ expect(x.statements[0]).to be_instance_of(Expressir::Model::Statements::Null)
1871
+ end
1872
+
1873
+ x.procedures.find{|x| x.id == "repeat_until_statement"}.statements[0].tap do |x|
1874
+ expect(x).to be_instance_of(Expressir::Model::Statements::Repeat)
1875
+ expect(x.until_expression).to be_instance_of(Expressir::Model::Literals::Logical)
1876
+ expect(x.until_expression.value).to eq(Expressir::Model::Literals::Logical::TRUE)
1877
+ expect(x.statements).to be_instance_of(Array)
1878
+ expect(x.statements.count).to eq(1)
1879
+ expect(x.statements[0]).to be_instance_of(Expressir::Model::Statements::Null)
1880
+ end
1881
+
1882
+ x.procedures.find{|x| x.id == "return_statement"}.statements[0].tap do |x|
1883
+ expect(x).to be_instance_of(Expressir::Model::Statements::Return)
1884
+ end
1885
+
1886
+ x.procedures.find{|x| x.id == "return_expression_statement"}.statements[0].tap do |x|
1887
+ expect(x).to be_instance_of(Expressir::Model::Statements::Return)
1888
+ expect(x.expression).to be_instance_of(Expressir::Model::Literals::Logical)
1889
+ expect(x.expression.value).to eq(Expressir::Model::Literals::Logical::TRUE)
1890
+ end
1891
+
1892
+ x.procedures.find{|x| x.id == "skip_statement"}.statements[0].tap do |x|
1893
+ expect(x).to be_instance_of(Expressir::Model::Statements::Skip)
1894
+ end
1895
+ end
1896
+
1897
+ procedures.find{|x| x.id == "types"}.tap do |x|
1898
+ # simple types
1899
+ x.types.find{|x| x.id == "binary_type"}.type.tap do |x|
1900
+ expect(x).to be_instance_of(Expressir::Model::Types::Binary)
1901
+ end
1902
+
1903
+ x.types.find{|x| x.id == "binary_width_type"}.type.tap do |x|
1904
+ expect(x).to be_instance_of(Expressir::Model::Types::Binary)
1905
+ expect(x.width).to be_instance_of(Expressir::Model::Literals::Integer)
1906
+ expect(x.width.value).to eq("3")
1907
+ end
1908
+
1909
+ x.types.find{|x| x.id == "binary_width_fixed_type"}.type.tap do |x|
1910
+ expect(x).to be_instance_of(Expressir::Model::Types::Binary)
1911
+ expect(x.width).to be_instance_of(Expressir::Model::Literals::Integer)
1912
+ expect(x.width.value).to eq("3")
1913
+ expect(x.fixed).to eq(true)
1914
+ end
1915
+
1916
+ x.types.find{|x| x.id == "boolean_type"}.type.tap do |x|
1917
+ expect(x).to be_instance_of(Expressir::Model::Types::Boolean)
1918
+ end
1919
+
1920
+ x.types.find{|x| x.id == "integer_type"}.type.tap do |x|
1921
+ expect(x).to be_instance_of(Expressir::Model::Types::Integer)
1922
+ end
1923
+
1924
+ x.types.find{|x| x.id == "logical_type"}.type.tap do |x|
1925
+ expect(x).to be_instance_of(Expressir::Model::Types::Logical)
1926
+ end
1927
+
1928
+ x.types.find{|x| x.id == "number_type"}.type.tap do |x|
1929
+ expect(x).to be_instance_of(Expressir::Model::Types::Number)
1930
+ end
1931
+
1932
+ x.types.find{|x| x.id == "real_type"}.type.tap do |x|
1933
+ expect(x).to be_instance_of(Expressir::Model::Types::Real)
1934
+ end
1935
+
1936
+ x.types.find{|x| x.id == "real_precision_type"}.type.tap do |x|
1937
+ expect(x).to be_instance_of(Expressir::Model::Types::Real)
1938
+ expect(x.precision).to be_instance_of(Expressir::Model::Literals::Integer)
1939
+ expect(x.precision.value).to eq("3")
1940
+ end
1941
+
1942
+ x.types.find{|x| x.id == "string_type"}.type.tap do |x|
1943
+ expect(x).to be_instance_of(Expressir::Model::Types::String)
1944
+ end
1945
+
1946
+ x.types.find{|x| x.id == "string_width_type"}.type.tap do |x|
1947
+ expect(x).to be_instance_of(Expressir::Model::Types::String)
1948
+ expect(x.width).to be_instance_of(Expressir::Model::Literals::Integer)
1949
+ expect(x.width.value).to eq("3")
1950
+ end
1951
+
1952
+ x.types.find{|x| x.id == "string_width_fixed_type"}.type.tap do |x|
1953
+ expect(x).to be_instance_of(Expressir::Model::Types::String)
1954
+ expect(x.width).to be_instance_of(Expressir::Model::Literals::Integer)
1955
+ expect(x.width.value).to eq("3")
1956
+ expect(x.fixed).to eq(true)
1957
+ end
1958
+
1959
+ # aggregation types
1960
+ x.types.find{|x| x.id == "array_type"}.type.tap do |x|
1961
+ expect(x).to be_instance_of(Expressir::Model::Types::Array)
1962
+ expect(x.bound1).to be_instance_of(Expressir::Model::Literals::Integer)
1963
+ expect(x.bound1.value).to eq("1")
1964
+ expect(x.bound2).to be_instance_of(Expressir::Model::Literals::Integer)
1965
+ expect(x.bound2.value).to eq("9")
1966
+ expect(x.base_type).to be_instance_of(Expressir::Model::Types::String)
1967
+ end
1968
+
1969
+ x.types.find{|x| x.id == "array_optional_type"}.type.tap do |x|
1970
+ expect(x).to be_instance_of(Expressir::Model::Types::Array)
1971
+ expect(x.bound1).to be_instance_of(Expressir::Model::Literals::Integer)
1972
+ expect(x.bound1.value).to eq("1")
1973
+ expect(x.bound2).to be_instance_of(Expressir::Model::Literals::Integer)
1974
+ expect(x.bound2.value).to eq("9")
1975
+ expect(x.optional).to eq(true)
1976
+ expect(x.base_type).to be_instance_of(Expressir::Model::Types::String)
1977
+ end
1978
+
1979
+ x.types.find{|x| x.id == "array_unique_type"}.type.tap do |x|
1980
+ expect(x).to be_instance_of(Expressir::Model::Types::Array)
1981
+ expect(x.bound1).to be_instance_of(Expressir::Model::Literals::Integer)
1982
+ expect(x.bound1.value).to eq("1")
1983
+ expect(x.bound2).to be_instance_of(Expressir::Model::Literals::Integer)
1984
+ expect(x.bound2.value).to eq("9")
1985
+ expect(x.unique).to eq(true)
1986
+ expect(x.base_type).to be_instance_of(Expressir::Model::Types::String)
1987
+ end
1988
+
1989
+ x.types.find{|x| x.id == "array_optional_unique_type"}.type.tap do |x|
1990
+ expect(x).to be_instance_of(Expressir::Model::Types::Array)
1991
+ expect(x.bound1).to be_instance_of(Expressir::Model::Literals::Integer)
1992
+ expect(x.bound1.value).to eq("1")
1993
+ expect(x.bound2).to be_instance_of(Expressir::Model::Literals::Integer)
1994
+ expect(x.bound2.value).to eq("9")
1995
+ expect(x.optional).to eq(true)
1996
+ expect(x.unique).to eq(true)
1997
+ expect(x.base_type).to be_instance_of(Expressir::Model::Types::String)
1998
+ end
1999
+
2000
+ x.types.find{|x| x.id == "bag_type"}.type.tap do |x|
2001
+ expect(x).to be_instance_of(Expressir::Model::Types::Bag)
2002
+ expect(x.base_type).to be_instance_of(Expressir::Model::Types::String)
2003
+ end
2004
+
2005
+ x.types.find{|x| x.id == "bag_bound_type"}.type.tap do |x|
2006
+ expect(x).to be_instance_of(Expressir::Model::Types::Bag)
2007
+ expect(x.bound1).to be_instance_of(Expressir::Model::Literals::Integer)
2008
+ expect(x.bound1.value).to eq("1")
2009
+ expect(x.bound2).to be_instance_of(Expressir::Model::Literals::Integer)
2010
+ expect(x.bound2.value).to eq("9")
2011
+ expect(x.base_type).to be_instance_of(Expressir::Model::Types::String)
2012
+ end
2013
+
2014
+ x.types.find{|x| x.id == "list_type"}.type.tap do |x|
2015
+ expect(x).to be_instance_of(Expressir::Model::Types::List)
2016
+ expect(x.base_type).to be_instance_of(Expressir::Model::Types::String)
2017
+ end
2018
+
2019
+ x.types.find{|x| x.id == "list_bound_type"}.type.tap do |x|
2020
+ expect(x).to be_instance_of(Expressir::Model::Types::List)
2021
+ expect(x.bound1).to be_instance_of(Expressir::Model::Literals::Integer)
2022
+ expect(x.bound1.value).to eq("1")
2023
+ expect(x.bound2).to be_instance_of(Expressir::Model::Literals::Integer)
2024
+ expect(x.bound2.value).to eq("9")
2025
+ expect(x.base_type).to be_instance_of(Expressir::Model::Types::String)
2026
+ end
2027
+
2028
+ x.types.find{|x| x.id == "list_unique_type"}.type.tap do |x|
2029
+ expect(x).to be_instance_of(Expressir::Model::Types::List)
2030
+ expect(x.unique).to eq(true)
2031
+ expect(x.base_type).to be_instance_of(Expressir::Model::Types::String)
2032
+ end
2033
+
2034
+ x.types.find{|x| x.id == "list_bound_unique_type"}.type.tap do |x|
2035
+ expect(x).to be_instance_of(Expressir::Model::Types::List)
2036
+ expect(x.bound1).to be_instance_of(Expressir::Model::Literals::Integer)
2037
+ expect(x.bound1.value).to eq("1")
2038
+ expect(x.bound2).to be_instance_of(Expressir::Model::Literals::Integer)
2039
+ expect(x.bound2.value).to eq("9")
2040
+ expect(x.unique).to eq(true)
2041
+ expect(x.base_type).to be_instance_of(Expressir::Model::Types::String)
2042
+ end
2043
+
2044
+ x.types.find{|x| x.id == "set_type"}.type.tap do |x|
2045
+ expect(x).to be_instance_of(Expressir::Model::Types::Set)
2046
+ expect(x.base_type).to be_instance_of(Expressir::Model::Types::String)
2047
+ end
2048
+
2049
+ x.types.find{|x| x.id == "set_bound_type"}.type.tap do |x|
2050
+ expect(x).to be_instance_of(Expressir::Model::Types::Set)
2051
+ expect(x.bound1).to be_instance_of(Expressir::Model::Literals::Integer)
2052
+ expect(x.bound1.value).to eq("1")
2053
+ expect(x.bound2).to be_instance_of(Expressir::Model::Literals::Integer)
2054
+ expect(x.bound2.value).to eq("9")
2055
+ expect(x.base_type).to be_instance_of(Expressir::Model::Types::String)
2056
+ end
2057
+
2058
+ # constructed types
2059
+ x.types.find{|x| x.id == "select_type"}.type.tap do |x|
2060
+ expect(x).to be_instance_of(Expressir::Model::Types::Select)
2061
+ end
2062
+
2063
+ x.types.find{|x| x.id == "select_extensible_type"}.type.tap do |x|
2064
+ expect(x).to be_instance_of(Expressir::Model::Types::Select)
2065
+ expect(x.extensible).to eq(true)
2066
+ end
2067
+
2068
+ x.types.find{|x| x.id == "select_extensible_generic_entity_type"}.type.tap do |x|
2069
+ expect(x).to be_instance_of(Expressir::Model::Types::Select)
2070
+ expect(x.extensible).to eq(true)
2071
+ expect(x.generic_entity).to eq(true)
2072
+ end
2073
+
2074
+ x.types.find{|x| x.id == "select_list_type"}.type.tap do |x|
2075
+ expect(x).to be_instance_of(Expressir::Model::Types::Select)
2076
+ expect(x.items).to be_instance_of(Array)
2077
+ expect(x.items.count).to eq(1)
2078
+ expect(x.items[0]).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2079
+ expect(x.items[0].id).to eq("empty_type")
2080
+ end
2081
+
2082
+ x.types.find{|x| x.id == "select_extension_type_ref_type"}.type.tap do |x|
2083
+ expect(x).to be_instance_of(Expressir::Model::Types::Select)
2084
+ expect(x.extension_type).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2085
+ expect(x.extension_type.id).to eq("select_type")
2086
+ end
2087
+
2088
+ x.types.find{|x| x.id == "select_extension_type_ref_list_type"}.type.tap do |x|
2089
+ expect(x).to be_instance_of(Expressir::Model::Types::Select)
2090
+ expect(x.extension_type).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2091
+ expect(x.extension_type.id).to eq("select_type")
2092
+ expect(x.extension_items).to be_instance_of(Array)
2093
+ expect(x.extension_items.count).to eq(1)
2094
+ expect(x.extension_items[0]).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2095
+ expect(x.extension_items[0].id).to eq("empty_type")
2096
+ end
2097
+
2098
+ x.types.find{|x| x.id == "enumeration_type"}.type.tap do |x|
2099
+ expect(x).to be_instance_of(Expressir::Model::Types::Enumeration)
2100
+ end
2101
+
2102
+ x.types.find{|x| x.id == "enumeration_extensible_type"}.type.tap do |x|
2103
+ expect(x).to be_instance_of(Expressir::Model::Types::Enumeration)
2104
+ expect(x.extensible).to eq(true)
2105
+ end
2106
+
2107
+ x.types.find{|x| x.id == "enumeration_list_type"}.type.tap do |x|
2108
+ expect(x).to be_instance_of(Expressir::Model::Types::Enumeration)
2109
+ expect(x.items).to be_instance_of(Array)
2110
+ expect(x.items.count).to eq(1)
2111
+ expect(x.items[0]).to be_instance_of(Expressir::Model::EnumerationItem)
2112
+ expect(x.items[0].id).to eq("test")
2113
+ end
2114
+
2115
+ x.types.find{|x| x.id == "enumeration_extension_type_ref_type"}.type.tap do |x|
2116
+ expect(x).to be_instance_of(Expressir::Model::Types::Enumeration)
2117
+ expect(x.extension_type).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2118
+ expect(x.extension_type.id).to eq("enumeration_type")
2119
+ end
2120
+
2121
+ x.types.find{|x| x.id == "enumeration_extension_type_ref_list_type"}.type.tap do |x|
2122
+ expect(x).to be_instance_of(Expressir::Model::Types::Enumeration)
2123
+ expect(x.extension_type).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2124
+ expect(x.extension_type.id).to eq("enumeration_type")
2125
+ expect(x.extension_items).to be_instance_of(Array)
2126
+ expect(x.extension_items[0]).to be_instance_of(Expressir::Model::EnumerationItem)
2127
+ expect(x.extension_items[0].id).to eq("test")
2128
+ end
2129
+ end
2130
+
2131
+ procedures.find{|x| x.id == "expressions"}.tap do |x|
2132
+ # literal expressions
2133
+ x.variables.find{|x| x.id == "binary_expression"}.expression.tap do |x|
2134
+ expect(x).to be_instance_of(Expressir::Model::Literals::Binary)
2135
+ expect(x.value).to eq("011110000111100001111000")
2136
+ end
2137
+
2138
+ x.variables.find{|x| x.id == "integer_expression"}.expression.tap do |x|
2139
+ expect(x).to be_instance_of(Expressir::Model::Literals::Integer)
2140
+ expect(x.value).to eq("999")
2141
+ end
2142
+
2143
+ x.variables.find{|x| x.id == "true_logical_expression"}.expression.tap do |x|
2144
+ expect(x).to be_instance_of(Expressir::Model::Literals::Logical)
2145
+ expect(x.value).to eq(Expressir::Model::Literals::Logical::TRUE)
2146
+ end
2147
+
2148
+ x.variables.find{|x| x.id == "false_logical_expression"}.expression.tap do |x|
2149
+ expect(x).to be_instance_of(Expressir::Model::Literals::Logical)
2150
+ expect(x.value).to eq(Expressir::Model::Literals::Logical::FALSE)
2151
+ end
2152
+
2153
+ x.variables.find{|x| x.id == "unknown_logical_expression"}.expression.tap do |x|
2154
+ expect(x).to be_instance_of(Expressir::Model::Literals::Logical)
2155
+ expect(x.value).to eq(Expressir::Model::Literals::Logical::UNKNOWN)
2156
+ end
2157
+
2158
+ x.variables.find{|x| x.id == "real_expression"}.expression.tap do |x|
2159
+ expect(x).to be_instance_of(Expressir::Model::Literals::Real)
2160
+ expect(x.value).to eq("999.999")
2161
+ end
2162
+
2163
+ x.variables.find{|x| x.id == "simple_string_expression"}.expression.tap do |x|
2164
+ expect(x).to be_instance_of(Expressir::Model::Literals::String)
2165
+ expect(x.value).to eq("xxx")
2166
+ end
2167
+
2168
+ x.variables.find{|x| x.id == "utf8_simple_string_expression"}.expression.tap do |x|
2169
+ expect(x).to be_instance_of(Expressir::Model::Literals::String)
2170
+ expect(x.value).to eq("UTF8 test: Příliš žluťoučký kůň úpěl ďábelské ódy.")
2171
+ end
2172
+
2173
+ x.variables.find{|x| x.id == "encoded_string_expression"}.expression.tap do |x|
2174
+ expect(x).to be_instance_of(Expressir::Model::Literals::String)
2175
+ expect(x.value).to eq("000000780000007800000078")
2176
+ expect(x.encoded).to eq(true)
2177
+ end
2178
+
2179
+ # constant expressions
2180
+ x.variables.find{|x| x.id == "const_e_expression"}.expression.tap do |x|
2181
+ expect(x).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2182
+ expect(x.id).to eq("CONST_E")
2183
+ end
2184
+
2185
+ x.variables.find{|x| x.id == "indeterminate_expression"}.expression.tap do |x|
2186
+ expect(x).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2187
+ expect(x.id).to eq("?")
2188
+ end
2189
+
2190
+ x.variables.find{|x| x.id == "pi_expression"}.expression.tap do |x|
2191
+ expect(x).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2192
+ expect(x.id).to eq("PI")
2193
+ end
2194
+
2195
+ x.variables.find{|x| x.id == "self_expression"}.expression.tap do |x|
2196
+ expect(x).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2197
+ expect(x.id).to eq("SELF")
2198
+ end
2199
+
2200
+ # function expressions
2201
+ x.variables.find{|x| x.id == "abs_expression"}.expression.tap do |x|
2202
+ expect(x).to be_instance_of(Expressir::Model::Expressions::Call)
2203
+ expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2204
+ expect(x.ref.id).to eq("ABS")
2205
+ expect(x.parameters).to be_instance_of(Array)
2206
+ expect(x.parameters.count).to eq(1)
2207
+ expect(x.parameters[0]).to be_instance_of(Expressir::Model::Literals::Logical)
2208
+ expect(x.parameters[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
2209
+ end
2210
+
2211
+ x.variables.find{|x| x.id == "acos_expression"}.expression.tap do |x|
2212
+ expect(x).to be_instance_of(Expressir::Model::Expressions::Call)
2213
+ expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2214
+ expect(x.ref.id).to eq("ACOS")
2215
+ expect(x.parameters).to be_instance_of(Array)
2216
+ expect(x.parameters.count).to eq(1)
2217
+ expect(x.parameters[0]).to be_instance_of(Expressir::Model::Literals::Logical)
2218
+ expect(x.parameters[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
2219
+ end
2220
+
2221
+ x.variables.find{|x| x.id == "asin_expression"}.expression.tap do |x|
2222
+ expect(x).to be_instance_of(Expressir::Model::Expressions::Call)
2223
+ expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2224
+ expect(x.ref.id).to eq("ASIN")
2225
+ expect(x.parameters).to be_instance_of(Array)
2226
+ expect(x.parameters.count).to eq(1)
2227
+ expect(x.parameters[0]).to be_instance_of(Expressir::Model::Literals::Logical)
2228
+ expect(x.parameters[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
2229
+ end
2230
+
2231
+ x.variables.find{|x| x.id == "atan_expression"}.expression.tap do |x|
2232
+ expect(x).to be_instance_of(Expressir::Model::Expressions::Call)
2233
+ expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2234
+ expect(x.ref.id).to eq("ATAN")
2235
+ expect(x.parameters).to be_instance_of(Array)
2236
+ expect(x.parameters.count).to eq(1)
2237
+ expect(x.parameters[0]).to be_instance_of(Expressir::Model::Literals::Logical)
2238
+ expect(x.parameters[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
2239
+ end
2240
+
2241
+ x.variables.find{|x| x.id == "blength_expression"}.expression.tap do |x|
2242
+ expect(x).to be_instance_of(Expressir::Model::Expressions::Call)
2243
+ expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2244
+ expect(x.ref.id).to eq("BLENGTH")
2245
+ expect(x.parameters).to be_instance_of(Array)
2246
+ expect(x.parameters.count).to eq(1)
2247
+ expect(x.parameters[0]).to be_instance_of(Expressir::Model::Literals::Logical)
2248
+ expect(x.parameters[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
2249
+ end
2250
+
2251
+ x.variables.find{|x| x.id == "cos_expression"}.expression.tap do |x|
2252
+ expect(x).to be_instance_of(Expressir::Model::Expressions::Call)
2253
+ expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2254
+ expect(x.ref.id).to eq("COS")
2255
+ expect(x.parameters).to be_instance_of(Array)
2256
+ expect(x.parameters.count).to eq(1)
2257
+ expect(x.parameters[0]).to be_instance_of(Expressir::Model::Literals::Logical)
2258
+ expect(x.parameters[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
2259
+ end
2260
+
2261
+ x.variables.find{|x| x.id == "exists_expression"}.expression.tap do |x|
2262
+ expect(x).to be_instance_of(Expressir::Model::Expressions::Call)
2263
+ expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2264
+ expect(x.ref.id).to eq("EXISTS")
2265
+ expect(x.parameters).to be_instance_of(Array)
2266
+ expect(x.parameters.count).to eq(1)
2267
+ expect(x.parameters[0]).to be_instance_of(Expressir::Model::Literals::Logical)
2268
+ expect(x.parameters[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
2269
+ end
2270
+
2271
+ x.variables.find{|x| x.id == "exp_expression"}.expression.tap do |x|
2272
+ expect(x).to be_instance_of(Expressir::Model::Expressions::Call)
2273
+ expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2274
+ expect(x.ref.id).to eq("EXP")
2275
+ expect(x.parameters).to be_instance_of(Array)
2276
+ expect(x.parameters.count).to eq(1)
2277
+ expect(x.parameters[0]).to be_instance_of(Expressir::Model::Literals::Logical)
2278
+ expect(x.parameters[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
2279
+ end
2280
+
2281
+ x.variables.find{|x| x.id == "format_expression"}.expression.tap do |x|
2282
+ expect(x).to be_instance_of(Expressir::Model::Expressions::Call)
2283
+ expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2284
+ expect(x.ref.id).to eq("FORMAT")
2285
+ expect(x.parameters).to be_instance_of(Array)
2286
+ expect(x.parameters.count).to eq(1)
2287
+ expect(x.parameters[0]).to be_instance_of(Expressir::Model::Literals::Logical)
2288
+ expect(x.parameters[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
2289
+ end
2290
+
2291
+ x.variables.find{|x| x.id == "hibound_expression"}.expression.tap do |x|
2292
+ expect(x).to be_instance_of(Expressir::Model::Expressions::Call)
2293
+ expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2294
+ expect(x.ref.id).to eq("HIBOUND")
2295
+ expect(x.parameters).to be_instance_of(Array)
2296
+ expect(x.parameters.count).to eq(1)
2297
+ expect(x.parameters[0]).to be_instance_of(Expressir::Model::Literals::Logical)
2298
+ expect(x.parameters[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
2299
+ end
2300
+
2301
+ x.variables.find{|x| x.id == "hiindex_expression"}.expression.tap do |x|
2302
+ expect(x).to be_instance_of(Expressir::Model::Expressions::Call)
2303
+ expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2304
+ expect(x.ref.id).to eq("HIINDEX")
2305
+ expect(x.parameters).to be_instance_of(Array)
2306
+ expect(x.parameters.count).to eq(1)
2307
+ expect(x.parameters[0]).to be_instance_of(Expressir::Model::Literals::Logical)
2308
+ expect(x.parameters[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
2309
+ end
2310
+
2311
+ x.variables.find{|x| x.id == "length_expression"}.expression.tap do |x|
2312
+ expect(x).to be_instance_of(Expressir::Model::Expressions::Call)
2313
+ expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2314
+ expect(x.ref.id).to eq("LENGTH")
2315
+ expect(x.parameters).to be_instance_of(Array)
2316
+ expect(x.parameters.count).to eq(1)
2317
+ expect(x.parameters[0]).to be_instance_of(Expressir::Model::Literals::Logical)
2318
+ expect(x.parameters[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
2319
+ end
2320
+
2321
+ x.variables.find{|x| x.id == "lobound_expression"}.expression.tap do |x|
2322
+ expect(x).to be_instance_of(Expressir::Model::Expressions::Call)
2323
+ expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2324
+ expect(x.ref.id).to eq("LOBOUND")
2325
+ expect(x.parameters).to be_instance_of(Array)
2326
+ expect(x.parameters.count).to eq(1)
2327
+ expect(x.parameters[0]).to be_instance_of(Expressir::Model::Literals::Logical)
2328
+ expect(x.parameters[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
2329
+ end
2330
+
2331
+ x.variables.find{|x| x.id == "loindex_expression"}.expression.tap do |x|
2332
+ expect(x).to be_instance_of(Expressir::Model::Expressions::Call)
2333
+ expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2334
+ expect(x.ref.id).to eq("LOINDEX")
2335
+ expect(x.parameters).to be_instance_of(Array)
2336
+ expect(x.parameters.count).to eq(1)
2337
+ expect(x.parameters[0]).to be_instance_of(Expressir::Model::Literals::Logical)
2338
+ expect(x.parameters[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
2339
+ end
2340
+
2341
+ x.variables.find{|x| x.id == "log_expression"}.expression.tap do |x|
2342
+ expect(x).to be_instance_of(Expressir::Model::Expressions::Call)
2343
+ expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2344
+ expect(x.ref.id).to eq("LOG")
2345
+ expect(x.parameters).to be_instance_of(Array)
2346
+ expect(x.parameters.count).to eq(1)
2347
+ expect(x.parameters[0]).to be_instance_of(Expressir::Model::Literals::Logical)
2348
+ expect(x.parameters[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
2349
+ end
2350
+
2351
+ x.variables.find{|x| x.id == "log2_expression"}.expression.tap do |x|
2352
+ expect(x).to be_instance_of(Expressir::Model::Expressions::Call)
2353
+ expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2354
+ expect(x.ref.id).to eq("LOG2")
2355
+ expect(x.parameters).to be_instance_of(Array)
2356
+ expect(x.parameters.count).to eq(1)
2357
+ expect(x.parameters[0]).to be_instance_of(Expressir::Model::Literals::Logical)
2358
+ expect(x.parameters[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
2359
+ end
2360
+
2361
+ x.variables.find{|x| x.id == "log10_expression"}.expression.tap do |x|
2362
+ expect(x).to be_instance_of(Expressir::Model::Expressions::Call)
2363
+ expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2364
+ expect(x.ref.id).to eq("LOG10")
2365
+ expect(x.parameters).to be_instance_of(Array)
2366
+ expect(x.parameters.count).to eq(1)
2367
+ expect(x.parameters[0]).to be_instance_of(Expressir::Model::Literals::Logical)
2368
+ expect(x.parameters[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
2369
+ end
2370
+
2371
+ x.variables.find{|x| x.id == "nvl_expression"}.expression.tap do |x|
2372
+ expect(x).to be_instance_of(Expressir::Model::Expressions::Call)
2373
+ expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2374
+ expect(x.ref.id).to eq("NVL")
2375
+ expect(x.parameters).to be_instance_of(Array)
2376
+ expect(x.parameters.count).to eq(1)
2377
+ expect(x.parameters[0]).to be_instance_of(Expressir::Model::Literals::Logical)
2378
+ expect(x.parameters[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
2379
+ end
2380
+
2381
+ x.variables.find{|x| x.id == "odd_expression"}.expression.tap do |x|
2382
+ expect(x).to be_instance_of(Expressir::Model::Expressions::Call)
2383
+ expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2384
+ expect(x.ref.id).to eq("ODD")
2385
+ expect(x.parameters).to be_instance_of(Array)
2386
+ expect(x.parameters.count).to eq(1)
2387
+ expect(x.parameters[0]).to be_instance_of(Expressir::Model::Literals::Logical)
2388
+ expect(x.parameters[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
2389
+ end
2390
+
2391
+ x.variables.find{|x| x.id == "rolesof_expression"}.expression.tap do |x|
2392
+ expect(x).to be_instance_of(Expressir::Model::Expressions::Call)
2393
+ expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2394
+ expect(x.ref.id).to eq("ROLESOF")
2395
+ expect(x.parameters).to be_instance_of(Array)
2396
+ expect(x.parameters.count).to eq(1)
2397
+ expect(x.parameters[0]).to be_instance_of(Expressir::Model::Literals::Logical)
2398
+ expect(x.parameters[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
2399
+ end
2400
+
2401
+ x.variables.find{|x| x.id == "sin_expression"}.expression.tap do |x|
2402
+ expect(x).to be_instance_of(Expressir::Model::Expressions::Call)
2403
+ expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2404
+ expect(x.ref.id).to eq("SIN")
2405
+ expect(x.parameters).to be_instance_of(Array)
2406
+ expect(x.parameters.count).to eq(1)
2407
+ expect(x.parameters[0]).to be_instance_of(Expressir::Model::Literals::Logical)
2408
+ expect(x.parameters[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
2409
+ end
2410
+
2411
+ x.variables.find{|x| x.id == "sizeof_expression"}.expression.tap do |x|
2412
+ expect(x).to be_instance_of(Expressir::Model::Expressions::Call)
2413
+ expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2414
+ expect(x.ref.id).to eq("SIZEOF")
2415
+ expect(x.parameters).to be_instance_of(Array)
2416
+ expect(x.parameters.count).to eq(1)
2417
+ expect(x.parameters[0]).to be_instance_of(Expressir::Model::Literals::Logical)
2418
+ expect(x.parameters[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
2419
+ end
2420
+
2421
+ x.variables.find{|x| x.id == "sqrt_expression"}.expression.tap do |x|
2422
+ expect(x).to be_instance_of(Expressir::Model::Expressions::Call)
2423
+ expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2424
+ expect(x.ref.id).to eq("SQRT")
2425
+ expect(x.parameters).to be_instance_of(Array)
2426
+ expect(x.parameters.count).to eq(1)
2427
+ expect(x.parameters[0]).to be_instance_of(Expressir::Model::Literals::Logical)
2428
+ expect(x.parameters[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
2429
+ end
2430
+
2431
+ x.variables.find{|x| x.id == "tan_expression"}.expression.tap do |x|
2432
+ expect(x).to be_instance_of(Expressir::Model::Expressions::Call)
2433
+ expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2434
+ expect(x.ref.id).to eq("TAN")
2435
+ expect(x.parameters).to be_instance_of(Array)
2436
+ expect(x.parameters.count).to eq(1)
2437
+ expect(x.parameters[0]).to be_instance_of(Expressir::Model::Literals::Logical)
2438
+ expect(x.parameters[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
2439
+ end
2440
+
2441
+ x.variables.find{|x| x.id == "typeof_expression"}.expression.tap do |x|
2442
+ expect(x).to be_instance_of(Expressir::Model::Expressions::Call)
2443
+ expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2444
+ expect(x.ref.id).to eq("TYPEOF")
2445
+ expect(x.parameters).to be_instance_of(Array)
2446
+ expect(x.parameters.count).to eq(1)
2447
+ expect(x.parameters[0]).to be_instance_of(Expressir::Model::Literals::Logical)
2448
+ expect(x.parameters[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
2449
+ end
2450
+
2451
+ x.variables.find{|x| x.id == "usedin_expression"}.expression.tap do |x|
2452
+ expect(x).to be_instance_of(Expressir::Model::Expressions::Call)
2453
+ expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2454
+ expect(x.ref.id).to eq("USEDIN")
2455
+ expect(x.parameters).to be_instance_of(Array)
2456
+ expect(x.parameters.count).to eq(1)
2457
+ expect(x.parameters[0]).to be_instance_of(Expressir::Model::Literals::Logical)
2458
+ expect(x.parameters[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
2459
+ end
2460
+
2461
+ x.variables.find{|x| x.id == "value_expression"}.expression.tap do |x|
2462
+ expect(x).to be_instance_of(Expressir::Model::Expressions::Call)
2463
+ expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2464
+ expect(x.ref.id).to eq("VALUE")
2465
+ expect(x.parameters).to be_instance_of(Array)
2466
+ expect(x.parameters.count).to eq(1)
2467
+ expect(x.parameters[0]).to be_instance_of(Expressir::Model::Literals::Logical)
2468
+ expect(x.parameters[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
2469
+ end
2470
+
2471
+ x.variables.find{|x| x.id == "value_in_expression"}.expression.tap do |x|
2472
+ expect(x).to be_instance_of(Expressir::Model::Expressions::Call)
2473
+ expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2474
+ expect(x.ref.id).to eq("VALUE_IN")
2475
+ expect(x.parameters).to be_instance_of(Array)
2476
+ expect(x.parameters.count).to eq(1)
2477
+ expect(x.parameters[0]).to be_instance_of(Expressir::Model::Literals::Logical)
2478
+ expect(x.parameters[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
2479
+ end
2480
+
2481
+ x.variables.find{|x| x.id == "value_unique_expression"}.expression.tap do |x|
2482
+ expect(x).to be_instance_of(Expressir::Model::Expressions::Call)
2483
+ expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2484
+ expect(x.ref.id).to eq("VALUE_UNIQUE")
2485
+ expect(x.parameters).to be_instance_of(Array)
2486
+ expect(x.parameters.count).to eq(1)
2487
+ expect(x.parameters[0]).to be_instance_of(Expressir::Model::Literals::Logical)
2488
+ expect(x.parameters[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
2489
+ end
2490
+
2491
+ # operator expressions
2492
+ x.variables.find{|x| x.id == "plus_expression"}.expression.tap do |x|
2493
+ expect(x).to be_instance_of(Expressir::Model::Expressions::UnaryExpression)
2494
+ expect(x.operator).to eq(Expressir::Model::Expressions::UnaryExpression::PLUS)
2495
+ expect(x.operand).to be_instance_of(Expressir::Model::Literals::Integer)
2496
+ expect(x.operand.value).to eq("4")
2497
+ end
2498
+
2499
+ x.variables.find{|x| x.id == "plus_addition_expression"}.expression.tap do |x|
2500
+ expect(x).to be_instance_of(Expressir::Model::Expressions::UnaryExpression)
2501
+ expect(x.operator).to eq(Expressir::Model::Expressions::UnaryExpression::PLUS)
2502
+ expect(x.operand).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2503
+ expect(x.operand.operator).to eq(Expressir::Model::Expressions::BinaryExpression::ADDITION)
2504
+ expect(x.operand.operand1).to be_instance_of(Expressir::Model::Literals::Integer)
2505
+ expect(x.operand.operand1.value).to eq("4")
2506
+ expect(x.operand.operand2).to be_instance_of(Expressir::Model::Literals::Integer)
2507
+ expect(x.operand.operand2.value).to eq("2")
2508
+ end
2509
+
2510
+ x.variables.find{|x| x.id == "minus_expression"}.expression.tap do |x|
2511
+ expect(x).to be_instance_of(Expressir::Model::Expressions::UnaryExpression)
2512
+ expect(x.operator).to eq(Expressir::Model::Expressions::UnaryExpression::MINUS)
2513
+ expect(x.operand).to be_instance_of(Expressir::Model::Literals::Integer)
2514
+ expect(x.operand.value).to eq("4")
2515
+ end
2516
+
2517
+ x.variables.find{|x| x.id == "minus_addition_expression"}.expression.tap do |x|
2518
+ expect(x).to be_instance_of(Expressir::Model::Expressions::UnaryExpression)
2519
+ expect(x.operator).to eq(Expressir::Model::Expressions::UnaryExpression::MINUS)
2520
+ expect(x.operand).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2521
+ expect(x.operand.operator).to eq(Expressir::Model::Expressions::BinaryExpression::ADDITION)
2522
+ expect(x.operand.operand1).to be_instance_of(Expressir::Model::Literals::Integer)
2523
+ expect(x.operand.operand1.value).to eq("4")
2524
+ expect(x.operand.operand2).to be_instance_of(Expressir::Model::Literals::Integer)
2525
+ expect(x.operand.operand2.value).to eq("2")
2526
+ end
2527
+
2528
+ x.variables.find{|x| x.id == "addition_expression"}.expression.tap do |x|
2529
+ expect(x).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2530
+ expect(x.operator).to eq(Expressir::Model::Expressions::BinaryExpression::ADDITION)
2531
+ expect(x.operand1).to be_instance_of(Expressir::Model::Literals::Integer)
2532
+ expect(x.operand1.value).to eq("4")
2533
+ expect(x.operand2).to be_instance_of(Expressir::Model::Literals::Integer)
2534
+ expect(x.operand2.value).to eq("2")
2535
+ end
2536
+
2537
+ x.variables.find{|x| x.id == "subtraction_expression"}.expression.tap do |x|
2538
+ expect(x).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2539
+ expect(x.operator).to eq(Expressir::Model::Expressions::BinaryExpression::SUBTRACTION)
2540
+ expect(x.operand1).to be_instance_of(Expressir::Model::Literals::Integer)
2541
+ expect(x.operand1.value).to eq("4")
2542
+ expect(x.operand2).to be_instance_of(Expressir::Model::Literals::Integer)
2543
+ expect(x.operand2.value).to eq("2")
2544
+ end
2545
+
2546
+ x.variables.find{|x| x.id == "multiplication_expression"}.expression.tap do |x|
2547
+ expect(x).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2548
+ expect(x.operator).to eq(Expressir::Model::Expressions::BinaryExpression::MULTIPLICATION)
2549
+ expect(x.operand1).to be_instance_of(Expressir::Model::Literals::Integer)
2550
+ expect(x.operand1.value).to eq("4")
2551
+ expect(x.operand2).to be_instance_of(Expressir::Model::Literals::Integer)
2552
+ expect(x.operand2.value).to eq("2")
2553
+ end
2554
+
2555
+ x.variables.find{|x| x.id == "real_division_expression"}.expression.tap do |x|
2556
+ expect(x).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2557
+ expect(x.operator).to eq(Expressir::Model::Expressions::BinaryExpression::REAL_DIVISION)
2558
+ expect(x.operand1).to be_instance_of(Expressir::Model::Literals::Integer)
2559
+ expect(x.operand1.value).to eq("4")
2560
+ expect(x.operand2).to be_instance_of(Expressir::Model::Literals::Integer)
2561
+ expect(x.operand2.value).to eq("2")
2562
+ end
2563
+
2564
+ x.variables.find{|x| x.id == "integer_division_expression"}.expression.tap do |x|
2565
+ expect(x).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2566
+ expect(x.operator).to eq(Expressir::Model::Expressions::BinaryExpression::INTEGER_DIVISION)
2567
+ expect(x.operand1).to be_instance_of(Expressir::Model::Literals::Integer)
2568
+ expect(x.operand1.value).to eq("4")
2569
+ expect(x.operand2).to be_instance_of(Expressir::Model::Literals::Integer)
2570
+ expect(x.operand2.value).to eq("2")
2571
+ end
2572
+
2573
+ x.variables.find{|x| x.id == "modulo_expression"}.expression.tap do |x|
2574
+ expect(x).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2575
+ expect(x.operator).to eq(Expressir::Model::Expressions::BinaryExpression::MODULO)
2576
+ expect(x.operand1).to be_instance_of(Expressir::Model::Literals::Integer)
2577
+ expect(x.operand1.value).to eq("4")
2578
+ expect(x.operand2).to be_instance_of(Expressir::Model::Literals::Integer)
2579
+ expect(x.operand2.value).to eq("2")
2580
+ end
2581
+
2582
+ x.variables.find{|x| x.id == "exponentiation_expression"}.expression.tap do |x|
2583
+ expect(x).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2584
+ expect(x.operator).to eq(Expressir::Model::Expressions::BinaryExpression::EXPONENTIATION)
2585
+ expect(x.operand1).to be_instance_of(Expressir::Model::Literals::Integer)
2586
+ expect(x.operand1.value).to eq("4")
2587
+ expect(x.operand2).to be_instance_of(Expressir::Model::Literals::Integer)
2588
+ expect(x.operand2.value).to eq("2")
2589
+ end
2590
+
2591
+ x.variables.find{|x| x.id == "addition_addition_expression"}.expression.tap do |x|
2592
+ expect(x).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2593
+ expect(x.operator).to eq(Expressir::Model::Expressions::BinaryExpression::ADDITION)
2594
+ expect(x.operand1).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2595
+ expect(x.operand1.operator).to eq(Expressir::Model::Expressions::BinaryExpression::ADDITION)
2596
+ expect(x.operand1.operand1).to be_instance_of(Expressir::Model::Literals::Integer)
2597
+ expect(x.operand1.operand1.value).to eq("4")
2598
+ expect(x.operand1.operand2).to be_instance_of(Expressir::Model::Literals::Integer)
2599
+ expect(x.operand1.operand2.value).to eq("2")
2600
+ expect(x.operand2).to be_instance_of(Expressir::Model::Literals::Integer)
2601
+ expect(x.operand2.value).to eq("1")
2602
+ end
2603
+
2604
+ x.variables.find{|x| x.id == "subtraction_subtraction_expression"}.expression.tap do |x|
2605
+ expect(x).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2606
+ expect(x.operator).to eq(Expressir::Model::Expressions::BinaryExpression::SUBTRACTION)
2607
+ expect(x.operand1).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2608
+ expect(x.operand1.operator).to eq(Expressir::Model::Expressions::BinaryExpression::SUBTRACTION)
2609
+ expect(x.operand1.operand1).to be_instance_of(Expressir::Model::Literals::Integer)
2610
+ expect(x.operand1.operand1.value).to eq("4")
2611
+ expect(x.operand1.operand2).to be_instance_of(Expressir::Model::Literals::Integer)
2612
+ expect(x.operand1.operand2.value).to eq("2")
2613
+ expect(x.operand2).to be_instance_of(Expressir::Model::Literals::Integer)
2614
+ expect(x.operand2.value).to eq("1")
2615
+ end
2616
+
2617
+ x.variables.find{|x| x.id == "addition_subtraction_expression"}.expression.tap do |x|
2618
+ expect(x).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2619
+ expect(x.operator).to eq(Expressir::Model::Expressions::BinaryExpression::SUBTRACTION)
2620
+ expect(x.operand1).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2621
+ expect(x.operand1.operator).to eq(Expressir::Model::Expressions::BinaryExpression::ADDITION)
2622
+ expect(x.operand1.operand1).to be_instance_of(Expressir::Model::Literals::Integer)
2623
+ expect(x.operand1.operand1.value).to eq("4")
2624
+ expect(x.operand1.operand2).to be_instance_of(Expressir::Model::Literals::Integer)
2625
+ expect(x.operand1.operand2.value).to eq("2")
2626
+ expect(x.operand2).to be_instance_of(Expressir::Model::Literals::Integer)
2627
+ expect(x.operand2.value).to eq("1")
2628
+ end
2629
+
2630
+ x.variables.find{|x| x.id == "subtraction_addition_expression"}.expression.tap do |x|
2631
+ expect(x).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2632
+ expect(x.operator).to eq(Expressir::Model::Expressions::BinaryExpression::ADDITION)
2633
+ expect(x.operand1).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2634
+ expect(x.operand1.operator).to eq(Expressir::Model::Expressions::BinaryExpression::SUBTRACTION)
2635
+ expect(x.operand1.operand1).to be_instance_of(Expressir::Model::Literals::Integer)
2636
+ expect(x.operand1.operand1.value).to eq("4")
2637
+ expect(x.operand1.operand2).to be_instance_of(Expressir::Model::Literals::Integer)
2638
+ expect(x.operand1.operand2.value).to eq("2")
2639
+ expect(x.operand2).to be_instance_of(Expressir::Model::Literals::Integer)
2640
+ expect(x.operand2.value).to eq("1")
2641
+ end
2642
+
2643
+ x.variables.find{|x| x.id == "addition_multiplication_expression"}.expression.tap do |x|
2644
+ expect(x).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2645
+ expect(x.operator).to eq(Expressir::Model::Expressions::BinaryExpression::ADDITION)
2646
+ expect(x.operand1).to be_instance_of(Expressir::Model::Literals::Integer)
2647
+ expect(x.operand1.value).to eq("8")
2648
+ expect(x.operand2).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2649
+ expect(x.operand2.operator).to eq(Expressir::Model::Expressions::BinaryExpression::MULTIPLICATION)
2650
+ expect(x.operand2.operand1).to be_instance_of(Expressir::Model::Literals::Integer)
2651
+ expect(x.operand2.operand1.value).to eq("4")
2652
+ expect(x.operand2.operand2).to be_instance_of(Expressir::Model::Literals::Integer)
2653
+ expect(x.operand2.operand2.value).to eq("2")
2654
+ end
2655
+
2656
+ x.variables.find{|x| x.id == "multiplication_addition_expression"}.expression.tap do |x|
2657
+ expect(x).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2658
+ expect(x.operator).to eq(Expressir::Model::Expressions::BinaryExpression::ADDITION)
2659
+ expect(x.operand1).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2660
+ expect(x.operand1.operator).to eq(Expressir::Model::Expressions::BinaryExpression::MULTIPLICATION)
2661
+ expect(x.operand1.operand1).to be_instance_of(Expressir::Model::Literals::Integer)
2662
+ expect(x.operand1.operand1.value).to eq("8")
2663
+ expect(x.operand1.operand2).to be_instance_of(Expressir::Model::Literals::Integer)
2664
+ expect(x.operand1.operand2.value).to eq("4")
2665
+ expect(x.operand2).to be_instance_of(Expressir::Model::Literals::Integer)
2666
+ expect(x.operand2.value).to eq("2")
2667
+ end
2668
+
2669
+ x.variables.find{|x| x.id == "parenthesis_addition_multiplication_expression"}.expression.tap do |x|
2670
+ expect(x).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2671
+ expect(x.operator).to eq(Expressir::Model::Expressions::BinaryExpression::MULTIPLICATION)
2672
+ expect(x.operand1).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2673
+ expect(x.operand1.operator).to eq(Expressir::Model::Expressions::BinaryExpression::ADDITION)
2674
+ expect(x.operand1.operand1).to be_instance_of(Expressir::Model::Literals::Integer)
2675
+ expect(x.operand1.operand1.value).to eq("8")
2676
+ expect(x.operand1.operand2).to be_instance_of(Expressir::Model::Literals::Integer)
2677
+ expect(x.operand1.operand2.value).to eq("4")
2678
+ expect(x.operand2).to be_instance_of(Expressir::Model::Literals::Integer)
2679
+ expect(x.operand2.value).to eq("2")
2680
+ end
2681
+
2682
+ x.variables.find{|x| x.id == "multiplication_parenthesis_addition_expression"}.expression.tap do |x|
2683
+ expect(x).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2684
+ expect(x.operator).to eq(Expressir::Model::Expressions::BinaryExpression::MULTIPLICATION)
2685
+ expect(x.operand1).to be_instance_of(Expressir::Model::Literals::Integer)
2686
+ expect(x.operand1.value).to eq("8")
2687
+ expect(x.operand2).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2688
+ expect(x.operand2.operator).to eq(Expressir::Model::Expressions::BinaryExpression::ADDITION)
2689
+ expect(x.operand2.operand1).to be_instance_of(Expressir::Model::Literals::Integer)
2690
+ expect(x.operand2.operand1.value).to eq("4")
2691
+ expect(x.operand2.operand2).to be_instance_of(Expressir::Model::Literals::Integer)
2692
+ expect(x.operand2.operand2.value).to eq("2")
2693
+ end
2694
+
2695
+ x.variables.find{|x| x.id == "equal_expression"}.expression.tap do |x|
2696
+ expect(x).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2697
+ expect(x.operator).to eq(Expressir::Model::Expressions::BinaryExpression::EQUAL)
2698
+ expect(x.operand1).to be_instance_of(Expressir::Model::Literals::Integer)
2699
+ expect(x.operand1.value).to eq("4")
2700
+ expect(x.operand2).to be_instance_of(Expressir::Model::Literals::Integer)
2701
+ expect(x.operand2.value).to eq("2")
2702
+ end
2703
+
2704
+ x.variables.find{|x| x.id == "not_equal_expression"}.expression.tap do |x|
2705
+ expect(x).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2706
+ expect(x.operator).to eq(Expressir::Model::Expressions::BinaryExpression::NOT_EQUAL)
2707
+ expect(x.operand1).to be_instance_of(Expressir::Model::Literals::Integer)
2708
+ expect(x.operand1.value).to eq("4")
2709
+ expect(x.operand2).to be_instance_of(Expressir::Model::Literals::Integer)
2710
+ expect(x.operand2.value).to eq("2")
2711
+ end
2712
+
2713
+ x.variables.find{|x| x.id == "instance_equal_expression"}.expression.tap do |x|
2714
+ expect(x).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2715
+ expect(x.operator).to eq(Expressir::Model::Expressions::BinaryExpression::INSTANCE_EQUAL)
2716
+ expect(x.operand1).to be_instance_of(Expressir::Model::Literals::Integer)
2717
+ expect(x.operand1.value).to eq("4")
2718
+ expect(x.operand2).to be_instance_of(Expressir::Model::Literals::Integer)
2719
+ expect(x.operand2.value).to eq("2")
2720
+ end
2721
+
2722
+ x.variables.find{|x| x.id == "instance_not_equal_expression"}.expression.tap do |x|
2723
+ expect(x).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2724
+ expect(x.operator).to eq(Expressir::Model::Expressions::BinaryExpression::INSTANCE_NOT_EQUAL)
2725
+ expect(x.operand1).to be_instance_of(Expressir::Model::Literals::Integer)
2726
+ expect(x.operand1.value).to eq("4")
2727
+ expect(x.operand2).to be_instance_of(Expressir::Model::Literals::Integer)
2728
+ expect(x.operand2.value).to eq("2")
2729
+ end
2730
+
2731
+ x.variables.find{|x| x.id == "lt_expression"}.expression.tap do |x|
2732
+ expect(x).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2733
+ expect(x.operator).to eq(Expressir::Model::Expressions::BinaryExpression::LESS_THAN)
2734
+ expect(x.operand1).to be_instance_of(Expressir::Model::Literals::Integer)
2735
+ expect(x.operand1.value).to eq("4")
2736
+ expect(x.operand2).to be_instance_of(Expressir::Model::Literals::Integer)
2737
+ expect(x.operand2.value).to eq("2")
2738
+ end
2739
+
2740
+ x.variables.find{|x| x.id == "gt_expression"}.expression.tap do |x|
2741
+ expect(x).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2742
+ expect(x.operator).to eq(Expressir::Model::Expressions::BinaryExpression::GREATER_THAN)
2743
+ expect(x.operand1).to be_instance_of(Expressir::Model::Literals::Integer)
2744
+ expect(x.operand1.value).to eq("4")
2745
+ expect(x.operand2).to be_instance_of(Expressir::Model::Literals::Integer)
2746
+ expect(x.operand2.value).to eq("2")
2747
+ end
2748
+
2749
+ x.variables.find{|x| x.id == "lte_expression"}.expression.tap do |x|
2750
+ expect(x).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2751
+ expect(x.operator).to eq(Expressir::Model::Expressions::BinaryExpression::LESS_THAN_OR_EQUAL)
2752
+ expect(x.operand1).to be_instance_of(Expressir::Model::Literals::Integer)
2753
+ expect(x.operand1.value).to eq("4")
2754
+ expect(x.operand2).to be_instance_of(Expressir::Model::Literals::Integer)
2755
+ expect(x.operand2.value).to eq("2")
2756
+ end
2757
+
2758
+ x.variables.find{|x| x.id == "gte_expression"}.expression.tap do |x|
2759
+ expect(x).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2760
+ expect(x.operator).to eq(Expressir::Model::Expressions::BinaryExpression::GREATER_THAN_OR_EQUAL)
2761
+ expect(x.operand1).to be_instance_of(Expressir::Model::Literals::Integer)
2762
+ expect(x.operand1.value).to eq("4")
2763
+ expect(x.operand2).to be_instance_of(Expressir::Model::Literals::Integer)
2764
+ expect(x.operand2.value).to eq("2")
2765
+ end
2766
+
2767
+ x.variables.find{|x| x.id == "not_expression"}.expression.tap do |x|
2768
+ expect(x).to be_instance_of(Expressir::Model::Expressions::UnaryExpression)
2769
+ expect(x.operator).to eq(Expressir::Model::Expressions::UnaryExpression::NOT)
2770
+ expect(x.operand).to be_instance_of(Expressir::Model::Literals::Logical)
2771
+ expect(x.operand.value).to eq(Expressir::Model::Literals::Logical::TRUE)
2772
+ end
2773
+
2774
+ x.variables.find{|x| x.id == "not_or_expression"}.expression.tap do |x|
2775
+ expect(x).to be_instance_of(Expressir::Model::Expressions::UnaryExpression)
2776
+ expect(x.operator).to eq(Expressir::Model::Expressions::UnaryExpression::NOT)
2777
+ expect(x.operand).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2778
+ expect(x.operand.operator).to eq(Expressir::Model::Expressions::BinaryExpression::OR)
2779
+ expect(x.operand.operand1).to be_instance_of(Expressir::Model::Literals::Logical)
2780
+ expect(x.operand.operand1.value).to eq(Expressir::Model::Literals::Logical::TRUE)
2781
+ expect(x.operand.operand2).to be_instance_of(Expressir::Model::Literals::Logical)
2782
+ expect(x.operand.operand2.value).to eq(Expressir::Model::Literals::Logical::FALSE)
2783
+ end
2784
+
2785
+ x.variables.find{|x| x.id == "or_expression"}.expression.tap do |x|
2786
+ expect(x).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2787
+ expect(x.operator).to eq(Expressir::Model::Expressions::BinaryExpression::OR)
2788
+ expect(x.operand1).to be_instance_of(Expressir::Model::Literals::Logical)
2789
+ expect(x.operand1.value).to eq(Expressir::Model::Literals::Logical::TRUE)
2790
+ expect(x.operand2).to be_instance_of(Expressir::Model::Literals::Logical)
2791
+ expect(x.operand2.value).to eq(Expressir::Model::Literals::Logical::FALSE)
2792
+ end
2793
+
2794
+ x.variables.find{|x| x.id == "and_expression"}.expression.tap do |x|
2795
+ expect(x).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2796
+ expect(x.operator).to eq(Expressir::Model::Expressions::BinaryExpression::AND)
2797
+ expect(x.operand1).to be_instance_of(Expressir::Model::Literals::Logical)
2798
+ expect(x.operand1.value).to eq(Expressir::Model::Literals::Logical::TRUE)
2799
+ expect(x.operand2).to be_instance_of(Expressir::Model::Literals::Logical)
2800
+ expect(x.operand2.value).to eq(Expressir::Model::Literals::Logical::FALSE)
2801
+ end
2802
+
2803
+ x.variables.find{|x| x.id == "or_or_expression"}.expression.tap do |x|
2804
+ expect(x).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2805
+ expect(x.operator).to eq(Expressir::Model::Expressions::BinaryExpression::OR)
2806
+ expect(x.operand1).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2807
+ expect(x.operand1.operator).to eq(Expressir::Model::Expressions::BinaryExpression::OR)
2808
+ expect(x.operand1.operand1).to be_instance_of(Expressir::Model::Literals::Logical)
2809
+ expect(x.operand1.operand1.value).to eq(Expressir::Model::Literals::Logical::TRUE)
2810
+ expect(x.operand1.operand2).to be_instance_of(Expressir::Model::Literals::Logical)
2811
+ expect(x.operand1.operand2.value).to eq(Expressir::Model::Literals::Logical::FALSE)
2812
+ expect(x.operand2).to be_instance_of(Expressir::Model::Literals::Logical)
2813
+ expect(x.operand2.value).to eq(Expressir::Model::Literals::Logical::TRUE)
2814
+ end
2815
+
2816
+ x.variables.find{|x| x.id == "and_and_expression"}.expression.tap do |x|
2817
+ expect(x).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2818
+ expect(x.operator).to eq(Expressir::Model::Expressions::BinaryExpression::AND)
2819
+ expect(x.operand1).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2820
+ expect(x.operand1.operator).to eq(Expressir::Model::Expressions::BinaryExpression::AND)
2821
+ expect(x.operand1.operand1).to be_instance_of(Expressir::Model::Literals::Logical)
2822
+ expect(x.operand1.operand1.value).to eq(Expressir::Model::Literals::Logical::TRUE)
2823
+ expect(x.operand1.operand2).to be_instance_of(Expressir::Model::Literals::Logical)
2824
+ expect(x.operand1.operand2.value).to eq(Expressir::Model::Literals::Logical::FALSE)
2825
+ expect(x.operand2).to be_instance_of(Expressir::Model::Literals::Logical)
2826
+ expect(x.operand2.value).to eq(Expressir::Model::Literals::Logical::TRUE)
2827
+ end
2828
+
2829
+ x.variables.find{|x| x.id == "or_and_expression"}.expression.tap do |x|
2830
+ expect(x).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2831
+ expect(x.operator).to eq(Expressir::Model::Expressions::BinaryExpression::OR)
2832
+ expect(x.operand1).to be_instance_of(Expressir::Model::Literals::Logical)
2833
+ expect(x.operand1.value).to eq(Expressir::Model::Literals::Logical::TRUE)
2834
+ expect(x.operand2).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2835
+ expect(x.operand2.operator).to eq(Expressir::Model::Expressions::BinaryExpression::AND)
2836
+ expect(x.operand2.operand1).to be_instance_of(Expressir::Model::Literals::Logical)
2837
+ expect(x.operand2.operand1.value).to eq(Expressir::Model::Literals::Logical::FALSE)
2838
+ expect(x.operand2.operand2).to be_instance_of(Expressir::Model::Literals::Logical)
2839
+ expect(x.operand2.operand2.value).to eq(Expressir::Model::Literals::Logical::TRUE)
2840
+ end
2841
+
2842
+ x.variables.find{|x| x.id == "and_or_expression"}.expression.tap do |x|
2843
+ expect(x).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2844
+ expect(x.operator).to eq(Expressir::Model::Expressions::BinaryExpression::OR)
2845
+ expect(x.operand1).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2846
+ expect(x.operand1.operator).to eq(Expressir::Model::Expressions::BinaryExpression::AND)
2847
+ expect(x.operand1.operand1).to be_instance_of(Expressir::Model::Literals::Logical)
2848
+ expect(x.operand1.operand1.value).to eq(Expressir::Model::Literals::Logical::TRUE)
2849
+ expect(x.operand1.operand2).to be_instance_of(Expressir::Model::Literals::Logical)
2850
+ expect(x.operand1.operand2.value).to eq(Expressir::Model::Literals::Logical::FALSE)
2851
+ expect(x.operand2).to be_instance_of(Expressir::Model::Literals::Logical)
2852
+ expect(x.operand2.value).to eq(Expressir::Model::Literals::Logical::TRUE)
2853
+ end
2854
+
2855
+ x.variables.find{|x| x.id == "parenthesis_or_and_expression"}.expression.tap do |x|
2856
+ expect(x).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2857
+ expect(x.operator).to eq(Expressir::Model::Expressions::BinaryExpression::AND)
2858
+ expect(x.operand1).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2859
+ expect(x.operand1.operator).to eq(Expressir::Model::Expressions::BinaryExpression::OR)
2860
+ expect(x.operand1.operand1).to be_instance_of(Expressir::Model::Literals::Logical)
2861
+ expect(x.operand1.operand1.value).to eq(Expressir::Model::Literals::Logical::TRUE)
2862
+ expect(x.operand1.operand2).to be_instance_of(Expressir::Model::Literals::Logical)
2863
+ expect(x.operand1.operand2.value).to eq(Expressir::Model::Literals::Logical::FALSE)
2864
+ expect(x.operand2).to be_instance_of(Expressir::Model::Literals::Logical)
2865
+ expect(x.operand2.value).to eq(Expressir::Model::Literals::Logical::TRUE)
2866
+ end
2867
+
2868
+ x.variables.find{|x| x.id == "and_parenthesis_or_expression"}.expression.tap do |x|
2869
+ expect(x).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2870
+ expect(x.operator).to eq(Expressir::Model::Expressions::BinaryExpression::AND)
2871
+ expect(x.operand1).to be_instance_of(Expressir::Model::Literals::Logical)
2872
+ expect(x.operand1.value).to eq(Expressir::Model::Literals::Logical::TRUE)
2873
+ expect(x.operand2).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2874
+ expect(x.operand2.operator).to eq(Expressir::Model::Expressions::BinaryExpression::OR)
2875
+ expect(x.operand2.operand1).to be_instance_of(Expressir::Model::Literals::Logical)
2876
+ expect(x.operand2.operand1.value).to eq(Expressir::Model::Literals::Logical::FALSE)
2877
+ expect(x.operand2.operand2).to be_instance_of(Expressir::Model::Literals::Logical)
2878
+ expect(x.operand2.operand2.value).to eq(Expressir::Model::Literals::Logical::TRUE)
2879
+ end
2880
+
2881
+ # aggregate initializer expressions
2882
+ x.variables.find{|x| x.id == "aggregate_initializer_expression"}.expression.tap do |x|
2883
+ expect(x).to be_instance_of(Expressir::Model::Expressions::AggregateInitializer)
2884
+ expect(x.items).to be_instance_of(Array)
2885
+ expect(x.items.count).to eq(1)
2886
+ expect(x.items[0]).to be_instance_of(Expressir::Model::Literals::Integer)
2887
+ expect(x.items[0].value).to eq("4")
2888
+ end
2889
+
2890
+ x.variables.find{|x| x.id == "repeated_aggregate_initializer_expression"}.expression.tap do |x|
2891
+ expect(x).to be_instance_of(Expressir::Model::Expressions::AggregateInitializer)
2892
+ expect(x.items).to be_instance_of(Array)
2893
+ expect(x.items.count).to eq(1)
2894
+ expect(x.items[0]).to be_instance_of(Expressir::Model::Expressions::AggregateItem)
2895
+ expect(x.items[0].expression).to be_instance_of(Expressir::Model::Literals::Integer)
2896
+ expect(x.items[0].expression.value).to eq("4")
2897
+ expect(x.items[0].repetition).to be_instance_of(Expressir::Model::Literals::Integer)
2898
+ expect(x.items[0].repetition.value).to eq("2")
2899
+ end
2900
+
2901
+ x.variables.find{|x| x.id == "complex_aggregate_initializer_expression"}.expression.tap do |x|
2902
+ expect(x).to be_instance_of(Expressir::Model::Expressions::AggregateInitializer)
2903
+ expect(x.items).to be_instance_of(Array)
2904
+ expect(x.items.count).to eq(1)
2905
+ expect(x.items[0]).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2906
+ expect(x.items[0].operator).to eq(Expressir::Model::Expressions::BinaryExpression::ADDITION)
2907
+ expect(x.items[0].operand1).to be_instance_of(Expressir::Model::Literals::Integer)
2908
+ expect(x.items[0].operand1.value).to eq("4")
2909
+ expect(x.items[0].operand2).to be_instance_of(Expressir::Model::Literals::Integer)
2910
+ expect(x.items[0].operand2.value).to eq("2")
2911
+ end
2912
+
2913
+ x.variables.find{|x| x.id == "complex_repeated_aggregate_initializer_expression"}.expression.tap do |x|
2914
+ expect(x).to be_instance_of(Expressir::Model::Expressions::AggregateInitializer)
2915
+ expect(x.items).to be_instance_of(Array)
2916
+ expect(x.items.count).to eq(1)
2917
+ expect(x.items[0]).to be_instance_of(Expressir::Model::Expressions::AggregateItem)
2918
+ expect(x.items[0].expression).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2919
+ expect(x.items[0].expression.operator).to eq(Expressir::Model::Expressions::BinaryExpression::ADDITION)
2920
+ expect(x.items[0].expression.operand1).to be_instance_of(Expressir::Model::Literals::Integer)
2921
+ expect(x.items[0].expression.operand1.value).to eq("4")
2922
+ expect(x.items[0].expression.operand2).to be_instance_of(Expressir::Model::Literals::Integer)
2923
+ expect(x.items[0].expression.operand2.value).to eq("2")
2924
+ expect(x.items[0].repetition).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
2925
+ expect(x.items[0].repetition.operator).to eq(Expressir::Model::Expressions::BinaryExpression::ADDITION)
2926
+ expect(x.items[0].repetition.operand1).to be_instance_of(Expressir::Model::Literals::Integer)
2927
+ expect(x.items[0].repetition.operand1.value).to eq("4")
2928
+ expect(x.items[0].repetition.operand2).to be_instance_of(Expressir::Model::Literals::Integer)
2929
+ expect(x.items[0].repetition.operand2.value).to eq("2")
2930
+ end
2931
+
2932
+ # function call or entity constructor expressions
2933
+ x.variables.find{|x| x.id == "call_expression"}.expression.tap do |x|
2934
+ expect(x).to be_instance_of(Expressir::Model::Expressions::Call)
2935
+ expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2936
+ expect(x.ref.id).to eq("parameter_function")
2937
+ expect(x.parameters).to be_instance_of(Array)
2938
+ expect(x.parameters.count).to eq(1)
2939
+ expect(x.parameters[0]).to be_instance_of(Expressir::Model::Literals::Logical)
2940
+ expect(x.parameters[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
2941
+ end
2942
+
2943
+ # reference expressions
2944
+ x.variables.find{|x| x.id == "simple_reference_expression"}.expression.tap do |x|
2945
+ expect(x).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2946
+ expect(x.id).to eq("test")
2947
+ end
2948
+
2949
+ x.variables.find{|x| x.id == "group_reference_expression"}.expression.tap do |x|
2950
+ expect(x).to be_instance_of(Expressir::Model::Expressions::GroupReference)
2951
+ expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2952
+ expect(x.ref.id).to eq("test")
2953
+ expect(x.entity).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2954
+ expect(x.entity.id).to eq("test2")
2955
+ end
2956
+
2957
+ x.variables.find{|x| x.id == "index_reference_expression"}.expression.tap do |x|
2958
+ expect(x).to be_instance_of(Expressir::Model::Expressions::IndexReference)
2959
+ expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2960
+ expect(x.ref.id).to eq("test")
2961
+ expect(x.index1).to be_instance_of(Expressir::Model::Literals::Integer)
2962
+ expect(x.index1.value).to eq("1")
2963
+ end
2964
+
2965
+ x.variables.find{|x| x.id == "index2_reference_expression"}.expression.tap do |x|
2966
+ expect(x).to be_instance_of(Expressir::Model::Expressions::IndexReference)
2967
+ expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2968
+ expect(x.ref.id).to eq("test")
2969
+ expect(x.index1).to be_instance_of(Expressir::Model::Literals::Integer)
2970
+ expect(x.index1.value).to eq("1")
2971
+ expect(x.index2).to be_instance_of(Expressir::Model::Literals::Integer)
2972
+ expect(x.index2.value).to eq("9")
2973
+ end
2974
+
2975
+ x.variables.find{|x| x.id == "attribute_reference_expression"}.expression.tap do |x|
2976
+ expect(x).to be_instance_of(Expressir::Model::Expressions::AttributeReference)
2977
+ expect(x.ref).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2978
+ expect(x.ref.id).to eq("test")
2979
+ expect(x.attribute).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
2980
+ expect(x.attribute.id).to eq("test2")
2981
+ end
2982
+
2983
+ # interval expressions
2984
+ x.variables.find{|x| x.id == "lt_lt_interval_expression"}.expression.tap do |x|
2985
+ expect(x).to be_instance_of(Expressir::Model::Expressions::Interval)
2986
+ expect(x.low).to be_instance_of(Expressir::Model::Literals::Integer)
2987
+ expect(x.low.value).to eq("1")
2988
+ expect(x.operator1).to eq(Expressir::Model::Expressions::BinaryExpression::LESS_THAN)
2989
+ expect(x.item).to be_instance_of(Expressir::Model::Literals::Integer)
2990
+ expect(x.item.value).to eq("5")
2991
+ expect(x.operator2).to eq(Expressir::Model::Expressions::BinaryExpression::LESS_THAN)
2992
+ expect(x.high).to be_instance_of(Expressir::Model::Literals::Integer)
2993
+ expect(x.high.value).to eq("9")
2994
+ end
2995
+
2996
+ x.variables.find{|x| x.id == "lte_lt_interval_expression"}.expression.tap do |x|
2997
+ expect(x).to be_instance_of(Expressir::Model::Expressions::Interval)
2998
+ expect(x.low).to be_instance_of(Expressir::Model::Literals::Integer)
2999
+ expect(x.low.value).to eq("1")
3000
+ expect(x.operator1).to eq(Expressir::Model::Expressions::BinaryExpression::LESS_THAN_OR_EQUAL)
3001
+ expect(x.item).to be_instance_of(Expressir::Model::Literals::Integer)
3002
+ expect(x.item.value).to eq("5")
3003
+ expect(x.operator2).to eq(Expressir::Model::Expressions::BinaryExpression::LESS_THAN)
3004
+ expect(x.high).to be_instance_of(Expressir::Model::Literals::Integer)
3005
+ expect(x.high.value).to eq("9")
3006
+ end
3007
+
3008
+ x.variables.find{|x| x.id == "lt_lte_interval_expression"}.expression.tap do |x|
3009
+ expect(x).to be_instance_of(Expressir::Model::Expressions::Interval)
3010
+ expect(x.low).to be_instance_of(Expressir::Model::Literals::Integer)
3011
+ expect(x.low.value).to eq("1")
3012
+ expect(x.operator1).to eq(Expressir::Model::Expressions::BinaryExpression::LESS_THAN)
3013
+ expect(x.item).to be_instance_of(Expressir::Model::Literals::Integer)
3014
+ expect(x.item.value).to eq("5")
3015
+ expect(x.operator2).to eq(Expressir::Model::Expressions::BinaryExpression::LESS_THAN_OR_EQUAL)
3016
+ expect(x.high).to be_instance_of(Expressir::Model::Literals::Integer)
3017
+ expect(x.high.value).to eq("9")
3018
+ end
3019
+
3020
+ x.variables.find{|x| x.id == "lte_lte_interval_expression"}.expression.tap do |x|
3021
+ expect(x).to be_instance_of(Expressir::Model::Expressions::Interval)
3022
+ expect(x.low).to be_instance_of(Expressir::Model::Literals::Integer)
3023
+ expect(x.low.value).to eq("1")
3024
+ expect(x.operator1).to eq(Expressir::Model::Expressions::BinaryExpression::LESS_THAN_OR_EQUAL)
3025
+ expect(x.item).to be_instance_of(Expressir::Model::Literals::Integer)
3026
+ expect(x.item.value).to eq("5")
3027
+ expect(x.operator2).to eq(Expressir::Model::Expressions::BinaryExpression::LESS_THAN_OR_EQUAL)
3028
+ expect(x.high).to be_instance_of(Expressir::Model::Literals::Integer)
3029
+ expect(x.high.value).to eq("9")
3030
+ end
3031
+
3032
+ x.variables.find{|x| x.id == "combine_expression"}.expression.tap do |x|
3033
+ expect(x).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
3034
+ expect(x.operator).to eq(Expressir::Model::Expressions::BinaryExpression::COMBINE)
3035
+ expect(x.operand1).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
3036
+ expect(x.operand1.id).to eq("test")
3037
+ expect(x.operand2).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
3038
+ expect(x.operand2.id).to eq("test2")
3039
+ end
3040
+
3041
+ x.variables.find{|x| x.id == "in_expression"}.expression.tap do |x|
3042
+ expect(x).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
3043
+ expect(x.operator).to eq(Expressir::Model::Expressions::BinaryExpression::IN)
3044
+ expect(x.operand1).to be_instance_of(Expressir::Model::Literals::Logical)
3045
+ expect(x.operand1.value).to eq(Expressir::Model::Literals::Logical::TRUE)
3046
+ expect(x.operand2).to be_instance_of(Expressir::Model::Expressions::AggregateInitializer)
3047
+ expect(x.operand2.items).to be_instance_of(Array)
3048
+ expect(x.operand2.items.count).to eq(1)
3049
+ expect(x.operand2.items[0]).to be_instance_of(Expressir::Model::Literals::Logical)
3050
+ expect(x.operand2.items[0].value).to eq(Expressir::Model::Literals::Logical::TRUE)
3051
+ end
3052
+
3053
+ x.variables.find{|x| x.id == "like_expression"}.expression.tap do |x|
3054
+ expect(x).to be_instance_of(Expressir::Model::Expressions::BinaryExpression)
3055
+ expect(x.operator).to eq(Expressir::Model::Expressions::BinaryExpression::LIKE)
3056
+ expect(x.operand1).to be_instance_of(Expressir::Model::Literals::String)
3057
+ expect(x.operand1.value).to eq("xxx")
3058
+ expect(x.operand2).to be_instance_of(Expressir::Model::Literals::String)
3059
+ expect(x.operand2.value).to eq("xxx")
3060
+ end
3061
+
3062
+ # query expressions
3063
+ x.variables.find{|x| x.id == "query_expression"}.expression.tap do |x|
3064
+ expect(x).to be_instance_of(Expressir::Model::Expressions::QueryExpression)
3065
+ expect(x.id).to eq("test")
3066
+ expect(x.aggregate_source).to be_instance_of(Expressir::Model::Expressions::SimpleReference)
3067
+ expect(x.aggregate_source.id).to eq("test2")
3068
+ expect(x.expression).to be_instance_of(Expressir::Model::Literals::Logical)
3069
+ expect(x.expression.value).to eq(Expressir::Model::Literals::Logical::TRUE)
3070
+ end
3034
3071
  end
3035
3072
  end
3036
3073
  end