expressir 0.2.5 → 0.2.10

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