pione 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (121) hide show
  1. data/History.txt +12 -1
  2. data/example/AbstractRule/AbstractRule.pione +40 -0
  3. data/example/Fib/Fib.pione +12 -5
  4. data/example/LucasNumber/LucasNumber.pione +1 -1
  5. data/example/MakePair/MakePair.pione +21 -6
  6. data/example/OddSelector/OddSelector.pione +17 -0
  7. data/example/OddSelector/data/1.i +0 -0
  8. data/example/OddSelector/data/10.i +0 -0
  9. data/example/OddSelector/data/2.i +0 -0
  10. data/example/OddSelector/data/3.i +0 -0
  11. data/example/OddSelector/data/4.i +0 -0
  12. data/example/OddSelector/data/5.i +0 -0
  13. data/example/OddSelector/data/6.i +0 -0
  14. data/example/OddSelector/data/7.i +0 -0
  15. data/example/OddSelector/data/8.i +0 -0
  16. data/example/OddSelector/data/9.i +0 -0
  17. data/example/SequentialParameter/SequentialParameter.pione +4 -0
  18. data/example/SieveOfEratosthenes/SieveOfEratosthenes.pione +31 -43
  19. data/example/SingleParticlesWithRef/SingleParticlesWithRef.pione +1 -1
  20. data/example/Touch/Touch.pione +3 -0
  21. data/lib/pione/command/pione-syntax-checker.rb +4 -4
  22. data/lib/pione/model/assignment.rb +6 -1
  23. data/lib/pione/model/basic-model.rb +92 -278
  24. data/lib/pione/model/binary-operator.rb +5 -1
  25. data/lib/pione/model/block.rb +17 -0
  26. data/lib/pione/model/boolean.rb +54 -22
  27. data/lib/pione/model/constraints.rb +34 -0
  28. data/lib/pione/model/data-expr.rb +184 -297
  29. data/lib/pione/model/feature-expr.rb +13 -4
  30. data/lib/pione/model/float.rb +24 -41
  31. data/lib/pione/model/integer.rb +75 -41
  32. data/lib/pione/model/keyed-sequence.rb +143 -0
  33. data/lib/pione/model/list.rb +12 -8
  34. data/lib/pione/model/message.rb +8 -4
  35. data/lib/pione/model/ordinal-sequence.rb +75 -0
  36. data/lib/pione/model/package.rb +6 -2
  37. data/lib/pione/model/parameters.rb +61 -9
  38. data/lib/pione/model/pione-method.rb +146 -0
  39. data/lib/pione/model/rule-expr.rb +44 -38
  40. data/lib/pione/model/rule-io.rb +11 -3
  41. data/lib/pione/model/rule.rb +105 -155
  42. data/lib/pione/model/sequence.rb +273 -0
  43. data/lib/pione/model/string.rb +75 -29
  44. data/lib/pione/model/ticket-expr.rb +17 -29
  45. data/lib/pione/model/type.rb +242 -0
  46. data/lib/pione/model/variable-table.rb +52 -53
  47. data/lib/pione/model/variable.rb +8 -4
  48. data/lib/pione/model.rb +34 -0
  49. data/lib/pione/parser/block-parser.rb +44 -20
  50. data/lib/pione/parser/common-parser.rb +2 -1
  51. data/lib/pione/parser/document-parser.rb +6 -1
  52. data/lib/pione/parser/expr-parser.rb +57 -11
  53. data/lib/pione/parser/flow-element-parser.rb +2 -2
  54. data/lib/pione/parser/rule-definition-parser.rb +23 -1
  55. data/lib/pione/patch/rinda-patch.rb +1 -5
  56. data/lib/pione/rule-handler/action-handler.rb +5 -5
  57. data/lib/pione/rule-handler/basic-handler.rb +30 -7
  58. data/lib/pione/rule-handler/empty-handler.rb +14 -0
  59. data/lib/pione/rule-handler/flow-handler.rb +132 -115
  60. data/lib/pione/rule-handler/root-handler.rb +6 -2
  61. data/lib/pione/rule-handler/update-criteria.rb +152 -0
  62. data/lib/pione/rule-handler.rb +14 -0
  63. data/lib/pione/system/identifier.rb +9 -9
  64. data/lib/pione/transformer/block-transformer.rb +4 -0
  65. data/lib/pione/transformer/expr-transformer.rb +1 -1
  66. data/lib/pione/transformer/flow-element-transformer.rb +4 -2
  67. data/lib/pione/transformer/literal-transformer.rb +14 -3
  68. data/lib/pione/transformer/rule-definition-transformer.rb +17 -5
  69. data/lib/pione/tuple-space/data-finder.rb +15 -52
  70. data/lib/pione/version.rb +1 -1
  71. data/lib/pione.rb +12 -38
  72. data/test/agent/spec_task-worker.rb +13 -12
  73. data/test/model/spec_assignment.rb +2 -2
  74. data/test/model/spec_binary-operator.rb +10 -10
  75. data/test/model/spec_block.rb +8 -8
  76. data/test/model/spec_boolean.rb +1 -72
  77. data/test/model/spec_boolean.yml +134 -0
  78. data/test/model/spec_data-expr.rb +50 -237
  79. data/test/model/spec_data-expr.yml +16 -45
  80. data/test/model/spec_data-expr_match.yml +45 -0
  81. data/test/model/spec_feature-expr.rb +2 -43
  82. data/test/model/spec_feature-expr.yml +0 -28
  83. data/test/model/spec_feature-expr_decide.yml +28 -0
  84. data/test/model/spec_float.rb +1 -119
  85. data/test/model/spec_float.yml +17 -0
  86. data/test/model/spec_integer.rb +1 -119
  87. data/test/model/spec_integer.yml +57 -0
  88. data/test/model/spec_keyed-sequence.rb +5 -0
  89. data/test/model/spec_keyed-sequence.yml +22 -0
  90. data/test/model/spec_message.rb +7 -7
  91. data/test/model/spec_parameters.rb +50 -63
  92. data/test/model/spec_pione-method.rb +56 -0
  93. data/test/model/spec_rule-expr.rb +18 -8
  94. data/test/model/spec_rule.rb +12 -12
  95. data/test/model/spec_sequence.rb +5 -0
  96. data/test/model/spec_sequence.yml +60 -0
  97. data/test/model/spec_string.rb +3 -70
  98. data/test/model/spec_string.yml +83 -0
  99. data/test/model/spec_ticket-expr.rb +4 -54
  100. data/test/model/spec_ticket-expr.yml +11 -0
  101. data/test/model/spec_variable-table.rb +41 -42
  102. data/test/model/spec_variable.rb +20 -22
  103. data/test/parser/spec_block-parser.yml +9 -0
  104. data/test/parser/spec_expr-parser.yml +0 -17
  105. data/test/parser/spec_flow-element-parser.yml +1 -1
  106. data/test/parser/spec_rule-definition-parser.yml +0 -4
  107. data/test/rule-handler/spec_update-criteria.pione +39 -0
  108. data/test/rule-handler/spec_update-criteria.rb +53 -0
  109. data/test/rule-handler/spec_update-criteria.yml +158 -0
  110. data/test/test-util.rb +25 -0
  111. data/test/transformer/spec_block-transformer.rb +7 -0
  112. data/test/transformer/spec_expr-transformer.rb +64 -19
  113. data/test/transformer/spec_flow-element-transformer.rb +11 -11
  114. data/test/transformer/spec_literal-transformer.rb +29 -29
  115. data/test/transformer/spec_rule-definition-transformer.rb +39 -21
  116. metadata +57 -11
  117. data/lib/pione/model/undefined-value.rb +0 -24
  118. data/lib/pione/tuple-space/update-criteria.rb +0 -97
  119. data/test/model/spec_list.rb +0 -26
  120. data/test/model/spec_rule-io.rb +0 -32
  121. data/test/spec_update-criteria.rb +0 -83
