Sha256: 9fa4d9a131ed5ac79b4a21ba15471f80cd33fa3934d73f77895fb7066212fc63
Contents?: true
Size: 1.69 KB
Versions: 4
Compression:
Stored size: 1.69 KB
Contents
require File.expand_path(File.dirname(__FILE__) + '/spec_helper') require 'drbqs/task_client' describe DRbQS::TaskClient do before(:all) do @node_id = 4 @ts_queue = Rinda::TupleSpace.new @ts_result = Rinda::TupleSpace.new @task_client = DRbQS::TaskClient.new(@node_id, @ts_queue, @ts_result) @task_example = [[1, 2, 3], :size, []] @task_id = 10 end it "should be empty" do @task_client.task_empty?.should be_true @task_client.result_empty?.should be_true @task_client.calculating_task.should be_nil end it "should queue a task" do @ts_queue.write([@task_id] + @task_example) @task_client.add_new_task @task_client.task_empty?.should_not be_true @task_client.result_empty?.should be_true @task_client.calculating_task.should == @task_id @ts_queue.read_all([nil, nil, nil, nil]).size.should == 0 @ts_result.take([:accept, nil, nil], 0).should be_true end it "should dequeue a task" do ary = @task_client.dequeue_task ary.should == @task_example @task_client.task_empty?.should be_true @task_client.result_empty?.should be_true @task_client.calculating_task.should == @task_id end it "should queue result" do @task_client.queue_result(@task_example[0].__send__(@task_example[1], *@task_example[2])) @task_client.task_empty?.should be_true @task_client.result_empty?.should_not be_true @task_client.calculating_task.should == @task_id end it "should send result" do @task_client.send_result @task_client.task_empty?.should be_true @task_client.result_empty?.should be_true @task_client.calculating_task.should be_nil @ts_result.take([:result, nil, nil, nil], 0).should be_true end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
drbqs-0.0.13 | spec/task_client_spec.rb |
drbqs-0.0.12 | spec/task_client_spec.rb |
drbqs-0.0.11 | spec/task_client_spec.rb |
drbqs-0.0.10 | spec/task_client_spec.rb |