C0 code coverage information
Generated on Sun Oct 26 11:18:15 -0500 2008 with rcov 0.8.1.2
Code reported as executed by Ruby looks like this...
and this: this line is also marked as covered.
Lines considered as run by rcov, but not reported by Ruby, look like this,
and this: these lines were inferred by rcov (using simple heuristics).
Finally, here's a line marked as not executed.
1 require File.dirname(__FILE__) + '/../spec_helper'
2 require 'aquarium/spec_example_types'
3 require 'aquarium/utils/set_utils'
4
5 describe Aquarium::Utils::SetUtils, "make_set" do
6 include Aquarium::Utils::SetUtils
7
8 before :each do
9 @empty_set = Set.new
10 end
11
12 it "should return an empty set if the input is empty." do
13 make_set().should == @empty_set
14 end
15
16 it "should return an empty set if the input is an empty array." do
17 make_set([]).should == @empty_set
18 end
19
20 it "should return an empty set if the input is nil." do
21 make_set(nil).should == @empty_set
22 end
23
24 it "should return an empty set if the input set contains all nils." do
25 make_set([nil, nil]).should == @empty_set
26 end
27
28 it "should return a set with all input nils removed." do
29 make_set([nil, 1, 2, nil, 3, 4]).should == Set.new([1, 2, 3, 4])
30 end
31
32 it "should return a 1-element set with an empty element if the input is empty." do
33 make_set("").should == Set.new([""])
34 end
35
36 it "should return a 1-element set with an element that matched the input element." do
37 make_set("123").should == Set.new(["123"])
38 end
39
40 it "should return an input set unchanged if it contains no nil elements." do
41 make_set([1,2,"123"]).should == Set.new([1,2,"123"])
42 end
43
44 it "should accept a single argument." do
45 make_set(nil).should == @empty_set
46 make_set(1).should == Set.new([1])
47 end
48
49 it "should accept a list of arguments." do
50 make_set(nil, nil).should == @empty_set
51 make_set(nil, 1, 2, nil, 3, 4).should == Set.new([1, 2, 3, 4])
52 end
53
54 it "should accept an array" do
55 make_set([nil, 1, 2, nil, 3, 4]).should == Set.new([1, 2, 3, 4])
56 end
57
58 it "should accept a set" do
59 make_set(Set.new([nil, 1, 2, nil, 3, 4])).should == Set.new([1, 2, 3, 4])
60 end
61 end
62
63 describe Aquarium::Utils::SetUtils, "strip_set_nils" do
64 include Aquarium::Utils::SetUtils
65
66 it "should return an empty set if an empty set is specified" do
67 strip_set_nils(Set.new([])).should == Set.new([])
68 end
69
70 it "should return an empty set if a set of only nil values is specified" do
71 strip_set_nils(Set.new([nil, nil])).should == Set.new([])
72 end
73
74 it "should return a set will all nil values removed" do
75 strip_set_nils(Set.new([nil, :a, nil, :b])).should == Set.new([:a, :b])
76 end
77 end
Generated using the rcov code coverage analysis tool for Ruby version 0.8.1.2.