@@ -2,7 +2,7 @@ require_relative '../test-util'
2
2
 
3
3
  describe 'Model::DataExpr' do
4
4
  it 'should get expression informations' do
5
- exp = DataExpr.new('test.a')
5
+ exp = DataExpr.new('test.a').to_seq
6
6
  exp.should.be.each
7
7
  exp.should.be.not.all
8
8
  exp.should.be.not.stdout
@@ -10,45 +10,67 @@ describe 'Model::DataExpr' do
10
10
  end
11
11
 
12
12
  it 'should be each modifier' do
13
- exp = DataExpr.each('test.a')
14
- exp.should == DataExpr.new('test.a').each
13
+ exp = DataExpr.new('test.a').to_seq.set_each
15
14
  exp.should.be.each
16
15
  exp.should.be.not.all
17
- exp.mode.should.be.nil
16
+ exp.should.be.file
18
17
  end
19
18
 
20
19
  it 'should be all modifier' do
21
- exp = DataExpr.all('test.a')
22
- exp.should == DataExpr.new('test.a').all
20
+ exp = DataExpr.new('test.a').to_seq.set_all
23
21
  exp.should.be.not.each
24
22
  exp.should.be.all
25
- exp.mode.should.be.nil
23
+ exp.should.be.file
26
24
  end
