spec/excel_functions_spec.rb in rubyfromexcel-0.0.5 vs spec/excel_functions_spec.rb in rubyfromexcel-0.0.6
- old
+ new
@@ -25,9 +25,35 @@
v.set('a1',nil)
v.a1.should == 10.0
end
end
+describe "round" do
+ it "should round numbers correctly" do
+ FunctionTest.round(1.1,0).should == 1.0
+ FunctionTest.round(1.5,0).should == 2.0
+ FunctionTest.round(1.56,1).should == 1.6
+ end
+end
+
+describe "roundup" do
+ it "should round numbers up correctly" do
+ FunctionTest.roundup(1.0,0).should == 1.0
+ FunctionTest.roundup(1.1,0).should == 2.0
+ FunctionTest.roundup(1.5,0).should == 2.0
+ FunctionTest.roundup(1.53,1).should == 1.6
+ end
+end
+
+describe "rounddown" do
+ it "should round numbers up correctly" do
+ FunctionTest.rounddown(1.0,0).should == 1.0
+ FunctionTest.rounddown(1.1,0).should == 1.0
+ FunctionTest.rounddown(1.5,0).should == 1.0
+ FunctionTest.rounddown(1.53,1).should == 1.5
+ end
+end
+
describe "sum" do
it "should total areas correctly" do
FunctionTest.sum(1,2,3).should == 6
FunctionTest.sum(FunctionTest.a('a1','a2'),3).should == 113
end
\ No newline at end of file