pione 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +14 -0
- data/Gemfile +5 -0
- data/LICENSE.txt +22 -0
- data/README.md +94 -0
- data/Rakefile +118 -0
- data/bin/pione-broker +5 -0
- data/bin/pione-clean +5 -0
- data/bin/pione-client +5 -0
- data/bin/pione-eval +111 -0
- data/bin/pione-relay +5 -0
- data/bin/pione-relay-account-db +5 -0
- data/bin/pione-relay-client-db +5 -0
- data/bin/pione-search-log +30 -0
- data/bin/pione-syntax-checker +5 -0
- data/bin/pione-task-worker +5 -0
- data/bin/pione-tuple-space-provider +5 -0
- data/bin/pione-tuple-space-receiver +5 -0
- data/bin/pione-tuple-space-viewer +5 -0
- data/demo/demo.rb +311 -0
- data/demo/public/base.css +94 -0
- data/demo/public/demo.js +107 -0
- data/demo/public/index.html +91 -0
- data/demo/public/jquery-1.8.3.min.js +2 -0
- data/example/CountChar/CountChar.pione +64 -0
- data/example/CountChar/misc/CountChar.rb +22 -0
- data/example/CountChar/text/aidokushono_insho.txt +32 -0
- data/example/CountChar/text/aikokuka_shokan.txt +108 -0
- data/example/CountChar/text/carlyle_hakubutsukan.txt +58 -0
- data/example/CountChar/text/dark_minister.txt +2440 -0
- data/example/CountChar/text/kaikano_otto.txt +61 -0
- data/example/CountChar/text/kaikon.txt +30 -0
- data/example/CountChar/text/nagashimano_shi.txt +45 -0
- data/example/CountChar/text/saikachibuchi.txt +80 -0
- data/example/CountChar/text/saikonihonno_josei.txt +91 -0
- data/example/CountChar/text/taishojugonenno_bundan.txt +21 -0
- data/example/FeatureExample/FeatureExample.pione +7 -0
- data/example/Fib/Fib.pione +56 -0
- data/example/Fib/FibBC.pione +56 -0
- data/example/HelloWorld/HelloWorld.pione +5 -0
- data/example/LucasNumber/LucasNumber.pione +64 -0
- data/example/MakePair/MakePair.pione +14 -0
- data/example/MakePair/data/1.i +0 -0
- data/example/MakePair/data/2.i +0 -0
- data/example/MakePair/data/3.i +0 -0
- data/example/MakePair/data/4.i +0 -0
- data/example/MakePair/data/5.i +0 -0
- data/example/SieveOfEratosthenes/SieveOfEratosthenes.pione +61 -0
- data/example/SingleParticlesWithRef/Makefile +289 -0
- data/example/SingleParticlesWithRef/SingleParticlesWithRef.Makefile +153 -0
- data/example/SingleParticlesWithRef/SingleParticlesWithRef.pione +116 -0
- data/example/SingleParticlesWithRef/SingleParticlesWithRefFull.pione +400 -0
- data/example/SingleParticlesWithRef/data/121p-shift-0-0-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-0-120-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-0-180-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-0-240-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-0-300-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-0-60-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-120-0-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-120-120-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-120-180-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-120-240-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-120-300-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-120-60-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-180-0-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-180-120-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-180-180-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-180-240-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-180-300-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-180-60-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-240-0-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-240-120-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-240-180-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-240-240-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-240-300-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-240-60-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-300-0-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-300-120-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-300-180-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-300-240-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-300-300-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-300-60-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-60-0-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-60-120-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-60-180-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-60-240-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-60-300-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-60-60-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-0-0-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-0-120-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-0-180-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-0-240-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-0-300-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-0-60-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-120-0-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-120-120-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-120-180-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-120-240-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-120-300-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-120-60-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-180-0-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-180-120-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-180-180-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-180-240-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-180-300-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-180-60-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-240-0-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-240-120-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-240-180-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-240-240-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-240-300-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-240-60-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-300-0-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-300-120-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-300-180-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-300-240-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-300-300-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-300-60-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-60-0-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-60-120-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-60-180-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-60-240-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-60-300-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-60-60-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift.pdb +3381 -0
- data/example/SingleParticlesWithRef/data/all.ref2d +0 -0
- data/example/SingleParticlesWithRef/data/all.ref3d +0 -0
- data/example/Sum/Sum.pione +52 -0
- data/example/SyntaxError/call_rule_error.pione +6 -0
- data/example/SyntaxError/feature_line_error.pione +7 -0
- data/example/SyntaxError/flow_block_error.pione +5 -0
- data/example/SyntaxError/input_line_error.pione +6 -0
- data/example/SyntaxError/invalid_rule_name.pione +6 -0
- data/example/SyntaxError/param_line_error.pione +7 -0
- data/example/SyntaxError/variable-binding-error.pione +11 -0
- data/lib/pione.rb +241 -0
- data/lib/pione/agent/basic-agent.rb +333 -0
- data/lib/pione/agent/broker.rb +274 -0
- data/lib/pione/agent/command-listener.rb +47 -0
- data/lib/pione/agent/input-generator.rb +194 -0
- data/lib/pione/agent/logger.rb +65 -0
- data/lib/pione/agent/process-manager.rb +38 -0
- data/lib/pione/agent/rule-provider.rb +64 -0
- data/lib/pione/agent/task-worker.rb +274 -0
- data/lib/pione/agent/trivial-routine-worker.rb +28 -0
- data/lib/pione/agent/tuple-space-client.rb +146 -0
- data/lib/pione/agent/tuple-space-server-client-life-checker.rb +29 -0
- data/lib/pione/command-option/basic-option.rb +42 -0
- data/lib/pione/command-option/child-process-option.rb +17 -0
- data/lib/pione/command-option/common-option.rb +29 -0
- data/lib/pione/command-option/daemon-option.rb +12 -0
- data/lib/pione/command-option/presence-notifier-option.rb +15 -0
- data/lib/pione/command-option/task-worker-owner-option.rb +17 -0
- data/lib/pione/command-option/tuple-space-provider-option.rb +26 -0
- data/lib/pione/command-option/tuple-space-provider-owner-option.rb +16 -0
- data/lib/pione/command-option/tuple-space-receiver-option.rb +12 -0
- data/lib/pione/command/basic-command.rb +126 -0
- data/lib/pione/command/child-process.rb +43 -0
- data/lib/pione/command/daemon-process.rb +18 -0
- data/lib/pione/command/front-owner-command.rb +37 -0
- data/lib/pione/command/pione-broker.rb +53 -0
- data/lib/pione/command/pione-clean.rb +16 -0
- data/lib/pione/command/pione-client.rb +273 -0
- data/lib/pione/command/pione-relay-account-db.rb +85 -0
- data/lib/pione/command/pione-relay-client-db.rb +80 -0
- data/lib/pione/command/pione-relay.rb +47 -0
- data/lib/pione/command/pione-syntax-checker.rb +103 -0
- data/lib/pione/command/pione-task-worker.rb +123 -0
- data/lib/pione/command/pione-tuple-space-provider.rb +87 -0
- data/lib/pione/command/pione-tuple-space-receiver.rb +55 -0
- data/lib/pione/command/pione-tuple-space-viewer.rb +151 -0
- data/lib/pione/command/tuple-space-provider-owner.rb +6 -0
- data/lib/pione/front/basic-front.rb +64 -0
- data/lib/pione/front/broker-front.rb +30 -0
- data/lib/pione/front/client-front.rb +28 -0
- data/lib/pione/front/relay-front.rb +19 -0
- data/lib/pione/front/task-worker-front.rb +16 -0
- data/lib/pione/front/task-worker-owner.rb +42 -0
- data/lib/pione/front/tuple-space-provider-front.rb +22 -0
- data/lib/pione/front/tuple-space-provider-owner.rb +11 -0
- data/lib/pione/front/tuple-space-receiver-front.rb +18 -0
- data/lib/pione/model/assignment.rb +89 -0
- data/lib/pione/model/basic-model.rb +395 -0
- data/lib/pione/model/binary-operator.rb +80 -0
- data/lib/pione/model/block.rb +233 -0
- data/lib/pione/model/boolean.rb +138 -0
- data/lib/pione/model/call-rule.rb +69 -0
- data/lib/pione/model/data-expr.rb +360 -0
- data/lib/pione/model/feature-expr.rb +794 -0
- data/lib/pione/model/float.rb +107 -0
- data/lib/pione/model/integer.rb +140 -0
- data/lib/pione/model/list.rb +104 -0
- data/lib/pione/model/message.rb +80 -0
- data/lib/pione/model/package.rb +48 -0
- data/lib/pione/model/parameters.rb +282 -0
- data/lib/pione/model/rule-expr.rb +120 -0
- data/lib/pione/model/rule-io.rb +166 -0
- data/lib/pione/model/rule.rb +294 -0
- data/lib/pione/model/string.rb +111 -0
- data/lib/pione/model/undefined-value.rb +24 -0
- data/lib/pione/model/variable-table.rb +315 -0
- data/lib/pione/model/variable.rb +87 -0
- data/lib/pione/parser/block-parser.rb +83 -0
- data/lib/pione/parser/common-parser.rb +145 -0
- data/lib/pione/parser/document-parser.rb +58 -0
- data/lib/pione/parser/error-message.yml +4 -0
- data/lib/pione/parser/expr-parser.rb +266 -0
- data/lib/pione/parser/feature-expr-parser.rb +105 -0
- data/lib/pione/parser/flow-element-parser.rb +181 -0
- data/lib/pione/parser/literal-parser.rb +182 -0
- data/lib/pione/parser/rule-definition-parser.rb +163 -0
- data/lib/pione/parser/syntax-error.rb +61 -0
- data/lib/pione/patch/array-patch.rb +3 -0
- data/lib/pione/patch/drb-patch.rb +467 -0
- data/lib/pione/patch/monitor-patch.rb +16 -0
- data/lib/pione/patch/rinda-patch.rb +759 -0
- data/lib/pione/patch/uri-patch.rb +66 -0
- data/lib/pione/relay/receiver-socket.rb +69 -0
- data/lib/pione/relay/relay-account-db.rb +55 -0
- data/lib/pione/relay/relay-client-db.rb +53 -0
- data/lib/pione/relay/relay-socket.rb +215 -0
- data/lib/pione/relay/trampoline.rb +22 -0
- data/lib/pione/relay/transmitter-socket.rb +167 -0
- data/lib/pione/resource/basic-resource.rb +92 -0
- data/lib/pione/resource/dropbox-resource.rb +106 -0
- data/lib/pione/resource/ftp.rb +84 -0
- data/lib/pione/resource/local.rb +113 -0
- data/lib/pione/rule-handler/action-handler.rb +184 -0
- data/lib/pione/rule-handler/basic-handler.rb +217 -0
- data/lib/pione/rule-handler/flow-handler.rb +339 -0
- data/lib/pione/rule-handler/root-handler.rb +23 -0
- data/lib/pione/rule-handler/system-handler.rb +13 -0
- data/lib/pione/system/common.rb +22 -0
- data/lib/pione/system/config.rb +20 -0
- data/lib/pione/system/document.rb +81 -0
- data/lib/pione/system/file-cache.rb +150 -0
- data/lib/pione/system/global.rb +346 -0
- data/lib/pione/system/identifier.rb +61 -0
- data/lib/pione/system/init.rb +16 -0
- data/lib/pione/system/object.rb +35 -0
- data/lib/pione/transformer/block-transformer.rb +23 -0
- data/lib/pione/transformer/document-transformer.rb +36 -0
- data/lib/pione/transformer/expr-transformer.rb +89 -0
- data/lib/pione/transformer/feature-expr-transformer.rb +56 -0
- data/lib/pione/transformer/flow-element-transformer.rb +66 -0
- data/lib/pione/transformer/literal-transformer.rb +76 -0
- data/lib/pione/transformer/rule-definition-transformer.rb +62 -0
- data/lib/pione/transformer/transformer-module.rb +37 -0
- data/lib/pione/tuple-space/data-finder.rb +165 -0
- data/lib/pione/tuple-space/presence-notifier.rb +83 -0
- data/lib/pione/tuple-space/relay.rb +9 -0
- data/lib/pione/tuple-space/tuple-space-provider.rb +85 -0
- data/lib/pione/tuple-space/tuple-space-receiver.rb +140 -0
- data/lib/pione/tuple-space/tuple-space-server-interface.rb +60 -0
- data/lib/pione/tuple-space/tuple-space-server.rb +156 -0
- data/lib/pione/tuple-space/update-criteria.rb +96 -0
- data/lib/pione/tuple/agent-tuple.rb +10 -0
- data/lib/pione/tuple/attribute-tuple.rb +7 -0
- data/lib/pione/tuple/base-uri-tuple.rb +9 -0
- data/lib/pione/tuple/basic-tuple.rb +317 -0
- data/lib/pione/tuple/bye-tuple.rb +9 -0
- data/lib/pione/tuple/command-tuple.rb +9 -0
- data/lib/pione/tuple/data-tuple.rb +18 -0
- data/lib/pione/tuple/dry-run-tuple.rb +8 -0
- data/lib/pione/tuple/exception-tuple.rb +11 -0
- data/lib/pione/tuple/finished-tuple.rb +17 -0
- data/lib/pione/tuple/foreground-tuple.rb +7 -0
- data/lib/pione/tuple/log-tuple.rb +14 -0
- data/lib/pione/tuple/process-info-tuple.rb +9 -0
- data/lib/pione/tuple/request-rule-tuple.rb +9 -0
- data/lib/pione/tuple/rule-tuple.rb +10 -0
- data/lib/pione/tuple/shift-tuple.rb +13 -0
- data/lib/pione/tuple/task-tuple.rb +36 -0
- data/lib/pione/tuple/task-worker-resource-tuple.rb +9 -0
- data/lib/pione/tuple/working-tuple.rb +13 -0
- data/lib/pione/uri-scheme/basic-scheme.rb +40 -0
- data/lib/pione/uri-scheme/broadcast-scheme.rb +11 -0
- data/lib/pione/uri-scheme/dropbox-scheme.rb +9 -0
- data/lib/pione/uri-scheme/local-scheme.rb +28 -0
- data/lib/pione/util/error-report.rb +12 -0
- data/lib/pione/util/log.rb +79 -0
- data/lib/pione/util/message.rb +155 -0
- data/lib/pione/util/misc.rb +73 -0
- data/lib/pione/util/terminal.rb +78 -0
- data/lib/pione/util/waiter-table.rb +53 -0
- data/lib/pione/version.rb +3 -0
- data/misc/env.sh +2 -0
- data/misc/test-drb-stop-service.rb +34 -0
- data/misc/test-ensure-and-thread-kill.rb +40 -0
- data/misc/test-many-waiters-client.rb +56 -0
- data/misc/test-many-waiters-server.rb +14 -0
- data/misc/write_and_take_test.png +0 -0
- data/misc/write_and_take_test.rb +36 -0
- data/pione.gemspec +49 -0
- data/test/agent/spec_basic-agent.rb +170 -0
- data/test/agent/spec_broker.rb +36 -0
- data/test/agent/spec_command-listener.rb +30 -0
- data/test/agent/spec_input-generator.rb +123 -0
- data/test/agent/spec_logger.rb +71 -0
- data/test/agent/spec_rule-provider.rb +65 -0
- data/test/agent/spec_task-worker.rb +307 -0
- data/test/agent/spec_tuple-space-client.rb +30 -0
- data/test/model/spec_assignment.rb +51 -0
- data/test/model/spec_binary-operator.rb +39 -0
- data/test/model/spec_block.rb +154 -0
- data/test/model/spec_boolean.rb +115 -0
- data/test/model/spec_call-rule.rb +23 -0
- data/test/model/spec_data-expr.rb +312 -0
- data/test/model/spec_feature-expr.rb +359 -0
- data/test/model/spec_feature-expr.yml +16 -0
- data/test/model/spec_float.rb +141 -0
- data/test/model/spec_integer.rb +141 -0
- data/test/model/spec_list.rb +26 -0
- data/test/model/spec_message.rb +42 -0
- data/test/model/spec_package.rb +15 -0
- data/test/model/spec_parameters.rb +148 -0
- data/test/model/spec_rule-expr.rb +66 -0
- data/test/model/spec_rule-io.rb +32 -0
- data/test/model/spec_rule.rb +158 -0
- data/test/model/spec_string.rb +106 -0
- data/test/model/spec_variable-table.rb +117 -0
- data/test/model/spec_variable.rb +84 -0
- data/test/parser/spec_block-parser.rb +5 -0
- data/test/parser/spec_block-parser.yml +85 -0
- data/test/parser/spec_common-parser.rb +281 -0
- data/test/parser/spec_expr-parser.rb +6 -0
- data/test/parser/spec_expr-parser.yml +82 -0
- data/test/parser/spec_feature-expr-parser.rb +32 -0
- data/test/parser/spec_feature-expr-parser.yml +25 -0
- data/test/parser/spec_flow-element-parser.rb +5 -0
- data/test/parser/spec_flow-element-parser.yml +180 -0
- data/test/parser/spec_literal-parser.rb +5 -0
- data/test/parser/spec_literal-parser.yml +123 -0
- data/test/parser/spec_rule-definition-parser.rb +5 -0
- data/test/parser/spec_rule-definition-parser.yml +93 -0
- data/test/patch/spec_rinda-patch.rb +32 -0
- data/test/patch/spec_uri-patch.rb +23 -0
- data/test/rule-handler/spec_action-handler.rb +135 -0
- data/test/rule-handler/spec_flow-handler.rb +127 -0
- data/test/spec_common.rb +14 -0
- data/test/spec_data-finder.rb +88 -0
- data/test/spec_data-finder.yml +115 -0
- data/test/spec_document.rb +76 -0
- data/test/spec_identifier.rb +29 -0
- data/test/spec_log.rb +52 -0
- data/test/spec_object.rb +20 -0
- data/test/spec_resource.rb +73 -0
- data/test/spec_update-criteria.rb +83 -0
- data/test/test-util.rb +223 -0
- data/test/transformer/spec_block-transformer.rb +26 -0
- data/test/transformer/spec_expr-transformer.rb +106 -0
- data/test/transformer/spec_feature-expr-transformer.rb +21 -0
- data/test/transformer/spec_flow-element-transformer.rb +154 -0
- data/test/transformer/spec_literal-transformer.rb +58 -0
- data/test/transformer/spec_rule-definition-transformer.rb +168 -0
- data/test/tuple-space/spec_tuple-space-provider.rb +36 -0
- data/test/tuple-space/spec_tuple-space-receiver.rb +32 -0
- data/test/tuple-space/spec_tuple-space-server.rb +49 -0
- data/test/tuple/spec_basic-tuple.rb +87 -0
- data/test/tuple/spec_data-tuple.rb +85 -0
- data/test/tuple/spec_finished-tuple.rb +61 -0
- data/test/tuple/spec_task-tuple.rb +127 -0
- data/test/tuple/spec_working-tuple.rb +58 -0
- data/test/uri-scheme/spec_broadcast-scheme.rb +40 -0
- data/test/uri-scheme/spec_dropbox-scheme.rb +31 -0
- data/test/uri-scheme/spec_local-scheme.rb +69 -0
- metadata +660 -0
@@ -0,0 +1,307 @@
|
|
1
|
+
require_relative '../test-util'
|
2
|
+
|
3
|
+
describe 'Pione::Agent::TaskWorker' do
|
4
|
+
describe 'transition' do
|
5
|
+
before do
|
6
|
+
DRb.start_service
|
7
|
+
create_remote_tuple_space_server
|
8
|
+
features = Feature::AndExpr.new(
|
9
|
+
Feature::PossibleExpr.new('A'),
|
10
|
+
Feature::PossibleExpr.new('B'),
|
11
|
+
Feature::PossibleExpr.new('C')
|
12
|
+
)
|
13
|
+
@worker = Agent::TaskWorker.new(tuple_space_server, features)
|
14
|
+
end
|
15
|
+
|
16
|
+
after do
|
17
|
+
tuple_space_server.terminate
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'should take a task' do
|
21
|
+
task = Tuple[:task].new(
|
22
|
+
'&main:Test',
|
23
|
+
[],
|
24
|
+
Parameters.empty,
|
25
|
+
Feature.empty,
|
26
|
+
ID.domain_id("main", "Test", [], Parameters.empty),
|
27
|
+
[]
|
28
|
+
)
|
29
|
+
write(task)
|
30
|
+
@worker.__send__(:transit_to_initialized)
|
31
|
+
@worker.__send__(:transit_to_task_waiting).should == task
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'should wait taking a task because of features' do
|
35
|
+
task = Tuple[:task].new(
|
36
|
+
'&main:Test',
|
37
|
+
[],
|
38
|
+
Parameters.empty,
|
39
|
+
Feature::RequisiteExpr.new('X'),
|
40
|
+
ID.domain_id("main", "Test", [], Parameters.empty),
|
41
|
+
[]
|
42
|
+
)
|
43
|
+
write(task)
|
44
|
+
should.raise(Timeout::Error) do
|
45
|
+
timeout(1) do
|
46
|
+
@worker.__send__(:transit_to_task_waiting)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
it 'should not wait taking a task because of features' do
|
52
|
+
task = Tuple[:task].new(
|
53
|
+
'&main:Test',
|
54
|
+
[],
|
55
|
+
Parameters.empty,
|
56
|
+
Feature::RequisiteExpr.new('A'),
|
57
|
+
ID.domain_id("main", "Test", [], Parameters.empty),
|
58
|
+
[]
|
59
|
+
)
|
60
|
+
write(task)
|
61
|
+
@worker.__send__(:transit_to_task_waiting).should == task
|
62
|
+
end
|
63
|
+
|
64
|
+
it 'should take a rule' do
|
65
|
+
task1 = Tuple[:task].new(
|
66
|
+
'&main:Test',
|
67
|
+
[],
|
68
|
+
Parameters.empty,
|
69
|
+
Feature.empty,
|
70
|
+
ID.domain_id("main", "Test", [], Parameters.empty),
|
71
|
+
[]
|
72
|
+
)
|
73
|
+
rule = Tuple[:rule].new('&main:Test', :fake_content, :known)
|
74
|
+
write(rule)
|
75
|
+
task2, result = @worker.__send__(:transit_to_rule_loading, task1)
|
76
|
+
result.should == :fake_content
|
77
|
+
task2.should == task1
|
78
|
+
end
|
79
|
+
|
80
|
+
it 'should raise an exception because a rule is unknown' do
|
81
|
+
task = Tuple[:task].new(
|
82
|
+
'&main:Test',
|
83
|
+
[],
|
84
|
+
Parameters.empty,
|
85
|
+
Feature.empty,
|
86
|
+
ID.domain_id("main", "Test", [], Parameters.empty),
|
87
|
+
[]
|
88
|
+
)
|
89
|
+
rule = Tuple[:rule].new('&main:Test', :fake_content, :unknown)
|
90
|
+
write(rule)
|
91
|
+
should.raise(Agent::TaskWorker::UnknownRuleError) do
|
92
|
+
@worker.__send__(:transit_to_rule_loading, task)
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
it 'should execute a task' do
|
97
|
+
task1 = Tuple[:task].new(
|
98
|
+
'&main:Test',
|
99
|
+
[],
|
100
|
+
Parameters.empty,
|
101
|
+
Feature.empty,
|
102
|
+
ID.domain_id("main", "Test", [], Parameters.empty),
|
103
|
+
[]
|
104
|
+
)
|
105
|
+
write(Tuple[:working].new(task1.domain, "test"))
|
106
|
+
rule = ActionRule.new(
|
107
|
+
RuleExpr.new(Package.new('main'), 'Test'),
|
108
|
+
RuleCondition.new(
|
109
|
+
[],
|
110
|
+
[DataExpr.new('out.txt')],
|
111
|
+
Parameters.empty,
|
112
|
+
Feature.empty
|
113
|
+
),
|
114
|
+
ActionBlock.new("expr 1 + 2 > out.txt")
|
115
|
+
)
|
116
|
+
Pione.quiet_mode do
|
117
|
+
task2, handler, result =
|
118
|
+
@worker.__send__(:transit_to_task_executing, task1, rule)
|
119
|
+
task2.should == task1
|
120
|
+
result.first.name.should == "out.txt"
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
it 'should write output data tuples' do
|
125
|
+
task1 = Tuple[:task].new(
|
126
|
+
'&main:Test',
|
127
|
+
[],
|
128
|
+
Parameters.empty,
|
129
|
+
Feature.empty,
|
130
|
+
ID.domain_id("main", "Test", [], Parameters.empty),
|
131
|
+
[]
|
132
|
+
)
|
133
|
+
write(Tuple[:working].new(task1.domain, "test"))
|
134
|
+
rule = FlowRule.new(
|
135
|
+
RuleExpr.new(Package.new('main'), 'Test'),
|
136
|
+
RuleCondition.new([], [], Parameters.empty, Feature.empty),
|
137
|
+
:dummy
|
138
|
+
)
|
139
|
+
handler1 = RuleHandler::FlowHandler.new(
|
140
|
+
tuple_space_server, rule, [], Parameters.empty, []
|
141
|
+
)
|
142
|
+
result = [Tuple[:data].new('&main:Test', '1.a', nil, Time.now)]
|
143
|
+
task2, handler2 =
|
144
|
+
@worker.__send__(:transit_to_data_outputing, task1, handler1, result)
|
145
|
+
task2.should == task1
|
146
|
+
handler2.should == handler1
|
147
|
+
read(Tuple[:data].new(name: '1.a'))
|
148
|
+
end
|
149
|
+
|
150
|
+
it 'should write a finished_task tuple' do
|
151
|
+
task = Tuple[:task].new(
|
152
|
+
'&main:Test',
|
153
|
+
[],
|
154
|
+
Parameters.empty,
|
155
|
+
Feature.empty,
|
156
|
+
ID.domain_id("main", "Test", [], Parameters.empty),
|
157
|
+
[]
|
158
|
+
)
|
159
|
+
write(Tuple[:working].new(task.domain, "test"))
|
160
|
+
rule = FlowRule.new(
|
161
|
+
RuleExpr.new(Package.new('main'), 'Test'),
|
162
|
+
RuleCondition.new([], [], Parameters.empty, Feature.empty),
|
163
|
+
:dummy
|
164
|
+
)
|
165
|
+
handler = RuleHandler::FlowHandler.new(
|
166
|
+
tuple_space_server, rule, [], Parameters.empty, []
|
167
|
+
)
|
168
|
+
@worker.__send__(:transit_to_task_finishing, task, handler)
|
169
|
+
finished_task = read(Tuple[:finished].any)
|
170
|
+
finished_task.domain.should == handler.domain
|
171
|
+
finished_task.outputs.should == []
|
172
|
+
end
|
173
|
+
end
|
174
|
+
|
175
|
+
describe 'running' do
|
176
|
+
before do
|
177
|
+
DRb.start_service
|
178
|
+
create_remote_tuple_space_server
|
179
|
+
|
180
|
+
Agent[:logger].start(tuple_space_server, File.open("out.txt", "w+"))
|
181
|
+
|
182
|
+
# process info
|
183
|
+
write(Tuple[:process_info].new('spec_task-worker', 'testid'))
|
184
|
+
|
185
|
+
# setup workers
|
186
|
+
@worker1 = Agent[:task_worker].start(tuple_space_server)
|
187
|
+
@worker2 = Agent[:task_worker].start(tuple_space_server)
|
188
|
+
@worker3 = Agent[:task_worker].start(tuple_space_server)
|
189
|
+
|
190
|
+
# make a task
|
191
|
+
@uri = "local:/tmp/1.a"
|
192
|
+
Resource[@uri].create "abc"
|
193
|
+
@data = Tuple[:data].new(domain: 'test', name: "1.a", uri: @uri)
|
194
|
+
@task1 = Tuple[:task].new(
|
195
|
+
"&main:test",
|
196
|
+
[@data],
|
197
|
+
Parameters.empty,
|
198
|
+
Feature.empty,
|
199
|
+
ID.domain_id("main", "Test", [@data], Parameters.empty),
|
200
|
+
[]
|
201
|
+
)
|
202
|
+
|
203
|
+
# make a rule
|
204
|
+
doc = Pione::Document.parse <<-DOCUMENT
|
205
|
+
Rule test
|
206
|
+
input '*.a'
|
207
|
+
output '{$*}.b'.stdout
|
208
|
+
Action
|
209
|
+
echo -n "input: `cat {$I[1]}`"
|
210
|
+
End
|
211
|
+
DOCUMENT
|
212
|
+
write(
|
213
|
+
Tuple[:rule].new(
|
214
|
+
rule_path: "&main:test",
|
215
|
+
content: doc["&main:test"],
|
216
|
+
status: :known
|
217
|
+
)
|
218
|
+
)
|
219
|
+
|
220
|
+
# workers are waiting tasks
|
221
|
+
@worker1.wait_till(:task_waiting)
|
222
|
+
@worker2.wait_till(:task_waiting)
|
223
|
+
@worker3.wait_till(:task_waiting)
|
224
|
+
end
|
225
|
+
|
226
|
+
after do
|
227
|
+
@worker1.terminate
|
228
|
+
@worker2.terminate
|
229
|
+
@worker3.terminate
|
230
|
+
tuple_space_server.terminate
|
231
|
+
end
|
232
|
+
|
233
|
+
it "should wait tasks" do
|
234
|
+
# check agent state
|
235
|
+
@worker1.current_state.should == :task_waiting
|
236
|
+
@worker2.current_state.should == :task_waiting
|
237
|
+
@worker3.current_state.should == :task_waiting
|
238
|
+
|
239
|
+
# check exceptions
|
240
|
+
check_exceptions
|
241
|
+
end
|
242
|
+
|
243
|
+
it "should say hello and bye" do
|
244
|
+
## check hello message
|
245
|
+
|
246
|
+
# check agent tuples
|
247
|
+
agents = read_all(Tuple[:agent].any)
|
248
|
+
agents.should.include @worker1.to_agent_tuple
|
249
|
+
agents.should.include @worker2.to_agent_tuple
|
250
|
+
agents.should.include @worker3.to_agent_tuple
|
251
|
+
|
252
|
+
# check worker counter
|
253
|
+
tuple_space_server.current_task_worker_size.should == 3
|
254
|
+
|
255
|
+
# terminate workers
|
256
|
+
@worker1.terminate
|
257
|
+
@worker2.terminate
|
258
|
+
@worker3.terminate
|
259
|
+
|
260
|
+
# wait to terminate
|
261
|
+
@worker1.wait_till(:terminated)
|
262
|
+
@worker2.wait_till(:terminated)
|
263
|
+
@worker3.wait_till(:terminated)
|
264
|
+
|
265
|
+
## check bye message
|
266
|
+
|
267
|
+
# check agent tuples
|
268
|
+
agents = read_all(Tuple[:agent].any)
|
269
|
+
agents.should.not.include @worker1.to_agent_tuple
|
270
|
+
agents.should.not.include @worker2.to_agent_tuple
|
271
|
+
agents.should.not.include @worker3.to_agent_tuple
|
272
|
+
|
273
|
+
# check agent counter
|
274
|
+
tuple_space_server.current_task_worker_size.should == 0
|
275
|
+
|
276
|
+
# check exceptions
|
277
|
+
check_exceptions
|
278
|
+
end
|
279
|
+
|
280
|
+
it "should process tasks" do
|
281
|
+
# terminate worker2,3
|
282
|
+
@worker2.terminate
|
283
|
+
@worker3.terminate
|
284
|
+
@worker2.wait_till(:terminated)
|
285
|
+
@worker3.wait_till(:terminated)
|
286
|
+
|
287
|
+
# check state
|
288
|
+
@worker1.current_state.should == :task_waiting
|
289
|
+
@worker2.running_thread.should.not.be.alive
|
290
|
+
@worker3.running_thread.should.not.be.alive
|
291
|
+
|
292
|
+
# process task on @worker1
|
293
|
+
@worker1.wait_till(:task_waiting)
|
294
|
+
write(@task1)
|
295
|
+
|
296
|
+
# process task
|
297
|
+
observe_exceptions do
|
298
|
+
sleep 0.3
|
299
|
+
# check finished tuple
|
300
|
+
finished = read(Tuple[:finished].any)
|
301
|
+
# check result data
|
302
|
+
data = read(Tuple[:data].new(name: "1.b"))
|
303
|
+
Resource[data.uri].read.should == "input: abc"
|
304
|
+
end
|
305
|
+
end
|
306
|
+
end
|
307
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require_relative '../test-util'
|
2
|
+
|
3
|
+
class TestTupleSpaceClient < Agent::TupleSpaceClient
|
4
|
+
define_state :test1
|
5
|
+
define_state :test2
|
6
|
+
define_state :test3
|
7
|
+
|
8
|
+
define_state_transition :initialized => :test1
|
9
|
+
define_state_transition :test1 => :test2
|
10
|
+
define_state_transition :test2 => :test3
|
11
|
+
define_state_transition :test3 => :terminated
|
12
|
+
end
|
13
|
+
|
14
|
+
describe 'Pione::Agent::TupleSpaceClient' do
|
15
|
+
before do
|
16
|
+
DRb.start_service
|
17
|
+
create_remote_tuple_space_server
|
18
|
+
end
|
19
|
+
|
20
|
+
after do
|
21
|
+
DRb.stop_service
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'should say "hello"' do
|
25
|
+
ts = TestTupleSpaceClient.new(tuple_space_server)
|
26
|
+
ts.current_state.should == nil
|
27
|
+
ts.transit
|
28
|
+
ts.should.initialized
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
require_relative '../test-util'
|
2
|
+
|
3
|
+
describe 'Model::Assignment' do
|
4
|
+
it 'should be equal' do
|
5
|
+
x1 = Assignment.new(Variable.new("X"), PioneString.new("a"))
|
6
|
+
x2 = Assignment.new(Variable.new("X"), PioneString.new("a"))
|
7
|
+
x1.should.be.equal x2
|
8
|
+
end
|
9
|
+
|
10
|
+
it 'should not be equal' do
|
11
|
+
x1 = Assignment.new(Variable.new("X"), PioneString.new("a"))
|
12
|
+
x2 = Assignment.new(Variable.new("X"), PioneString.new("b"))
|
13
|
+
y1 = Assignment.new(Variable.new("Y"), PioneString.new("a"))
|
14
|
+
y2 = Assignment.new(Variable.new("Y"), PioneString.new("b"))
|
15
|
+
x1.should.not.be.equal x2
|
16
|
+
x1.should.not.be.equal y1
|
17
|
+
x1.should.not.be.equal y2
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'should push variable and value into variable table' do
|
21
|
+
Assignment.new(
|
22
|
+
Variable.new("X"),
|
23
|
+
PioneString.new("a")
|
24
|
+
).eval(VariableTable.new).should == PioneString.new("a")
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'should evaluate the value' do
|
28
|
+
vtable = VariableTable.new
|
29
|
+
Assignment.new(
|
30
|
+
Variable.new("X"),
|
31
|
+
Message.new("as_string", 1.to_pione)
|
32
|
+
).eval(vtable)
|
33
|
+
Variable.new("X").eval(vtable).should == "1".to_pione
|
34
|
+
end
|
35
|
+
|
36
|
+
it 'should update variable table' do
|
37
|
+
vtable = VariableTable.new
|
38
|
+
Assignment.new(
|
39
|
+
Variable.new("X"),
|
40
|
+
"a".to_pione
|
41
|
+
).eval(vtable).should == "a".to_pione
|
42
|
+
vtable.get(Variable.new("X")).should == "a".to_pione
|
43
|
+
Assignment.new(
|
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
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require_relative '../test-util'
|
2
|
+
|
3
|
+
describe 'Model::BinaryOperator' do
|
4
|
+
before do
|
5
|
+
@a = Model::BinaryOperator.new(
|
6
|
+
"%",
|
7
|
+
Model::PioneInteger.new(5),
|
8
|
+
Model::PioneInteger.new(2)
|
9
|
+
)
|
10
|
+
@b = Model::BinaryOperator.new(
|
11
|
+
"+",
|
12
|
+
Model::PioneString.new("abc"),
|
13
|
+
Model::PioneString.new("def")
|
14
|
+
)
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'should equal' do
|
18
|
+
@a.should == Model::BinaryOperator.new(
|
19
|
+
"%",
|
20
|
+
Model::PioneInteger.new(5),
|
21
|
+
Model::PioneInteger.new(2)
|
22
|
+
)
|
23
|
+
@b.should == Model::BinaryOperator.new(
|
24
|
+
"+",
|
25
|
+
Model::PioneString.new("abc"),
|
26
|
+
Model::PioneString.new("def")
|
27
|
+
)
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'should not equal' do
|
31
|
+
@a.should.not == @b
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'should send message' do
|
35
|
+
vtable = VariableTable.new
|
36
|
+
@a.eval(vtable).should == Model::PioneInteger.new(1)
|
37
|
+
@b.eval(vtable).should == Model::PioneString.new("abcdef")
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,154 @@
|
|
1
|
+
require_relative '../test-util'
|
2
|
+
|
3
|
+
describe 'Model::ActionBlock' do
|
4
|
+
it 'should be equal' do
|
5
|
+
ActionBlock.new("eccho 'a'").should ==
|
6
|
+
ActionBlock.new("eccho 'a'")
|
7
|
+
end
|
8
|
+
|
9
|
+
it 'should not be equal' do
|
10
|
+
ActionBlock.new("eccho 'a'").should.not ==
|
11
|
+
ActionBlock.new("eccho 'b'")
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'should expand variables' do
|
15
|
+
block = ActionBlock.new("{$var1} {$var2} {$var3}")
|
16
|
+
vtable = VariableTable.new
|
17
|
+
vtable.set(Variable.new("var1"), "a".to_pione)
|
18
|
+
vtable.set(Variable.new("var2"), "b".to_pione)
|
19
|
+
vtable.set(Variable.new("var3"), "c".to_pione)
|
20
|
+
block.eval(vtable).should == ActionBlock.new("a b c")
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
describe 'Model::FlowBlock' do
|
25
|
+
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
|
+
)
|
31
|
+
end
|
32
|
+
|
33
|
+
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
|
+
)
|
39
|
+
end
|
40
|
+
|
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
|
+
]
|
51
|
+
end
|
52
|
+
|
53
|
+
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
|
+
block = FlowBlock.new(
|
59
|
+
Assignment.new(Variable.new("X"), Variable.new("Y")),
|
60
|
+
Assignment.new(Variable.new("Y"), Variable.new("Z")),
|
61
|
+
ConditionalBlock.new(
|
62
|
+
Variable.new("A"),
|
63
|
+
{ PioneBoolean.true =>
|
64
|
+
FlowBlock.new(Assignment.new(Variable.new("Z"), 1.to_pione)),
|
65
|
+
}
|
66
|
+
),
|
67
|
+
Assignment.new(Variable.new("A"), PioneBoolean.true),
|
68
|
+
ConditionalBlock.new(
|
69
|
+
Message.new("==", Variable.new("Z"), 1.to_pione),
|
70
|
+
{ PioneBoolean.true => FlowBlock.new(z) }
|
71
|
+
),
|
72
|
+
x,
|
73
|
+
y
|
74
|
+
)
|
75
|
+
new_block = block.eval(vtable)
|
76
|
+
new_block.elements.should.include x
|
77
|
+
new_block.elements.should.include y
|
78
|
+
new_block.elements.should.include z
|
79
|
+
new_block.elements.each{|rule| rule.should.kind_of(CallRule)}
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
describe 'Model::ConditionalBlock' do
|
84
|
+
it 'should be equal' do
|
85
|
+
ConditionalBlock.new(
|
86
|
+
Variable.new("X"),
|
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
|
+
}
|
96
|
+
).should == ConditionalBlock.new(
|
97
|
+
Variable.new("X"),
|
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
|
+
}
|
107
|
+
)
|
108
|
+
end
|
109
|
+
|
110
|
+
it 'should not be equal' do
|
111
|
+
ConditionalBlock.new(
|
112
|
+
Variable.new("X"),
|
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
|
+
}
|
122
|
+
).should != ConditionalBlock.new(
|
123
|
+
Variable.new("Y"),
|
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
|
+
}
|
133
|
+
)
|
134
|
+
end
|
135
|
+
|
136
|
+
it 'should evaluate' do
|
137
|
+
vtable = VariableTable.new
|
138
|
+
block = ConditionalBlock.new(
|
139
|
+
Variable.new("X"),
|
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
|
+
}
|
149
|
+
)
|
150
|
+
vtable.set(Variable.new("X"), "a".to_pione)
|
151
|
+
block.eval(vtable).should ==
|
152
|
+
FlowBlock.new(CallRule.new(RuleExpr.new(Package.new("test"), "a")))
|
153
|
+
end
|
154
|
+
end
|