27
25
 
28
26
  it 'should be stdout mode' do
29
- exp = DataExpr.new('test.a').stdout
27
+ exp = DataExpr.new('test.a').to_seq.set_stdout
30
28
  exp.should.be.stdout
31
29
  exp.should.be.not.stderr
32
30
  end
33
31
 
34
32
  it 'should be stderr mode' do
35
- exp = DataExpr.new('test.a').stderr
33
+ exp = DataExpr.new('test.a').to_seq.set_stderr
36
34
  exp.should.be.not.stdout
37
35
  exp.should.be.stderr
38
36
  end
39
37
 
40
38
  it 'should neglect update criteria' do
41
- exp = DataExpr.new('test.a').neglect
39
+ exp = DataExpr.new('test.a').to_seq.set_neglect
42
40
  exp.should.neglect
43
41
  exp.should.not.care
44
42
  end
45
43
 
46
44
  it 'should care update criteria' do
47
- exp = DataExpr.new('test.a').care
45
+ exp = DataExpr.new('test.a').to_seq.set_care
48
46
  exp.should.not.neglect
49
47
  exp.should.care
50
48
  end
51
49
 
50
+ it 'should have write operation' do
51
+ expr = DataExpr.new('A').to_seq.set_write
52
+ expr.should.write
53
+ expr.should.not.remove
54
+ expr.should.not.touch
55
+ expr.operation.should == :write
56
+ end
57
+
58
+ it 'should have remove operation' do
59
+ expr = DataExpr.new('A').to_seq.set_remove
60
+ expr.should.not.write
61
+ expr.should.remove
62
+ expr.should.not.touch
63
+ expr.operation.should == :remove
64
+ end
65
+
66
+ it 'should have touch operation' do
67
+ expr = DataExpr.new('A').to_seq.set_touch
68
+ expr.should.not.write
69
+ expr.should.not.remove
70
+ expr.should.touch
71
+ expr.operation.should == :touch
72
+ end
73
+
52
74
  it 'should match the same name' do
53
75
  exp = DataExpr.new('test.a')
54
76
  exp.should.match 'test.a'
@@ -207,11 +229,11 @@ describe 'Model::DataExpr' do
207
229
  end
208
230
 
209
231
  it 'should expand variables' do
210
- vtable1 = VariableTable.new(Variable.new('VAR') => PioneString.new('1'))
232
+ vtable1 = VariableTable.new(Variable.new('VAR') => PioneString.new('1').to_seq)
211
233
  exp1 = DataExpr.new('{$VAR}.a').eval(vtable1)
212
234
  exp1.match('1.a')
213
235
  exp1.should.not.match '1.b'
214
- vtable2 = VariableTable.new(Variable.new('VAR') => PioneString.new('*'))
236
+ vtable2 = VariableTable.new(Variable.new('VAR') => PioneString.new('*').to_seq)
215
237
  exp2 = DataExpr.new('{$VAR}.a').eval(vtable2)
216
238
  exp2.should.match '1.a'
