expressir 0.2.9-x86-mingw32 → 0.2.10-x86-mingw32

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