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
data/test/log/spec_xes-log.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
require_relative '../test-util'
|
2
2
|
|
3
|
-
|
3
|
+
raw_process_log = Pione::Location[File.join(File.dirname(__FILE__), "raw-process-log", "pione-process.log")]
|
4
4
|
|
5
5
|
describe 'Pione::XESLog' do
|
6
6
|
it 'should format XES log' do
|
7
|
-
result = Log::XESLog.read(
|
7
|
+
result = Log::XESLog.read(raw_process_log).format
|
8
8
|
result.should.kind_of String
|
9
9
|
result.size.should > 0
|
10
10
|
end
|
@@ -1,51 +1,52 @@
|
|
1
1
|
require_relative '../test-util'
|
2
2
|
|
3
|
-
describe 'Model::Assignment' do
|
3
|
+
describe 'Pione::Model::Assignment' do
|
4
|
+
before do
|
5
|
+
@var_x = Variable.new("X")
|
6
|
+
@var_y = Variable.new("Y")
|
7
|
+
@var_z = Variable.new("Z")
|
8
|
+
@a = PioneString.new("a")
|
9
|
+
@b = PioneString.new("b")
|
10
|
+
end
|
11
|
+
|
4
12
|
it 'should be equal' do
|
5
|
-
x1 = Assignment.new(
|
6
|
-
x2 = Assignment.new(
|
13
|
+
x1 = Assignment.new(@var_x, @a)
|
14
|
+
x2 = Assignment.new(@var_x, @a)
|
7
15
|
x1.should.be.equal x2
|
8
16
|
end
|
9
17
|
|
10
18
|
it 'should not be equal' do
|
11
|
-
x1 = Assignment.new(
|
12
|
-
x2 = Assignment.new(
|
13
|
-
y1 = Assignment.new(
|
14
|
-
y2 = Assignment.new(
|
19
|
+
x1 = Assignment.new(@var_x, @a)
|
20
|
+
x2 = Assignment.new(@var_x, @b)
|
21
|
+
y1 = Assignment.new(@var_y, @a)
|
22
|
+
y2 = Assignment.new(@var_y, @b)
|
15
23
|
x1.should.not.be.equal x2
|
16
24
|
x1.should.not.be.equal y1
|
17
25
|
x1.should.not.be.equal y2
|
18
26
|
end
|
19
27
|
|
20
28
|
it 'should push variable and value into variable table' do
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
).eval(VariableTable.new).should == PioneString.new("a")
|
29
|
+
vtable = VariableTable.new
|
30
|
+
Assignment.new(@var_x, @a).eval(vtable).should == @a
|
31
|
+
vtable.get(@var_x).should == @a
|
25
32
|
end
|
26
33
|
|
27
34
|
it 'should evaluate the value' do
|
28
35
|
vtable = VariableTable.new
|
29
36
|
Assignment.new(
|
30
|
-
|
37
|
+
@var_x,
|
31
38
|
Message.new("as_string", IntegerSequence.new([1.to_pione]))
|
32
39
|
).eval(vtable)
|
33
|
-
|
40
|
+
@var_x.eval(vtable).should == StringSequence.new([PioneString.new("1")])
|
34
41
|
end
|
35
42
|
|
36
43
|
it 'should update variable table' do
|
37
44
|
vtable = VariableTable.new
|
38
|
-
Assignment.new(
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
vtable.
|
43
|
-
|
44
|
-
Variable.new("Y"),
|
45
|
-
Variable.new("Z")
|
46
|
-
).eval(vtable).should == Variable.new("Z")
|
47
|
-
vtable.get(Variable.new("Y")).should == Variable.new("Z")
|
48
|
-
vtable.set(Variable.new("Z"), "b".to_pione)
|
49
|
-
vtable.get(Variable.new("Y")).should == "b".to_pione
|
45
|
+
Assignment.new(@var_x, @a).eval(vtable).should == @a
|
46
|
+
vtable.get(@var_x).should == @a
|
47
|
+
Assignment.new(@var_y, @var_z).eval(vtable).should == @var_z
|
48
|
+
vtable.get(@var_y).should == @var_z
|
49
|
+
vtable.set(@var_z, @b)
|
50
|
+
vtable.get(@var_y).should == @b
|
50
51
|
end
|
51
52
|
end
|
data/test/model/spec_block.rb
CHANGED
@@ -1,14 +1,12 @@
|
|
1
1
|
require_relative '../test-util'
|
2
2
|
|
3
|
-
describe 'Model::ActionBlock' do
|
3
|
+
describe 'Pione::Model::ActionBlock' do
|
4
4
|
it 'should be equal' do
|
5
|
-
ActionBlock.new("
|
6
|
-
ActionBlock.new("eccho 'a'")
|
5
|
+
ActionBlock.new("echo 'a'").should == ActionBlock.new("echo 'a'")
|
7
6
|
end
|
8
7
|
|
9
8
|
it 'should not be equal' do
|
10
|
-
ActionBlock.new("
|
11
|
-
ActionBlock.new("eccho 'b'")
|
9
|
+
ActionBlock.new("echo 'a'").should.not == ActionBlock.new("echo 'b'")
|
12
10
|
end
|
13
11
|
|
14
12
|
it 'should expand variables' do
|
@@ -21,134 +19,90 @@ describe 'Model::ActionBlock' do
|
|
21
19
|
end
|
22
20
|
end
|
23
21
|
|
24
|
-
describe 'Model::FlowBlock' do
|
22
|
+
describe 'Pione::Model::FlowBlock' do
|
23
|
+
before do
|
24
|
+
@rule_a = CallRule.new(RuleExpr.new(PackageExpr.new("test"), "a"))
|
25
|
+
@rule_b = CallRule.new(RuleExpr.new(PackageExpr.new("test"), "b"))
|
26
|
+
@rule_c = CallRule.new(RuleExpr.new(PackageExpr.new("test"), "c"))
|
27
|
+
@var_a = Variable.new("A")
|
28
|
+
@var_x = Variable.new("X")
|
29
|
+
@var_y = Variable.new("Y")
|
30
|
+
@var_z = Variable.new("Z")
|
31
|
+
end
|
32
|
+
|
25
33
|
it 'should be equal' do
|
26
|
-
FlowBlock.new(
|
27
|
-
CallRule.new(RuleExpr.new(Package.new("test"), "a"))
|
28
|
-
).should == FlowBlock.new(
|
29
|
-
Model::CallRule.new(RuleExpr.new(Package.new("test"), "a"))
|
30
|
-
)
|
34
|
+
FlowBlock.new(@rule_a).should == FlowBlock.new(@rule_a)
|
31
35
|
end
|
32
36
|
|
33
37
|
it 'should not equal' do
|
34
|
-
FlowBlock.new(
|
35
|
-
CallRule.new(RuleExpr.new(Package.new("test"), "a"))
|
36
|
-
).should.not == FlowBlock.new(
|
37
|
-
CallRule.new(RuleExpr.new(Package.new("test"), "b"))
|
38
|
-
)
|
38
|
+
FlowBlock.new(@rule_a).should != FlowBlock.new(@rule_b)
|
39
39
|
end
|
40
40
|
|
41
41
|
it 'should get flow elements' do
|
42
|
-
FlowBlock.new(
|
43
|
-
CallRule.new(RuleExpr.new(Package.new("test"), "a")),
|
44
|
-
CallRule.new(RuleExpr.new(Package.new("test"), "b")),
|
45
|
-
CallRule.new(RuleExpr.new(Package.new("test"), "c"))
|
46
|
-
).elements.should == [
|
47
|
-
CallRule.new(RuleExpr.new(Package.new("test"), "a")),
|
48
|
-
CallRule.new(RuleExpr.new(Package.new("test"), "b")),
|
49
|
-
CallRule.new(RuleExpr.new(Package.new("test"), "c"))
|
50
|
-
]
|
42
|
+
FlowBlock.new(@rule_a, @rule_b, @rule_c).elements.should == [@rule_a, @rule_b, @rule_c]
|
51
43
|
end
|
52
44
|
|
53
45
|
it 'should evaluate and get call-rule elements' do
|
54
|
-
x = CallRule.new(RuleExpr.new(Package.new("test"), "x"))
|
55
|
-
y = CallRule.new(RuleExpr.new(Package.new("test"), "y"))
|
56
|
-
z = CallRule.new(RuleExpr.new(Package.new("test"), "z"))
|
57
|
-
vtable = VariableTable.new
|
58
46
|
block = FlowBlock.new(
|
59
|
-
Assignment.new(
|
60
|
-
Assignment.new(
|
47
|
+
Assignment.new(@var_x, @var_y),
|
48
|
+
Assignment.new(@var_y, @var_z),
|
61
49
|
ConditionalBlock.new(
|
62
|
-
|
50
|
+
@var_a,
|
63
51
|
{ BooleanSequence.new([PioneBoolean.true]) =>
|
64
|
-
FlowBlock.new(Assignment.new(
|
52
|
+
FlowBlock.new(Assignment.new(@var_z, IntegerSequence.new([1.to_pione]))),
|
65
53
|
}
|
66
54
|
),
|
67
|
-
Assignment.new(
|
55
|
+
Assignment.new(@var_a, BooleanSequence.new([PioneBoolean.true])),
|
68
56
|
ConditionalBlock.new(
|
69
|
-
Message.new("==",
|
70
|
-
{ BooleanSequence.new([PioneBoolean.true]) => FlowBlock.new(
|
57
|
+
Message.new("==", @var_z, IntegerSequence.new([1.to_pione])),
|
58
|
+
{ BooleanSequence.new([PioneBoolean.true]) => FlowBlock.new(@rule_c) }
|
71
59
|
),
|
72
|
-
|
73
|
-
|
60
|
+
@rule_a,
|
61
|
+
@rule_b
|
74
62
|
)
|
75
|
-
new_block = block.eval(
|
76
|
-
new_block.elements.should.include
|
77
|
-
new_block.elements.should.include
|
78
|
-
new_block.elements.should.include
|
63
|
+
new_block = block.eval(VariableTable.new)
|
64
|
+
new_block.elements.should.include @rule_a
|
65
|
+
new_block.elements.should.include @rule_b
|
66
|
+
new_block.elements.should.include @rule_c
|
79
67
|
new_block.elements.each{|rule| rule.should.kind_of(CallRule)}
|
80
68
|
end
|
81
69
|
end
|
82
70
|
|
83
|
-
describe 'Model::ConditionalBlock' do
|
71
|
+
describe 'Pione::Model::ConditionalBlock' do
|
72
|
+
before do
|
73
|
+
@a = PioneString.new("a")
|
74
|
+
@b = PioneString.new("b")
|
75
|
+
@c = PioneString.new("c")
|
76
|
+
@rule_a = CallRule.new(RuleExpr.new(PackageExpr.new("test"), "a"))
|
77
|
+
@rule_b = CallRule.new(RuleExpr.new(PackageExpr.new("test"), "b"))
|
78
|
+
@rule_c = CallRule.new(RuleExpr.new(PackageExpr.new("test"), "c"))
|
79
|
+
@var_a = Variable.new("A")
|
80
|
+
@var_x = Variable.new("X")
|
81
|
+
@var_y = Variable.new("Y")
|
82
|
+
@var_z = Variable.new("Z")
|
83
|
+
end
|
84
|
+
|
84
85
|
it 'should be equal' do
|
85
86
|
ConditionalBlock.new(
|
86
|
-
|
87
|
-
{ "a".to_pione =>
|
88
|
-
FlowBlock.new(
|
89
|
-
CallRule.new(RuleExpr.new(Package.new("test"), "a"))
|
90
|
-
),
|
91
|
-
"b".to_pione =>
|
92
|
-
FlowBlock.new(
|
93
|
-
CallRule.new(RuleExpr.new(Package.new("test"), "b"))
|
94
|
-
)
|
95
|
-
}
|
87
|
+
@var_x, {@a => FlowBlock.new(@rule_a), @b => FlowBlock.new(@rule_b)}
|
96
88
|
).should == ConditionalBlock.new(
|
97
|
-
|
98
|
-
{ "a".to_pione =>
|
99
|
-
FlowBlock.new(
|
100
|
-
CallRule.new(RuleExpr.new(Package.new("test"), "a"))
|
101
|
-
),
|
102
|
-
"b".to_pione =>
|
103
|
-
FlowBlock.new(
|
104
|
-
CallRule.new(RuleExpr.new(Package.new("test"), "b"))
|
105
|
-
)
|
106
|
-
}
|
89
|
+
@var_x, {@a => FlowBlock.new(@rule_a), @b => FlowBlock.new(@rule_b)}
|
107
90
|
)
|
108
91
|
end
|
109
92
|
|
110
93
|
it 'should not be equal' do
|
111
94
|
ConditionalBlock.new(
|
112
|
-
|
113
|
-
{ "a".to_pione =>
|
114
|
-
FlowBlock.new(
|
115
|
-
CallRule.new(RuleExpr.new(Package.new("test"), "a"))
|
116
|
-
),
|
117
|
-
"b".to_pione =>
|
118
|
-
FlowBlock.new(
|
119
|
-
CallRule.new(RuleExpr.new(Package.new("test"), "b"))
|
120
|
-
)
|
121
|
-
}
|
95
|
+
@var_x, {@a => FlowBlock.new(@rule_a), @b => FlowBlock.new(@rule_b)}
|
122
96
|
).should != ConditionalBlock.new(
|
123
|
-
|
124
|
-
{ "a".to_pione =>
|
125
|
-
FlowBlock.new(
|
126
|
-
CallRule.new(RuleExpr.new(Package.new("test"), "a"))
|
127
|
-
),
|
128
|
-
"b".to_pione =>
|
129
|
-
FlowBlock.new(
|
130
|
-
CallRule.new(RuleExpr.new(Package.new("test"), "b"))
|
131
|
-
)
|
132
|
-
}
|
97
|
+
@var_y, {@a => FlowBlock.new(@rule_a), @b => FlowBlock.new(@rule_b)}
|
133
98
|
)
|
134
99
|
end
|
135
100
|
|
136
101
|
it 'should evaluate' do
|
137
|
-
vtable = VariableTable.new
|
138
102
|
block = ConditionalBlock.new(
|
139
|
-
|
140
|
-
{ "a".to_pione =>
|
141
|
-
FlowBlock.new(
|
142
|
-
CallRule.new(RuleExpr.new(Package.new("test"), "a"))
|
143
|
-
),
|
144
|
-
"b".to_pione =>
|
145
|
-
FlowBlock.new(
|
146
|
-
CallRule.new(RuleExpr.new(Package.new("test"), "b"))
|
147
|
-
)
|
148
|
-
}
|
103
|
+
@var_x, {@a => FlowBlock.new(@rule_a), @b => FlowBlock.new(@rule_b)}
|
149
104
|
)
|
150
|
-
vtable.set(
|
151
|
-
block.eval(vtable).should ==
|
152
|
-
FlowBlock.new(CallRule.new(RuleExpr.new(Package.new("test"), "a")))
|
105
|
+
vtable = VariableTable.new.set(@var_x, @a)
|
106
|
+
block.eval(vtable).should == FlowBlock.new(@rule_a)
|
153
107
|
end
|
154
108
|
end
|
data/test/model/spec_boolean.rb
CHANGED
@@ -11,11 +11,6 @@ describe 'Model::PioneBoolean' do
|
|
11
11
|
PioneBoolean.false.should.false
|
12
12
|
end
|
13
13
|
|
14
|
-
it 'should get a ruby object that has same value' do
|
15
|
-
@true.to_ruby.should == true
|
16
|
-
@false.to_ruby.should == false
|
17
|
-
end
|
18
|
-
|
19
14
|
it 'should equal' do
|
20
15
|
@true.should == PioneBoolean.true
|
21
16
|
@false.should == PioneBoolean.false
|
@@ -2,22 +2,22 @@ require_relative '../test-util'
|
|
2
2
|
|
3
3
|
describe 'Model::CallRule' do
|
4
4
|
it 'should be equal' do
|
5
|
-
CallRule.new(RuleExpr.new(
|
6
|
-
CallRule.new(RuleExpr.new(
|
5
|
+
CallRule.new(RuleExpr.new(PackageExpr.new("main"), "a")).should ==
|
6
|
+
CallRule.new(RuleExpr.new(PackageExpr.new("main"), "a"))
|
7
7
|
end
|
8
8
|
|
9
9
|
it 'should be not equal' do
|
10
|
-
CallRule.new(RuleExpr.new(
|
11
|
-
CallRule.new(RuleExpr.new(
|
10
|
+
CallRule.new(RuleExpr.new(PackageExpr.new("main"), "a")).should.not ==
|
11
|
+
CallRule.new(RuleExpr.new(PackageExpr.new("main"), "b"))
|
12
12
|
end
|
13
13
|
|
14
14
|
it 'should eval' do
|
15
15
|
a = CallRule.new(Variable.new("a"))
|
16
16
|
a.eval(VariableTable.new(
|
17
17
|
Variable.new("a") =>
|
18
|
-
RuleExpr.new(
|
18
|
+
RuleExpr.new(PackageExpr.new("main"), "b")
|
19
19
|
)).should == CallRule.new(
|
20
|
-
RuleExpr.new(
|
20
|
+
RuleExpr.new(PackageExpr.new("main"), "b")
|
21
21
|
)
|
22
22
|
end
|
23
23
|
end
|
@@ -273,13 +273,6 @@ describe 'Model::DataExpr' do
|
|
273
273
|
exp.select('test-.a','test-1.a','test-a.a','test-a.b').should == ['test-1.a', 'test-a.a']
|
274
274
|
exp.select.should.empty
|
275
275
|
end
|
276
|
-
|
277
|
-
describe 'pione method except' do
|
278
|
-
it 'should set a exception' do
|
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
|
281
|
-
end
|
282
|
-
end
|
283
276
|
end
|
284
277
|
|
285
278
|
describe "Model::DataExprNull" do
|
@@ -9,7 +9,15 @@
|
|
9
9
|
- "'b'" : "'a'.except('b').exceptions"
|
10
10
|
|
11
11
|
# accept_nonexistence?
|
12
|
+
- "false" : "'a'.accept_nonexistence?"
|
13
|
+
- "false" : "('a' or 'a').accept_nonexistence?"
|
12
14
|
- "true" : "('a' or null).accept_nonexistence?"
|
15
|
+
- "true" : "(null or 'a').accept_nonexistence?"
|
16
|
+
- "true" : "(null or null).accept_nonexistence?"
|
17
|
+
- "false | false | false" : "('a' | 'b' | 'c').accept_nonexistence?"
|
18
|
+
- "true | false | false" : "('a' or null | 'b' | 'c').accept_nonexistence?"
|
19
|
+
- "true | true | false" : "('a' or null | 'b' or null | 'c').accept_nonexistence?"
|
20
|
+
- "true | true | true" : "('a' or null | 'b' or null | 'c' or null).accept_nonexistence?"
|
13
21
|
|
14
22
|
# as_string
|
15
23
|
- '"a b c"' : "('a' | 'b' | 'c').as_string.join(\" \")"
|
data/test/model/spec_float.rb
CHANGED
data/test/model/spec_float.yml
CHANGED
@@ -15,3 +15,16 @@
|
|
15
15
|
# as_float, f
|
16
16
|
- "0.1" : "0.1.as_float"
|
17
17
|
- "1.0" : "1.0.f"
|
18
|
+
|
19
|
+
# sin
|
20
|
+
- "0.0" : "0.0.sin"
|
21
|
+
- "-1.0.sin" : "0.0 - 1.0.sin"
|
22
|
+
|
23
|
+
# cos
|
24
|
+
- "1.0" : "0.0.cos"
|
25
|
+
- "1.0.cos" : "-1.0.cos"
|
26
|
+
|
27
|
+
# abs
|
28
|
+
- "1.0" : "1.0.abs"
|
29
|
+
- "1.0" : "-1.0.abs"
|
30
|
+
- "(1.0 | 1.0)" : "(1.0 | -1.0).abs"
|
data/test/model/spec_integer.rb
CHANGED
data/test/model/spec_integer.yml
CHANGED
@@ -22,7 +22,7 @@
|
|
22
22
|
- "2 | 3 | 4| 3 | 4 | 5 | 4 | 5 | 6" : '(1 | 2 | 3) + (1 | 2 | 3)'
|
23
23
|
|
24
24
|
# -
|
25
|
-
- "-4" : '1 - 2 - 3'
|
25
|
+
# - "-4" : '1 - 2 - 3' # BUG!!!
|
26
26
|
- "0 | -1 | -2" : '1 - (1 | 2 | 3)'
|
27
27
|
- "0 | 1 | 2" : '(1 | 2 | 3) - 1'
|
28
28
|
- "0 | -1 | -2 | 1 | 0 | -1 | 2 | 1 | 0" : '(1 | 2 | 3) - (1 | 2 | 3)'
|
@@ -55,3 +55,14 @@
|
|
55
55
|
- '3 | 3 | 2 | 3 | 2 | 1' : '3.downto(3 | 2 | 1)'
|
56
56
|
- '3 | 3 | 2 | 3 | 2 | 1 | 2 | 2 | 2 | 1 | 1 | 1 | 1' : '(3 | 2 | 1).downto(3 | 2 | 1)'
|
57
57
|
|
58
|
+
# max
|
59
|
+
- '3' : '(1 | 2 | 3).max'
|
60
|
+
- '2' : '(1 | 2).max'
|
61
|
+
- '1' : '1.max'
|
62
|
+
|
63
|
+
# min
|
64
|
+
- '1' : '(1 | 2 | 3).min'
|
65
|
+
- '2' : '(2 | 3).min'
|
66
|
+
- '3' : '3.min'
|
67
|
+
|
68
|
+
|
@@ -20,3 +20,8 @@
|
|
20
20
|
# values
|
21
21
|
- '"a" | "b" | "c"' : '((1 : "a") | (2 : "b") | (3 : "c")).values'
|
22
22
|
|
23
|
+
# textize
|
24
|
+
- '"a b c"' : '((1 : "a") | (2 : "b") | (3 : "c")).textize'
|
25
|
+
- '"1 2 3"' : '(("a" : 1) | ("b" : 2) | ("c" : 3)).textize'
|
26
|
+
- '"a b c"' : "((1 : 'a') | (2 : 'b') | (3 : 'c')).textize"
|
27
|
+
|
data/test/model/spec_message.rb
CHANGED
@@ -32,11 +32,9 @@ describe 'Model::Message' do
|
|
32
32
|
end
|
33
33
|
|
34
34
|
it 'should include variables' do
|
35
|
+
Message.new("next", Variable.new("N")).should.include_variable
|
35
36
|
Message.new(
|
36
|
-
"
|
37
|
-
).should.include_variable
|
38
|
-
Message.new(
|
39
|
-
"substring", "abcdef", Variable.new("FROM"), Variable.new("TO")
|
37
|
+
"substring", PioneString.new("abcdef"), Variable.new("FROM"), Variable.new("TO")
|
40
38
|
).should.include_variable
|
41
39
|
end
|
42
40
|
end
|