217
239
  exp2.should.match '2.a'
@@ -221,7 +243,7 @@ describe 'Model::DataExpr' do
221
243
 
222
244
  it 'should expand an expression' do
223
245
  vtable = VariableTable.new
224
- vtable.set(Variable.new("X"), 1.to_pione)
246
+ vtable.set(Variable.new("X"), PioneInteger.new(1).to_seq)
225
247
  DataExpr.new('<? $X + 1 ?>.a').eval(vtable).name.should == "2.a"
226
248
  end
227
249
 
@@ -252,96 +274,10 @@ describe 'Model::DataExpr' do
252
274
  exp.select.should.empty
253
275
  end
254
276
 
255
- describe 'pione method ==' do
256
- it 'should get true' do
257
- DataExpr.new('test.a').call_pione_method("==", DataExpr.new('test.a')).should.be.true
258
- end
259
-
260
- it 'should get false' do
261
- DataExpr.new('test.a').call_pione_method("==", DataExpr.new('test.b')).should.be.false
262
- end
263
- end
264
-
265
- describe 'pione method !=' do
266
- it 'should get true' do
267
- DataExpr.new('test.a').call_pione_method("!=", DataExpr.new('test.b')).should.be.true
268
- end
269
-
270
- it 'should get false' do
271
- DataExpr.new('test.a').call_pione_method("!=", DataExpr.new('test.a')).should.be.false
272
- end
273
- end
274
-
275
- describe 'pione method all' do
276
- it 'should set modifier all' do
277
- DataExpr.new('test.a').call_pione_method("all").should ==
278
- DataExpr.new('test.a').all
279
- DataExpr.new('test.a').all.call_pione_method("all").should ==
280
- DataExpr.new('test.a').all
281
- end
282
- end
283
-
284
- describe 'pione method each' do
285
- it 'should set modifier each' do
286
- DataExpr.new('test.a').call_pione_method("each").should ==
287
- DataExpr.new('test.a').each
288
- DataExpr.new('test.a').all.call_pione_method("each").should ==
289
- DataExpr.new('test.a').each
290
- end
291
- end
292
-
293
277
  describe 'pione method except' do
294
278
  it 'should set a exception' do
295
- DataExpr.new('test.a').call_pione_method("except", DataExpr.new('test.b')).should ==
296
- DataExpr.new('test.a').except(DataExpr.new('test.b'))
297
- end
298
- end
299
-
300
- describe 'pione method stdout' do
301
- it 'should set stdout mode' do
302
- DataExpr.new('test.a').call_pione_method("stdout").should ==
303
- DataExpr.new('test.a').stdout
304
- DataExpr.new('test.a').stdout.call_pione_method("stdout").should ==
305
- DataExpr.new('test.a').stdout
306
- DataExpr.new('test.a').stderr.call_pione_method("stdout").should ==
307
- DataExpr.new('test.a').stdout
308
- end
309
- end
310
-
311
- describe 'pione method stderr' do
312
- it 'should set stderr mode' do
313
- DataExpr.new('test.a').call_pione_method("stderr").should ==
314
- DataExpr.new('test.a').stderr
315
- DataExpr.new('test.a').stdout.call_pione_method("stderr").should ==
316
- DataExpr.new('test.a').stderr
317
- DataExpr.new('test.a').stderr.call_pione_method("stderr").should ==
318
- DataExpr.new('test.a').stderr
319
- end
320
- end
321
-
322
- describe 'pione method: or' do
323
- it 'should get OR-relation data expression' do
324
- a = DataExpr.new('test.a')
325
- b = DataExpr.new('test.b')
326
- a.call_pione_method('or', b).should == DataExprOr.new([a, b])
327
- end
328
- end
329
-
330
- describe 'pione method: join' do
331
- it 'should join with the connective' do
332
- DataExpr.new('A:B').call_pione_method('join', PioneString.new(",")).should ==
333
- PioneString.new("A,B")
334
- end
335
- end
336
-
337
- describe "pione method: as_string" do
338
- it "should convert to string" do
339
- DataExpr.new('A').call_pione_method('as_string').should ==
340
- PioneString.new("A")
341
- DataExpr.new('A:B').call_pione_method('as_string').should ==
342
- PioneString.new("A:B")
343
- DataExprNull.instance.call_pione_method('as_string').should ==
344
- PioneString.new("")
279
+ DataExpr.new('test.a').to_seq.call_pione_method("except", DataExpr.new('test.b').to_seq).should ==
280
+ DataExpr.new('test.a').except(DataExpr.new('test.b')).to_seq
345
281
  end
