spec/node_spec.rb in rb-libsvm-1.2.0 vs spec/node_spec.rb in rb-libsvm-1.3.0
- old
+ new
@@ -45,15 +45,17 @@
it "class can create nodes from an array" do
ary = Node.features([0.1, 0.2, 0.3, 0.4, 0.5])
ary.map {|n| n.class.should == Node}
ary.map {|n| n.value }.should == [0.1, 0.2, 0.3, 0.4, 0.5]
+ ary.map {|n| n.index }.should == [0, 1, 2, 3, 4]
end
it "class can create nodes from variable parameters" do
ary = Node.features(0.1, 0.2, 0.3, 0.4, 0.5)
ary.map {|n| Node.should === n }
ary.map {|n| n.value }.should == [0.1, 0.2, 0.3, 0.4, 0.5]
+ ary.map {|n| n.index }.should == [0, 1, 2, 3, 4]
end
it "class can create nodes from hash" do
ary = Node.features(3=>0.3, 5=>0.5, 6=>0.6, 10=>1.0)
ary.map {|n| n.class.should == Node}