pione 0.1.4 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +4 -3
- data/.simplecov +7 -0
- data/.travis.yml +8 -0
- data/Gemfile +3 -0
- data/History.txt +13 -0
- data/README.md +2 -0
- data/Rakefile +16 -6
- data/bin/pione-val +5 -0
- data/example/AbstractRule/package.yml +1 -0
- data/example/HelloWorld/package.yml +2 -0
- data/example/HelloWorld/scenario/scenario.yml +2 -0
- data/example/LoopByTouch/LoopByTouch.pione +28 -0
- data/example/LoopByTouch/package.yml +1 -0
- data/example/MakePair/package.yml +2 -0
- data/example/MakePair/{data → scenario/input}/1.i +0 -0
- data/example/MakePair/{data → scenario/input}/2.i +0 -0
- data/example/MakePair/{data → scenario/input}/3.i +0 -0
- data/example/MakePair/{data → scenario/input}/4.i +0 -0
- data/example/MakePair/{data → scenario/input}/5.i +0 -0
- data/example/MakePair/scenario/scenario.yml +1 -0
- data/example/ScoreAggregation/ScoreAggregation.pione +122 -0
- data/example/ScoreAggregation/bin/apply-template.rb +10 -0
- data/example/ScoreAggregation/bin/histgram-graph.sh +18 -0
- data/example/ScoreAggregation/bin/mean-summary.rb +10 -0
- data/example/ScoreAggregation/bin/personal-bar-graph.sh +18 -0
- data/example/ScoreAggregation/bin/personal-pre-statistics.rb +37 -0
- data/example/ScoreAggregation/bin/total-mean.rb +10 -0
- data/example/ScoreAggregation/bin/total-statistics.rb +43 -0
- data/example/ScoreAggregation/generate-data.rb +63 -0
- data/example/ScoreAggregation/package.yml +1 -0
- data/example/ScoreAggregation/scenario/case1/input/A.score +15 -0
- data/example/ScoreAggregation/scenario/case1/input/B.score +15 -0
- data/example/ScoreAggregation/scenario/case1/input/C.score +15 -0
- data/example/ScoreAggregation/scenario/case1/input/D.score +15 -0
- data/example/ScoreAggregation/scenario/case1/input/E.score +15 -0
- data/example/ScoreAggregation/scenario/case1/input/F.score +15 -0
- data/example/ScoreAggregation/scenario/case1/input/G.score +15 -0
- data/example/ScoreAggregation/scenario/case1/input/H.score +15 -0
- data/example/ScoreAggregation/scenario/case1/input/I.score +15 -0
- data/example/ScoreAggregation/scenario/case1/input/J.score +15 -0
- data/example/ScoreAggregation/scenario/case1/input/K.score +15 -0
- data/example/ScoreAggregation/scenario/case1/input/L.score +15 -0
- data/example/ScoreAggregation/scenario/case1/input/M.score +15 -0
- data/example/ScoreAggregation/scenario/case1/input/N.score +15 -0
- data/example/ScoreAggregation/scenario/case1/input/O.score +15 -0
- data/example/ScoreAggregation/scenario/case1/input/P.score +15 -0
- data/example/ScoreAggregation/scenario/case1/input/Q.score +15 -0
- data/example/ScoreAggregation/scenario/case1/input/R.score +15 -0
- data/example/ScoreAggregation/scenario/case1/input/S.score +15 -0
- data/example/ScoreAggregation/scenario/case1/input/T.score +15 -0
- data/example/ScoreAggregation/scenario/case1/input/U.score +15 -0
- data/example/ScoreAggregation/scenario/case1/input/V.score +15 -0
- data/example/ScoreAggregation/scenario/case1/input/W.score +15 -0
- data/example/ScoreAggregation/scenario/case1/input/X.score +15 -0
- data/example/ScoreAggregation/scenario/case1/input/Y.score +15 -0
- data/example/ScoreAggregation/scenario/case1/input/Z.score +15 -0
- data/example/ScoreAggregation/scenario/case1/input/stat-template.erb +24 -0
- data/example/ScoreAggregation/scenario/case1/scenario.yml +3 -0
- data/example/{SequentialProcess/SequentialProcess.pione → SerialProcessing/SerialProcessing.pione} +0 -0
- data/example/SerialProcessing/package.yml +1 -0
- data/example/WorkflowPatterns/01_Sequence/Sequence.pione +21 -0
- data/example/WorkflowPatterns/02_PrallelSplit/ParallelSplit.pione +29 -0
- data/example/WorkflowPatterns/03_Synchronization/Synchronization.pione +30 -0
- data/example/WorkflowPatterns/04_ExclusiveChoice/ExclusiveChoice.pione +44 -0
- data/example/WorkflowPatterns/05_SimpleMerge/SimpleMerge.pione +44 -0
- data/example/WorkflowPatterns/06_MultiChoice/MultiChoice.pione +48 -0
- data/example/WorkflowPatterns/07_StructuredSynchronizingMerge/StructuredSynchronizingMerge.pione +71 -0
- data/example/WorkflowPatterns/08_MultiMerge/MultiMerge.pione +44 -0
- data/example/WorkflowPatterns/11_ImplicitTermination/ImplicitTermination.pione +29 -0
- data/example/WorkflowPatterns/12_MultipleInstancesWithoutSynchronization/MultipleInstancesWithoutSynchronization.pione +29 -0
- data/example/WorkflowPatterns/13_MultipleInstancesWithDesignTimeKnowledge/MultipleInstancesWithDesignTimeKnowledge.pione +28 -0
- data/example/WorkflowPatterns/14_MultipleInstancesWithRunTimeKnowledge/MultipleInstancesWithRunTimeKnowledge.pione +33 -0
- data/example/WorkflowPatterns/33_GeneralizedANDJoin/GeneralizedANDJoin.pione +21 -0
- data/example/WorkflowPatterns/37_LocalSynchronizingMerge/LocalSynchronizingMerge.pione +101 -0
- data/example/WorkflowPatterns/41_ThreadMerge/ThreadMerge.pione +43 -0
- data/example/WorkflowPatterns/42_ThreadSplit/ThreadSplit.pione +16 -0
- data/lib/pione.rb +23 -47
- data/lib/pione/agent/broker.rb +1 -1
- data/lib/pione/agent/input-generator.rb +1 -1
- data/lib/pione/agent/logger.rb +62 -49
- data/lib/pione/agent/messenger.rb +38 -0
- data/lib/pione/agent/rule-provider.rb +3 -3
- data/lib/pione/agent/task-worker.rb +14 -2
- data/lib/pione/agent/tuple-space-client.rb +1 -1
- data/lib/pione/agent/tuple-space-server-client-life-checker.rb +5 -3
- data/lib/pione/command.rb +2 -0
- data/lib/pione/command/basic-command.rb +1 -1
- data/lib/pione/command/pione-client.rb +57 -16
- data/lib/pione/command/pione-log.rb +5 -5
- data/lib/pione/command/pione-syntax-checker.rb +22 -7
- data/lib/pione/command/pione-task-worker.rb +36 -19
- data/lib/pione/command/pione-tuple-space-viewer.rb +3 -3
- data/lib/pione/command/pione-val.rb +40 -0
- data/lib/pione/component.rb +8 -0
- data/lib/pione/{system → component}/document.rb +13 -11
- data/lib/pione/component/package.rb +269 -0
- data/lib/pione/component/rule.rb +206 -0
- data/lib/pione/location/basic-location.rb +49 -7
- data/lib/pione/location/ftp-location.rb +19 -6
- data/lib/pione/location/local-location.rb +15 -6
- data/lib/pione/log.rb +4 -1
- data/lib/pione/log/{domain-info.rb → domain-log.rb} +23 -11
- data/lib/pione/{util/console-message.rb → log/message-log.rb} +16 -15
- data/lib/pione/log/process-log.rb +35 -86
- data/lib/pione/log/process-record.rb +24 -11
- data/lib/pione/log/system-log.rb +107 -0
- data/lib/pione/log/xes-log.rb +54 -48
- data/lib/pione/model.rb +1 -3
- data/lib/pione/model/assignment.rb +1 -0
- data/lib/pione/model/basic-model.rb +31 -15
- data/lib/pione/model/block.rb +1 -1
- data/lib/pione/model/boolean.rb +10 -23
- data/lib/pione/model/constraints.rb +12 -0
- data/lib/pione/model/data-expr.rb +31 -36
- data/lib/pione/model/feature-expr.rb +6 -23
- data/lib/pione/model/float.rb +29 -18
- data/lib/pione/model/integer.rb +44 -56
- data/lib/pione/model/keyed-sequence.rb +11 -4
- data/lib/pione/model/message.rb +4 -4
- data/lib/pione/model/ordinal-sequence.rb +12 -14
- data/lib/pione/model/package-expr.rb +53 -0
- data/lib/pione/model/parameters.rb +12 -11
- data/lib/pione/model/pione-method.rb +2 -2
- data/lib/pione/model/rule-expr.rb +30 -52
- data/lib/pione/model/sequence.rb +26 -26
- data/lib/pione/model/string.rb +13 -54
- data/lib/pione/model/ticket-expr.rb +12 -53
- data/lib/pione/model/type.rb +7 -1
- data/lib/pione/model/variable-table.rb +5 -4
- data/lib/pione/model/variable.rb +0 -5
- data/lib/pione/option/common-option.rb +2 -1
- data/lib/pione/option/task-worker-owner-option.rb +1 -1
- data/lib/pione/patch/drb-patch.rb +1 -1
- data/lib/pione/patch/em-ftpd-patch.rb +7 -0
- data/lib/pione/patch/rinda-patch.rb +53 -0
- data/lib/pione/patch/uri-patch.rb +5 -0
- data/lib/pione/relay/relay-socket.rb +2 -2
- data/lib/pione/rule-handler/action-handler.rb +71 -64
- data/lib/pione/rule-handler/basic-handler.rb +50 -32
- data/lib/pione/rule-handler/flow-handler.rb +51 -34
- data/lib/pione/rule-handler/update-criteria.rb +43 -20
- data/lib/pione/system.rb +13 -0
- data/lib/pione/system/domain-info.rb +34 -0
- data/lib/pione/system/global.rb +8 -1
- data/lib/pione/system/object.rb +1 -1
- data/lib/pione/transformer/expr-transformer.rb +3 -3
- data/lib/pione/transformer/literal-transformer.rb +3 -3
- data/lib/pione/transformer/rule-definition-transformer.rb +11 -9
- data/lib/pione/tuple-space/tuple-space-server-interface.rb +19 -1
- data/lib/pione/tuple-space/tuple-space-server.rb +9 -2
- data/lib/pione/tuple.rb +30 -0
- data/lib/pione/tuple/data-null-tuple.rb +14 -0
- data/lib/pione/tuple/message-tuple.rb +7 -0
- data/lib/pione/tuple/process-log-tuple.rb +13 -0
- data/lib/pione/tuple/touch-tuple.rb +14 -0
- data/lib/pione/uri-scheme/myftp-scheme.rb +45 -0
- data/lib/pione/util.rb +18 -0
- data/lib/pione/util/cpu.rb +20 -0
- data/lib/pione/util/error-report.rb +9 -1
- data/lib/pione/util/evaluatable.rb +47 -0
- data/lib/pione/util/ftp-server.rb +468 -0
- data/lib/pione/util/id.rb +39 -0
- data/lib/pione/util/indentation.rb +19 -0
- data/lib/pione/util/ip-address.rb +35 -0
- data/lib/pione/util/misc.rb +0 -47
- data/lib/pione/util/uuid.rb +28 -0
- data/lib/pione/util/variable-holdable.rb +38 -0
- data/lib/pione/version.rb +1 -1
- data/pione.gemspec +16 -14
- data/test/agent/spec_logger.rb +35 -44
- data/test/agent/spec_messenger.rb +25 -0
- data/test/agent/spec_rule-provider.rb +1 -1
- data/test/agent/spec_task-worker.rb +7 -13
- data/test/{system → component}/spec_document.rb +20 -20
- data/test/component/spec_package.rb +77 -0
- data/test/component/spec_package/TestPackage/Test.pione +14 -0
- data/test/component/spec_package/TestPackage/bin/count +3 -0
- data/test/component/spec_package/TestPackage/package.yml +7 -0
- data/test/component/spec_package/TestPackage/scenario/case1/input/1.txt +1 -0
- data/test/component/spec_package/TestPackage/scenario/case1/scenario.yml +1 -0
- data/test/component/spec_rule.rb +140 -0
- data/test/endurance-test/graph.plt +12 -0
- data/test/endurance-test/run.sh +65 -0
- data/test/location/location-behavior.rb +125 -0
- data/test/location/spec_ftp-location.rb +28 -90
- data/test/location/spec_local-location.rb +26 -76
- data/test/log/raw-process-log/pione-process.log +710 -0
- data/test/log/spec_domain-log.rb +57 -0
- data/test/log/spec_message-log.rb +44 -0
- data/test/log/spec_process-log.rb +88 -0
- data/test/log/spec_process-record.rb +148 -0
- data/test/log/spec_system-log.rb +142 -0
- data/test/log/spec_xes-log.rb +2 -2
- data/test/model/spec_assignment.rb +26 -25
- data/test/model/spec_block.rb +51 -97
- data/test/model/spec_boolean.rb +0 -5
- data/test/model/spec_call-rule.rb +6 -6
- data/test/model/spec_data-expr.rb +0 -7
- data/test/model/spec_data-expr.yml +8 -0
- data/test/model/spec_float.rb +1 -1
- data/test/model/spec_float.yml +13 -0
- data/test/model/spec_integer.rb +1 -1
- data/test/model/spec_integer.yml +12 -1
- data/test/model/spec_keyed-sequence.yml +5 -0
- data/test/model/spec_message.rb +2 -4
- data/test/model/spec_package-expr.rb +19 -0
- data/test/model/spec_parameters.rb +56 -88
- data/test/model/spec_pione-method.rb +15 -14
- data/test/model/spec_rule-expr.rb +4 -52
- data/test/model/spec_rule-expr.yml +11 -0
- data/test/model/spec_sequence.yml +6 -0
- data/test/model/spec_string.rb +21 -13
- data/test/model/spec_string.yml +10 -2
- data/test/model/spec_ticket-expr.rb +25 -3
- data/test/model/spec_variable.rb +8 -8
- data/test/rule-handler/spec_action-handler.pione +37 -0
- data/test/rule-handler/spec_action-handler.rb +41 -97
- data/test/rule-handler/spec_flow-handler.rb +24 -30
- data/test/rule-handler/spec_update-criteria.pione +16 -0
- data/test/rule-handler/spec_update-criteria.rb +7 -4
- data/test/rule-handler/spec_update-criteria.yml +191 -0
- data/test/system/spec_domain-info.rb +25 -0
- data/test/test-util.rb +38 -228
- data/test/transformer/spec_block-transformer.rb +1 -1
- data/test/transformer/spec_expr-transformer.rb +30 -39
- data/test/transformer/spec_flow-element-transformer.rb +17 -17
- data/test/transformer/spec_literal-transformer.rb +3 -3
- data/test/transformer/spec_rule-definition-transformer.rb +55 -76
- data/test/{spec_data-finder.rb → tuple-space/spec_data-finder.rb} +1 -1
- data/test/{spec_data-finder.yml → tuple-space/spec_data-finder.yml} +0 -0
- data/test/tuple/spec_data-tuple.rb +5 -76
- data/test/tuple/spec_finished-tuple.rb +5 -46
- data/test/tuple/spec_message-tuple.rb +10 -0
- data/test/tuple/spec_task-tuple.rb +4 -110
- data/test/tuple/spec_touch-tuple.rb +14 -0
- data/test/tuple/tuple-behavior.rb +14 -0
- data/test/uri-scheme/spec_local-scheme.rb +1 -1
- data/test/uri-scheme/spec_myftp-scheme.rb +73 -0
- data/test/uri-scheme/spec_myftp-scheme.yml +85 -0
- data/test/util/spec_cpu.rb +8 -0
- data/test/util/spec_error-report.rb +42 -0
- data/test/util/spec_evaluatable.rb +18 -0
- data/test/util/spec_ftp-server.rb +249 -0
- data/test/util/spec_id.pione +14 -0
- data/test/util/spec_id.rb +77 -0
- data/test/util/spec_indentation.rb +77 -0
- data/test/util/spec_ip-address.rb +15 -0
- data/test/util/spec_uuid.rb +11 -0
- data/test/util/spec_variable-holdable.rb +69 -0
- metadata +282 -83
- data/bin/pione-eval +0 -111
- data/demo/demo.rb +0 -311
- data/demo/public/base.css +0 -94
- data/demo/public/demo.js +0 -107
- data/demo/public/index.html +0 -91
- data/demo/public/jquery-1.8.3.min.js +0 -2
- data/lib/pione/model/binary-operator.rb +0 -90
- data/lib/pione/model/list.rb +0 -108
- data/lib/pione/model/package.rb +0 -56
- data/lib/pione/model/rule-io.rb +0 -178
- data/lib/pione/model/rule.rb +0 -295
- data/lib/pione/system/identifier.rb +0 -61
- data/lib/pione/tuple/log-tuple.rb +0 -14
- data/lib/pione/util/terminal.rb +0 -78
- data/test/log/data/sample.log +0 -1003
- data/test/model/spec_binary-operator.rb +0 -39
- data/test/model/spec_package.rb +0 -15
- data/test/model/spec_rule.rb +0 -158
- data/test/spec_identifier.rb +0 -29
- data/test/spec_log.rb +0 -52
@@ -0,0 +1,19 @@
|
|
1
|
+
require_relative '../test-util'
|
2
|
+
|
3
|
+
describe 'Model::PackageExpr' do
|
4
|
+
before do
|
5
|
+
@package_expr = Model::PackageExpr.new('A')
|
6
|
+
end
|
7
|
+
|
8
|
+
it 'should equal' do
|
9
|
+
@package_expr.should == Model::PackageExpr.new('A')
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'should not equal' do
|
13
|
+
@package_expr.should != Model::PackageExpr.new('B')
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'should get a package name' do
|
17
|
+
@package_expr.name.should == 'A'
|
18
|
+
end
|
19
|
+
end
|
@@ -1,72 +1,62 @@
|
|
1
1
|
require_relative '../test-util'
|
2
2
|
|
3
|
-
describe 'Model::Parameters' do
|
3
|
+
describe 'Pione::Model::Parameters' do
|
4
4
|
before do
|
5
|
-
@
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
5
|
+
@a = PioneString.new("a")
|
6
|
+
@b = PioneString.new("b")
|
7
|
+
@c = PioneString.new("c")
|
8
|
+
@d = PioneString.new("d")
|
9
|
+
@i1 = PioneInteger.new(1)
|
10
|
+
@i2 = PioneInteger.new(2)
|
11
|
+
@i3 = PioneInteger.new(3)
|
12
|
+
@true = PioneBoolean.new(true)
|
13
|
+
@false = PioneBoolean.new(false)
|
14
|
+
@var_x = Variable.new("X")
|
15
|
+
@var_y = Variable.new("Y")
|
16
|
+
@var_z = Variable.new("Z")
|
17
|
+
@var_a = Variable.new("A")
|
18
|
+
@params = Parameters.new({@var_x => @a, @var_y => @b, @var_z => @c})
|
10
19
|
end
|
11
20
|
|
12
21
|
it 'should be equal' do
|
13
|
-
@
|
14
|
-
Variable.new("a") => PioneString.new("A"),
|
15
|
-
Variable.new("b") => PioneString.new("B"),
|
16
|
-
Variable.new("c") => PioneString.new("C")
|
17
|
-
})
|
18
|
-
set = Set.new
|
19
|
-
set.add(@params_a)
|
20
|
-
set.add(Parameters.new({
|
21
|
-
Variable.new("a") => PioneString.new("A"),
|
22
|
-
Variable.new("b") => PioneString.new("B"),
|
23
|
-
Variable.new("c") => PioneString.new("C")
|
24
|
-
}))
|
25
|
-
set.size.should == 1
|
22
|
+
@params.should == Parameters.new({@var_x => @a, @var_y => @b, @var_z => @c})
|
26
23
|
end
|
27
24
|
|
28
25
|
it 'should be not equal' do
|
29
|
-
@
|
30
|
-
Parameters.new({
|
31
|
-
Variable.new("a") => PioneString.new("X"),
|
32
|
-
Variable.new("b") => PioneString.new("Y"),
|
33
|
-
Variable.new("c") => PioneString.new("Z")
|
34
|
-
})
|
26
|
+
@params.should != Parameters.new({@var_z => @a, @var_y => @b, @var_x => @c})
|
35
27
|
end
|
36
28
|
|
37
|
-
it 'should get value' do
|
38
|
-
params
|
39
|
-
|
40
|
-
|
41
|
-
|
29
|
+
it 'should get the value' do
|
30
|
+
@params.tap do |x|
|
31
|
+
x.get(@var_x).should == @a
|
32
|
+
x.get(@var_y).should == @b
|
33
|
+
x.get(@var_z).should == @c
|
34
|
+
end
|
42
35
|
end
|
43
36
|
|
44
37
|
it 'should set a parameter' do
|
45
|
-
|
46
|
-
new_params
|
47
|
-
new_params.get(
|
48
|
-
new_params.get(
|
49
|
-
new_params.get(
|
50
|
-
|
51
|
-
params.get(Variable.new("d")).should.nil
|
38
|
+
new_params = @params.set(@var_a, @d)
|
39
|
+
new_params.get(@var_x).should == @a
|
40
|
+
new_params.get(@var_y).should == @b
|
41
|
+
new_params.get(@var_z).should == @c
|
42
|
+
new_params.get(@var_a).should == @d
|
43
|
+
@params.get(@var_a).should.nil
|
52
44
|
end
|
53
45
|
|
54
46
|
it 'should overwrite a parameter' do
|
55
|
-
|
56
|
-
new_params
|
57
|
-
new_params.get(
|
58
|
-
new_params.get(
|
59
|
-
|
60
|
-
params.get(Variable.new("a")).should == "A".to_pione
|
47
|
+
new_params = @params.set(@var_x, @d)
|
48
|
+
new_params.get(@var_x).should == @d
|
49
|
+
new_params.get(@var_y).should == @b
|
50
|
+
new_params.get(@var_z).should == @c
|
51
|
+
@params.get(@var_x).should == @a
|
61
52
|
end
|
62
53
|
|
63
54
|
it 'should delete a parameter' do
|
64
|
-
|
65
|
-
new_params
|
66
|
-
new_params.get(
|
67
|
-
new_params.get(
|
68
|
-
|
69
|
-
params.get(Variable.new("a")).should == "A".to_pione
|
55
|
+
new_params = @params.delete(@var_x)
|
56
|
+
new_params.get(@var_x).should.nil
|
57
|
+
new_params.get(@var_y).should == @b
|
58
|
+
new_params.get(@var_z).should == @c
|
59
|
+
@params.get(@var_x).should == @a
|
70
60
|
end
|
71
61
|
|
72
62
|
it 'should be empty' do
|
@@ -74,62 +64,40 @@ describe 'Model::Parameters' do
|
|
74
64
|
end
|
75
65
|
|
76
66
|
it 'should not be emtpy' do
|
77
|
-
@
|
67
|
+
@params.should.not.be.empty
|
78
68
|
end
|
79
69
|
|
80
70
|
it 'should expand sequence with each modifier' do
|
81
|
-
seq_a = StringSequence.new([
|
82
|
-
seq_b = IntegerSequence.new([
|
83
|
-
seq_c = BooleanSequence.new([
|
84
|
-
params = Parameters.new(
|
71
|
+
seq_a = StringSequence.new([@a, @b, @c]).set_each
|
72
|
+
seq_b = IntegerSequence.new([@i1, @i2, @i3]).set_each
|
73
|
+
seq_c = BooleanSequence.new([@true, @false]).set_each
|
74
|
+
params = Parameters.new(@var_x => seq_a, @var_y => seq_b, @var_z => seq_c)
|
85
75
|
params.to_a.tap do |list|
|
86
76
|
list.size.should == 18
|
87
77
|
comb = [
|
88
|
-
[
|
89
|
-
[
|
90
|
-
[
|
91
|
-
[
|
92
|
-
[
|
93
|
-
[
|
94
|
-
[PioneString.new("Y"), PioneInteger.new(1), PioneBoolean.new(true)],
|
95
|
-
[PioneString.new("Y"), PioneInteger.new(2), PioneBoolean.new(true)],
|
96
|
-
[PioneString.new("Y"), PioneInteger.new(3), PioneBoolean.new(true)],
|
97
|
-
[PioneString.new("Y"), PioneInteger.new(1), PioneBoolean.new(false)],
|
98
|
-
[PioneString.new("Y"), PioneInteger.new(2), PioneBoolean.new(false)],
|
99
|
-
[PioneString.new("Y"), PioneInteger.new(3), PioneBoolean.new(false)],
|
100
|
-
[PioneString.new("Z"), PioneInteger.new(1), PioneBoolean.new(true)],
|
101
|
-
[PioneString.new("Z"), PioneInteger.new(2), PioneBoolean.new(true)],
|
102
|
-
[PioneString.new("Z"), PioneInteger.new(3), PioneBoolean.new(true)],
|
103
|
-
[PioneString.new("Z"), PioneInteger.new(1), PioneBoolean.new(false)],
|
104
|
-
[PioneString.new("Z"), PioneInteger.new(2), PioneBoolean.new(false)],
|
105
|
-
[PioneString.new("Z"), PioneInteger.new(3), PioneBoolean.new(false)]
|
78
|
+
[@a, @i1, @true], [@a, @i2, @true], [@a, @i3, @true],
|
79
|
+
[@a, @i1, @false], [@a, @i2, @false], [@a, @i3, @false],
|
80
|
+
[@b, @i1, @true], [@b, @i2, @true], [@b, @i3, @true],
|
81
|
+
[@b, @i1, @false], [@b, @i2, @false], [@b, @i3, @false],
|
82
|
+
[@c, @i1, @true], [@c, @i2, @true], [@c, @i3, @true],
|
83
|
+
[@c, @i1, @false], [@c, @i2, @false], [@c, @i3, @false]
|
106
84
|
]
|
107
85
|
comb.each do |elts|
|
108
86
|
list.should.include(
|
109
|
-
Parameters.new(
|
110
|
-
Variable.new("A") => elts[0].to_seq,
|
111
|
-
Variable.new("B") => elts[1].to_seq,
|
112
|
-
Variable.new("C") => elts[2].to_seq
|
113
|
-
)
|
87
|
+
Parameters.new(@var_x => elts[0].to_seq, @var_y => elts[1].to_seq, @var_z => elts[2].to_seq)
|
114
88
|
)
|
115
89
|
end
|
116
90
|
end
|
117
91
|
end
|
118
92
|
|
119
93
|
it 'should expand sequences with all modifier' do
|
120
|
-
seq_a = StringSequence.new([
|
121
|
-
seq_b = IntegerSequence.new([
|
122
|
-
seq_c = BooleanSequence.new([
|
123
|
-
params = Parameters.new(
|
94
|
+
seq_a = StringSequence.new([@a, @b, @c]).set_all
|
95
|
+
seq_b = IntegerSequence.new([@i1, @i2, @i3]).set_all
|
96
|
+
seq_c = BooleanSequence.new([@true, @false]).set_all
|
97
|
+
params = Parameters.new(@var_x => seq_a, @var_y => seq_b, @var_z => seq_c)
|
124
98
|
params.to_a.tap do |list|
|
125
99
|
list.size.should == 1
|
126
|
-
list.should.include(
|
127
|
-
Parameters.new(
|
128
|
-
Variable.new("A") => seq_a,
|
129
|
-
Variable.new("B") => seq_b,
|
130
|
-
Variable.new("C") => seq_c
|
131
|
-
)
|
132
|
-
)
|
100
|
+
list.should.include(Parameters.new(@var_x => seq_a, @var_y => seq_b, @var_z => seq_c))
|
133
101
|
end
|
134
102
|
end
|
135
103
|
end
|
@@ -6,10 +6,11 @@ describe "Pione::Model::PioneMethod" do
|
|
6
6
|
@int_2 = PioneInteger.new(2).to_seq
|
7
7
|
@int_3 = PioneInteger.new(3).to_seq
|
8
8
|
@str_1 = PioneString.new(1).to_seq
|
9
|
-
@method_1 = Model::PioneMethod.new([TypeInteger], TypeInteger, lambda{|rec, arg1| arg1})
|
10
|
-
@method_2 = Model::PioneMethod.new([TypeInteger, TypeString], TypeInteger, lambda{|rec, arg1, arg2| arg1})
|
11
|
-
@method_3 = Model::PioneMethod.new([], :receiver_type, lambda{|rec| rec})
|
12
|
-
@method_bad = Model::PioneMethod.new([TypeString], TypeInteger, lambda{|rec, arg1| arg1})
|
9
|
+
@method_1 = Model::PioneMethod.new("m1", [TypeInteger], TypeInteger, lambda{|vtable, rec, arg1| arg1})
|
10
|
+
@method_2 = Model::PioneMethod.new("m2", [TypeInteger, TypeString], TypeInteger, lambda{|vtable, rec, arg1, arg2| arg1})
|
11
|
+
@method_3 = Model::PioneMethod.new("m3", [], :receiver_type, lambda{|vtable, rec| rec})
|
12
|
+
@method_bad = Model::PioneMethod.new("mbad", [TypeString], TypeInteger, lambda{|vtable, rec, arg1| arg1})
|
13
|
+
@vtable = Model::VariableTable.empty
|
13
14
|
end
|
14
15
|
|
15
16
|
it "should get inputs" do
|
@@ -27,10 +28,10 @@ describe "Pione::Model::PioneMethod" do
|
|
27
28
|
end
|
28
29
|
|
29
30
|
it "should be callable" do
|
30
|
-
@method_1.call(@int_1, @int_2).should == @int_2
|
31
|
-
@method_2.call(@int_1, @int_2, @str_1).should == @int_2
|
32
|
-
@method_3.call(@int_1).should == @int_1
|
33
|
-
@method_3.call(@str_1).should == @str_1
|
31
|
+
@method_1.call(@vtable, @int_1, @int_2).should == @int_2
|
32
|
+
@method_2.call(@vtable, @int_1, @int_2, @str_1).should == @int_2
|
33
|
+
@method_3.call(@vtable, @int_1).should == @int_1
|
34
|
+
@method_3.call(@vtable, @str_1).should == @str_1
|
34
35
|
end
|
35
36
|
|
36
37
|
it "should validate inputs" do
|
@@ -43,14 +44,14 @@ describe "Pione::Model::PioneMethod" do
|
|
43
44
|
end
|
44
45
|
|
45
46
|
it "should call" do
|
46
|
-
@method_1.call(@int_1, @int_2).should == @int_2
|
47
|
-
@method_2.call(@int_1, @int_2, @str_1).should == @int_2
|
48
|
-
@method_3.call(@int_1).should == @int_1
|
47
|
+
@method_1.call(@vtable, @int_1, @int_2).should == @int_2
|
48
|
+
@method_2.call(@vtable, @int_1, @int_2, @str_1).should == @int_2
|
49
|
+
@method_3.call(@vtable, @int_1).should == @int_1
|
49
50
|
end
|
50
51
|
|
51
52
|
it "should raise interface error" do
|
52
|
-
should.raise(MethodInterfaceError){ @method_1.call(@int_1, @str_1) }
|
53
|
-
should.raise(MethodInterfaceError){ @method_2.call(@int_1, @str_1, @str_1) }
|
54
|
-
should.raise(MethodInterfaceError){ @method_bad.call(@int_1, @str_1) }
|
53
|
+
should.raise(MethodInterfaceError){ @method_1.call(@vtable, @int_1, @str_1) }
|
54
|
+
should.raise(MethodInterfaceError){ @method_2.call(@vtable, @int_1, @str_1, @str_1) }
|
55
|
+
should.raise(MethodInterfaceError){ @method_bad.call(@vtable, @int_1, @str_1) }
|
55
56
|
end
|
56
57
|
end
|
@@ -2,12 +2,12 @@ require_relative '../test-util'
|
|
2
2
|
|
3
3
|
describe 'Model::RuleExpr' do
|
4
4
|
before do
|
5
|
-
@a = RuleExpr.new(
|
6
|
-
@b = RuleExpr.new(
|
5
|
+
@a = RuleExpr.new(PackageExpr.new("main"), "a")
|
6
|
+
@b = RuleExpr.new(PackageExpr.new("main"), "b")
|
7
7
|
end
|
8
8
|
|
9
9
|
it 'should be equal' do
|
10
|
-
@a.should == RuleExpr.new(
|
10
|
+
@a.should == RuleExpr.new(PackageExpr.new("main"), "a")
|
11
11
|
end
|
12
12
|
|
13
13
|
it 'should be not equal' do
|
@@ -24,53 +24,5 @@ describe 'Model::RuleExpr' do
|
|
24
24
|
@a.add_output_ticket_expr(ticket).output_ticket_expr.should == ticket
|
25
25
|
end
|
26
26
|
|
27
|
-
|
28
|
-
it 'should true' do
|
29
|
-
@a.call_pione_method(
|
30
|
-
"==", RuleExpr.new(Package.new("main"), "a")
|
31
|
-
).should == PioneBoolean.new(true).to_seq
|
32
|
-
end
|
33
|
-
|
34
|
-
it 'should false' do
|
35
|
-
@a.call_pione_method("==", @b).should.not.true
|
36
|
-
end
|
37
|
-
|
38
|
-
it 'should raise type error' do
|
39
|
-
should.raise(MethodNotFound) do
|
40
|
-
@a.call_pione_method("==", PioneInteger.new(1).to_seq)
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
describe 'pione method !=' do
|
46
|
-
it 'should true' do
|
47
|
-
@a.call_pione_method("!=", @b).should == PioneBoolean.new(true).to_seq
|
48
|
-
end
|
49
|
-
|
50
|
-
it 'should false' do
|
51
|
-
@a.call_pione_method(
|
52
|
-
"!=", RuleExpr.new(Package.new("main"), "a")
|
53
|
-
).should.not.true
|
54
|
-
end
|
55
|
-
|
56
|
-
it 'should raise type error' do
|
57
|
-
should.raise(MethodNotFound) do
|
58
|
-
@a.call_pione_method("!=", PioneInteger.new(1).to_seq)
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
describe 'pione method as_string' do
|
64
|
-
it 'should get string' do
|
65
|
-
@a.call_pione_method("as_string").should == PioneString.new("a").to_seq
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
describe 'pione method params' do
|
70
|
-
it 'should set parameters' do
|
71
|
-
params = Parameters.new({Variable.new("a") => PioneBoolean.true})
|
72
|
-
@a.call_pione_method("params", params).should ==
|
73
|
-
RuleExpr.new(Package.new("main"), "a", params: params)
|
74
|
-
end
|
75
|
-
end
|
27
|
+
test_pione_method("rule-expr")
|
76
28
|
end
|
@@ -54,6 +54,12 @@
|
|
54
54
|
- 'true | true | true' : '(1 | 2 | 3).member?(1 | 2 | 3)'
|
55
55
|
- 'true | false' : '(1 | 2).member?(1 | 3)'
|
56
56
|
|
57
|
+
# empty?
|
58
|
+
# literal for empty sequences don't not exist now
|
59
|
+
- 'false' : '(1 | 2 | 3).empty?'
|
60
|
+
- 'false' : '(1 | 2).empty?'
|
61
|
+
- 'false' : '1.empty?'
|
62
|
+
|
57
63
|
# reverse
|
58
64
|
- '3 | 2 | 1' : '(1 | 2 | 3).reverse'
|
59
65
|
- '1' : '1.reverse'
|
data/test/model/spec_string.rb
CHANGED
@@ -1,13 +1,17 @@
|
|
1
1
|
require_relative '../test-util'
|
2
2
|
|
3
|
-
describe 'Model::PioneString' do
|
3
|
+
describe 'Pione::Model::PioneString' do
|
4
4
|
before do
|
5
5
|
@a = PioneString.new("a")
|
6
6
|
@b = PioneString.new("b")
|
7
|
+
@vtable = VariableTable.new({
|
8
|
+
Variable.new("var1") => @a.to_seq,
|
9
|
+
Variable.new("var2") => @b.to_seq
|
10
|
+
})
|
7
11
|
end
|
8
12
|
|
9
|
-
it 'should
|
10
|
-
@a.
|
13
|
+
it 'should the value' do
|
14
|
+
@a.value.should == "a"
|
11
15
|
end
|
12
16
|
|
13
17
|
it 'should equal' do
|
@@ -15,23 +19,27 @@ describe 'Model::PioneString' do
|
|
15
19
|
end
|
16
20
|
|
17
21
|
it 'should not equal' do
|
18
|
-
@a.should
|
22
|
+
@a.should != @b
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'should include variables' do
|
26
|
+
PioneString.new("{$var1}").should.include_variable
|
27
|
+
PioneString.new("<? $var1 ?>").should.include_variable
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'should not include variables' do
|
31
|
+
PioneString.new("$var1").should.not.include_variable
|
32
|
+
PioneString.new("<? 1 ?>").should.not.include_variable
|
19
33
|
end
|
20
34
|
|
21
35
|
it 'should expand variables' do
|
22
|
-
vtable
|
23
|
-
Variable.new("var1") => PioneString.new("a").to_seq,
|
24
|
-
Variable.new("var2") => PioneString.new("b").to_seq
|
25
|
-
})
|
26
|
-
PioneString.new("{$var1}:{$var2}").eval(vtable).should ==
|
27
|
-
PioneString.new("a:b")
|
36
|
+
PioneString.new("{$var1}:{$var2}").eval(@vtable).should == PioneString.new("a:b")
|
28
37
|
end
|
29
38
|
|
30
39
|
it 'should expand an expression' do
|
31
|
-
|
32
|
-
PioneString.new("1 + 1 = <?1 + 1?>").eval(vtable).should ==
|
40
|
+
PioneString.new("1 + 1 = <?1 + 1?>").eval(@vtable).should ==
|
33
41
|
PioneString.new("1 + 1 = 2")
|
34
|
-
PioneString.new("1 + 2 = <? 1 + 2 ?>").eval(vtable).should ==
|
42
|
+
PioneString.new("1 + 2 = <? 1 + 2 ?>").eval(@vtable).should ==
|
35
43
|
PioneString.new("1 + 2 = 3")
|
36
44
|
end
|
37
45
|
|
data/test/model/spec_string.yml
CHANGED
@@ -61,8 +61,16 @@
|
|
61
61
|
- '"a" | "ab" | "abc" | "b" | "bc" | "bc" | "c" | "c" | "c"' : '"abc".substring(1 | 2 | 3, 1 | 2 | 3)'
|
62
62
|
|
63
63
|
# []
|
64
|
-
-
|
65
|
-
-
|
64
|
+
- '"abc"' : '"abc".nth(1)'
|
65
|
+
- '"a"' : '("a" | "b" | "c").nth(1)'
|
66
|
+
- '"b"' : '("a" | "b" | "c").nth(2)'
|
67
|
+
- '"c"' : '("a" | "b" | "c").nth(3)'
|
68
|
+
|
69
|
+
# []
|
70
|
+
- '"abc"' : '"abc"[1]'
|
71
|
+
- '"a"' : '("a" | "b" | "c")[1]'
|
72
|
+
- '"b"' : '("a" | "b" | "c")[2]'
|
73
|
+
- '"c"' : '("a" | "b" | "c")[3]'
|
66
74
|
|
67
75
|
# as_integer, i
|
68
76
|
- "1" : '"1".as_integer'
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require_relative '../test-util'
|
2
2
|
|
3
3
|
describe 'Model::TicketExpr' do
|
4
|
-
it 'should equal
|
4
|
+
it 'should equal' do
|
5
5
|
TicketExpr.new("T").should == TicketExpr.new("T")
|
6
6
|
end
|
7
7
|
|
@@ -9,9 +9,31 @@ describe 'Model::TicketExpr' do
|
|
9
9
|
TicketExpr.new("T").should.not == TicketExpr.new("t")
|
10
10
|
end
|
11
11
|
|
12
|
-
it 'should get
|
12
|
+
it 'should get name' do
|
13
13
|
TicketExpr.new("T").name.should == "T"
|
14
14
|
end
|
15
|
+
end
|
16
|
+
|
17
|
+
describe "Pione::Model::TicketExprSequence" do
|
18
|
+
before do
|
19
|
+
@x = TicketExpr.new("X")
|
20
|
+
@y = TicketExpr.new("Y")
|
21
|
+
@seq = TicketExprSequence.new([@x, @y])
|
22
|
+
end
|
23
|
+
|
24
|
+
it "should equal" do
|
25
|
+
@seq.should == TicketExprSequence.new([@x, @y])
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should not equal" do
|
29
|
+
@seq.should != TicketExprSequence.new([@y, @x])
|
30
|
+
end
|
31
|
+
|
32
|
+
it "should get ticket names" do
|
33
|
+
@seq.names.should.include("X")
|
34
|
+
@seq.names.should.include("Y")
|
35
|
+
@seq.names.should.not.include("Z")
|
36
|
+
end
|
15
37
|
|
16
|
-
test_pione_method
|
38
|
+
test_pione_method "ticket-expr"
|
17
39
|
end
|