346
282
  end
347
283
  end
@@ -368,155 +304,30 @@ describe "Model::DataExprNull" do
368
304
  @null.stderr.should == @null
369
305
  @null.neglect.should == @null
370
306
  @null.care.should == @null
371
- end
372
-
373
- it "should accept nonexistance" do
374
- @null.should.accept_nonexistence
307
+ @null.write.should == @null
308
+ @null.remove.should == @null
309
+ @null.touch.should == @null
375
310
  end
376
311
  end
377
312
 
378
313
  describe "Model::DataExprOr" do
379
314
  before do
380
- @a_each = Model::DataExpr.new('A')
381
- @a_all = Model::DataExpr.new('A').all
382
- @a_stdout = Model::DataExpr.new('A').stdout
383
- @a_stderr = Model::DataExpr.new('A').stderr
384
- @a_neglect = Model::DataExpr.new('A').neglect
385
- @a_care = Model::DataExpr.new('A').care
315
+ @a = Model::DataExpr.new('A')
386
316
  @a_aster = Model::DataExpr.new('A*')
387
317
  @aa_each = Model::DataExpr.new('AA')
388
- @b_each = Model::DataExpr.new('B')
389
- @b_all = Model::DataExpr.new('B').all
390
- @b_stdout = Model::DataExpr.new('B').stdout
391
- @b_stderr = Model::DataExpr.new('B').stderr
392
- @b_neglect = Model::DataExpr.new('B').neglect
393
- @b_care = Model::DataExpr.new('B').care
318
+ @b = Model::DataExpr.new('B')
394
319
  @null = Model::DataExprNull.instance
395
320
  end
396
321
 
397
322
  it "should match" do
398
- expr = Model::DataExprOr.new([@a_each, @b_each])
323
+ expr = Model::DataExprOr.new([@a, @b])
399
324
  expr.should.match('A')
400
325
  expr.should.match('B')
401
326
  expr.should.not.match('C')
