expressir 0.2.7-x64-mingw32 → 0.2.12-x64-mingw32

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