Sha256: 41c0f6c869b49f8265784a31d7f0317818d4a6bea6efd89b961ab51de297d1c1
Contents?: true
Size: 1.4 KB
Versions: 3
Compression:
Stored size: 1.4 KB
Contents
require File.expand_path(File.dirname(__FILE__) + '/spec_helper') require 'drbqs/node_list' describe DRbQS::NodeList do before(:all) do @node_list = DRbQS::NodeList.new @id_strings = 10.times.map { |i| sprintf("%05d", i) } @id_list = [] end it "should be empty." do @node_list.empty?.should be_true end it "should get ids that are not duplicated." do @id_strings.each do |str| @id_list << @node_list.get_new_id(str) end @id_list.uniq! @id_list.all? { |i| Integer === i }.should be_true @id_list.size.should == @id_strings.size @node_list.each do |id_num, id_str| @id_strings.include?(id_str).should be_true @id_list.include?(id_num).should be_true end end it "should delete all ids" do @node_list.empty?.should_not be_true @node_list.set_check_connection ids = @node_list.delete_not_alive ids.sort.should == @id_list.sort @node_list.empty?.should be_true @id_list.clear end it "should set alive flag" do alive_id_num = [3, 4, 5] @id_strings.each do |str| @id_list << @node_list.get_new_id(str) end @node_list.set_check_connection alive_id_num.each do |i| @node_list.set_alive(@id_list[i]) end @node_list.delete_not_alive alive_ids = alive_id_num.map { |i| @id_list[i] } @node_list.each do |id_num, id_str| alive_ids.include?(id_num).should be_true end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
drbqs-0.0.8 | spec/node_list_spec.rb |
drbqs-0.0.7 | spec/node_list_spec.rb |
drbqs-0.0.6 | spec/node_list_spec.rb |