402
- expr.modifier.should == :each
403
- end
404
-
405
- it 'should get/set modifier' do
406
- [ [@a_each, @b_each, @null],
407
- [@a_all, @b_all, @null] ].each do |vars|
408
- vars.combination(2) do |left, right|
409
- Model::DataExprOr.new([left, right]).all.modifier.should == :all
410
- Model::DataExprOr.new([left, right]).each.modifier.should == :each
411
- end
412
- end
413
- end
414
-
415
- it 'should get/set the mode' do
416
- [ [@a_each, @b_each, @null],
417
- [@a_stdout, @b_stdout, @null],
418
- [@a_stderr, @b_stderr, @null] ].each do |vars|
419
- vars.combination(2) do |left, right|
420
- Model::DataExprOr.new([left, right]).stdout.mode.should == :stdout
421
- Model::DataExprOr.new([left, right]).stderr.mode.should == :stderr
422
- end
423
- end
424
- end
425
-
426
- it 'should get/set the update criteria' do
427
- [ [@a_each, @b_each, @null],
428
- [@a_neglect, @b_neglect, @null],
429
- [@a_care, @b_care, @null] ].each do |vars|
430
- vars.combination(2) do |left, right|
431
- Model::DataExprOr.new([left, right]).neglect.update_criteria.should == :neglect
432
- Model::DataExprOr.new([left, right]).care.update_criteria.should == :care
433
- end
434
- end
435
- end
436
-
437
- it "should have each modifier" do
438
- Model::DataExprOr.new([@a_each, @b_each]).should.each
439
- Model::DataExprOr.new([@a_each, @null]).should.each
440
- Model::DataExprOr.new([@null, @a_each]).should.each
441
- end
442
-
443
- it "should not have all modifier" do
444
- Model::DataExprOr.new([@a_all, @b_all]).should.not.each
445
- Model::DataExprOr.new([@a_all, @null]).should.not.each
446
- Model::DataExprOr.new([@null, @a_all]).should.not.each
447
- end
448
-
449
- it "should have all modifier" do
450
- Model::DataExprOr.new([@a_all, @b_all]).should.all
451
- Model::DataExprOr.new([@a_all, @null]).should.all
452
- Model::DataExprOr.new([@null, @a_all]).should.all
453
- end
454
-
455
- it "should not have all modifier" do
456
- Model::DataExprOr.new([@a_each, @b_each]).should.not.all
457
- Model::DataExprOr.new([@a_each, @null]).should.not.all
458
- Model::DataExprOr.new([@null, @a_each]).should.not.all
459
- end
460
-
461
- it "should be stdout mode" do
462
- Model::DataExprOr.new([@a_stdout, @b_stdout]).should.stdout
463
- Model::DataExprOr.new([@a_stdout, @null]).should.stdout
464
- Model::DataExprOr.new([@null, @a_stdout]).should.stdout
465
- end
466
-
467
- it "should be not stdout mode" do
468
- Model::DataExprOr.new([@a_stderr, @b_stderr]).should.not.stdout
469
- Model::DataExprOr.new([@a_stderr, @null]).should.not.stdout
470
- Model::DataExprOr.new([@null, @a_stderr]).should.not.stdout
471
- end
472
-
473
- it "should be stderr mode" do
474
- Model::DataExprOr.new([@a_stderr, @b_stderr]).should.stderr
475
- Model::DataExprOr.new([@a_stderr, @null]).should.stderr
476
- Model::DataExprOr.new([@null, @a_stderr]).should.stderr
477
- end
478
-
479
- it "should be not stderr mode" do
480
- Model::DataExprOr.new([@a_stdout, @b_stdout]).should.not.stderr
481
- Model::DataExprOr.new([@a_stdout, @null]).should.not.stderr
482
- Model::DataExprOr.new([@null, @a_stdout]).should.not.stderr
483
- end
484
-
485
- it "should neglect update criteria" do
486
- Model::DataExprOr.new([@a_neglect, @b_neglect]).should.neglect
487
- Model::DataExprOr.new([@a_neglect, @null]).should.neglect
488
- Model::DataExprOr.new([@null, @a_neglect]).should.neglect
489
- end
490
-
491
- it "should not neglect update criteria" do
492
- Model::DataExprOr.new([@a_care, @b_care]).should.not.neglect
493
- Model::DataExprOr.new([@a_care, @null]).should.not.neglect
494
- Model::DataExprOr.new([@null, @a_care]).should.not.neglect
495
- end
496
-
497
- it "should care update criteria" do
498
- Model::DataExprOr.new([@a_care, @b_care]).should.care
499
- Model::DataExprOr.new([@a_care, @null]).should.care
500
- Model::DataExprOr.new([@null, @a_care]).should.care
501
- end
502
-
503
- it "should not care update criteria" do
504
- Model::DataExprOr.new([@a_neglect, @b_neglect]).should.not.care
505
- Model::DataExprOr.new([@a_neglect, @null]).should.not.care
506
- Model::DataExprOr.new([@null, @a_neglect]).should.not.care
507
- end
508
-
509
- it "should accept nonexistance" do
510
- Model::DataExprOr.new([@a_each, @null]).should.accept_nonexistence
511
- Model::DataExprOr.new([@null, @a_each]).should.accept_nonexistence
512
- end
513
-
514
- it "should not accept nonexistance" do
515
- Model::DataExprOr.new([@a_each, @b_each]).should.not.accept_nonexistence
516
327
  end
517
328
 
518
329
  it "should get/set exceptions" do
519
- Model::DataExprOr.new([@a_aster, @b_each]).except(@aa_each).tap do |expr|
330
+ Model::DataExprOr.new([@a_aster, @b]).except(@aa_each).tap do |expr|
520
331
  expr.exceptions.should == [@aa_each]
521
332
  expr.should.match("AAA")
522
333
  expr.should.match("B")
@@ -530,7 +341,7 @@ end
530
341
  #
531
342
  # test cases
532
343
  #
533
- yamlname = 'spec_data-expr.yml'
344
+ yamlname = 'spec_data-expr_match.yml'
534
345
  ymlpath = File.join(File.dirname(__FILE__), yamlname)
535
346
  testcases = YAML.load_file(ymlpath)
536
347
 
@@ -542,14 +353,16 @@ describe "Model::DataExpr variation tests" do
542
353
 
543
354
  testcase['match'].map do |name|
544
355
  it "#{expr} should match #{name}" do
545
- data_expr.eval(VariableTable.new).should.match(name)
356
+ data_expr.eval(VariableTable.new).first.should.match(name)
546
357
  end
547
358
  end
548
359
 
549
360
  testcase['unmatch'].map do |name|
550
361
  it "#{expr} should unmatch #{name}" do
551
- data_expr.eval(VariableTable.new).should.not.match(name)
362
+ data_expr.eval(VariableTable.new).first.should.not.match(name)
552
363
  end
553
364
  end
554
365
  end
366
+
367
+ test_pione_method("data-expr")
555
368
  end
@@ -1,45 +1,16 @@
1
- "'*.a'":
2
- match:
3
- - "1.a"
4
- - "2.a"
5
- - "3.a"
6
- - "123.a"
7
- unmatch:
8
- - "1.b"
9
- - ".a"
10
- - "a"
11
- - "1.1a"
12
- - "1.aa"
13
- - "123.aa"
14
- "'A:B'":
15
- match:
16
- - "A"
17
- - "B"
18
- unmatch:
19
- - "AB"
20
- - "BA"
21
- "'*.a:*.b'":
22
- match:
23
- - "1.a"
24
- - "1.b"
25
- unmatch:
26
- - "1.ab"
27
- - "1.ba"
28
- - ".a"
29
- - ".b"
30
- "'A' or 'B'":
31
- match:
32
- - "A"
33
- - "B"
34
- unmatch:
35
- - "AB"
36
- - "BA"
37
- "'*.a' or '*.b'":
38
- match:
39
- - "1.a"
40
- - "1.b"
41
- unmatch:
42
- - "1.ab"
43
- - "1.ba"
44
- - ".a"
45
- - ".b"
1
+ # |
2
+ - "'a' | 'b' | 'c'" : "'a' | 'b' | 'c'"
3
+
4
+ # except
5
+ - "'a'.except('b')" : "'a'.except('b')"
6
+ - "'a'.except('b'.except('c'))" : "'a'.except('b'.except('c'))"
7
+
8
+ # exceptions
9
+ - "'b'" : "'a'.except('b').exceptions"
10
+
11
+ # accept_nonexistence?
12
+ - "true" : "('a' or null).accept_nonexistence?"
13
+
14
+ # as_string
15
+ - '"a b c"' : "('a' | 'b' | 'c').as_string.join(\" \")"
16
+
@@ -0,0 +1,45 @@
1
+ "'*.a'":
2
+ match:
3
+ - "1.a"
4
+ - "2.a"
5
+ - "3.a"
6
+ - "123.a"
7
+ unmatch:
8
+ - "1.b"
9
+ - ".a"
10
+ - "a"
11
+ - "1.1a"
12
+ - "1.aa"
13
+ - "123.aa"
14
+ "'A:B'":
15
+ match:
16
+ - "A"
17
+ - "B"
18
+ unmatch:
19
+ - "AB"
20
+ - "BA"
21
+ "'*.a:*.b'":
22
+ match:
23
+ - "1.a"
24
+ - "1.b"
25
+ unmatch:
26
+ - "1.ab"
27
+ - "1.ba"
28
+ - ".a"
29
+ - ".b"
30
+ "'A' or 'B'":
31
+ match:
32
+ - "A"
33
+ - "B"
34
+ unmatch:
35
+ - "AB"
36
+ - "BA"
37
+ "'*.a' or '*.b'":
38
+ match:
39
+ - "1.a"
40
+ - "1.b"
41
+ unmatch:
42
+ - "1.ab"
43
+ - "1.ba"
44
+ - ".a"
45
+ - ".b"
@@ -225,7 +225,7 @@ describe 'Feature::Expr' do
225
225
  #
226
226
  # test cases
227
227
  #
228
- yamlname = 'spec_feature-expr.yml'
228
+ yamlname = 'spec_feature-expr_decide.yml'
229
229
  ymlpath = File.join(File.dirname(__FILE__), yamlname)
230
230
  testcases = YAML.load_file(ymlpath)
231
231
 
@@ -329,46 +329,5 @@ describe 'Feature::Expr' do
329
329
  end
330
330
  end
331
331
 
332
- describe "pione method ==" do
333
- it 'should get true' do
334
- requisite_a = Feature::RequisiteExpr.new("X")
335
- requisite_b = Feature::RequisiteExpr.new("X")
336
- requisite_a.call_pione_method("==", requisite_b).should ==
337
- PioneBoolean.true
338
- end
339
-
340
- it 'should get false' do
341
- requisite_a = Feature::RequisiteExpr.new("X")
342
- requisite_b = Feature::RequisiteExpr.new("Y")
343
- requisite_a.call_pione_method("==", requisite_b).should ==
344
- PioneBoolean.false
345
- end
346
- end
347
-
348
- describe "pione method !=" do
349
- it 'should get true' do
350
- requisite_a = Feature::RequisiteExpr.new("X")
351
- requisite_b = Feature::RequisiteExpr.new("Y")
352
- requisite_a.call_pione_method("!=", requisite_b).should ==
353
- PioneBoolean.true
354
- end
355
-
356
- it 'should get false' do
357
- requisite_a = Feature::RequisiteExpr.new("X")
358
- requisite_b = Feature::RequisiteExpr.new("X")
359
- requisite_a.call_pione_method("!=", requisite_b).should ==
360
- PioneBoolean.false
361
- end
362
- end
363
-
364
- describe "pione method as_string" do
365
- it 'should get string' do
366
- requisite = Feature::RequisiteExpr.new("X")
367
- requisite.call_pione_method("as_string").should ==
368
- PioneString.new("+X")
369
- blocking = Feature::BlockingExpr.new("X")
370
- blocking.call_pione_method("as_string").should ==
371
- PioneString.new("-X")
372
- end
373
- end
332
+ # test_pione_method("feature-expr")
374
333
  end
@@ -1,28 +0,0 @@
1
- unification:
2
- AND:
3
- unify_redundant_feature:
4
- case1:
5
- expr1: "+X & +Y"
6
- expr2: "+X"
7
- result: "+X & +Y"
8
- case2:
9
- expr1: "+X & +Y"
10
- expr2: "+Y"
11
- result: "+X & +Y"
12
- sentence:
13
- case1:
14
- provide: "^X"
15
- request: "+X"
16
- result: true
17
- case2:
18
- provide: "^X"
19
- request: "*"
20
- result: true
21
- case3:
22
- provide: "^X"
23
- request: "+Y"
24
- result: false
25
- case4:
26
- provide: "^X"
27
- request: "-X"
28
- result: false
@@ -0,0 +1,28 @@
1
+ unification:
2
+ AND:
3
+ unify_redundant_feature:
4
+ case1:
5
+ expr1: "+X & +Y"
6
+ expr2: "+X"
7
+ result: "+X & +Y"
8
+ case2:
9
+ expr1: "+X & +Y"
10
+ expr2: "+Y"
11
+ result: "+X & +Y"
12
+ sentence:
13
+ case1:
14
+ provide: "^X"
15
+ request: "+X"
16
+ result: true
17
+ case2:
18
+ provide: "^X"
19
+ request: "*"
20
+ result: true
21
+ case3:
22
+ provide: "^X"
23
+ request: "+Y"
24
+ result: false
25
+ case4:
26
+ provide: "^X"
27
+ request: "-X"
28
+ result: false