spec/excel_functions_spec.rb in rubyfromexcel-0.0.13 vs spec/excel_functions_spec.rb in rubyfromexcel-0.0.16
- old
+ new
@@ -302,10 +302,11 @@
describe "pmt" do
it "should calculate the monthly payment required for a given principal, interest rate and loan period" do
FunctionTest.pmt(0.1,10,100).should be_within(0.01).of(-16.27)
FunctionTest.pmt(0.0123,99.1,123.32).should be_within(0.01).of(-2.159)
+ FunctionTest.pmt(0,2,10).should be_within(0.01).of(-5)
end
end
describe "npv" do
it "should calculate the discounted value of future cash flows" do
@@ -313,9 +314,17 @@
FunctionTest.npv(0.08,8000,9200,10000,12000,14500).should be_within(0.01).of(1922.06+40000)
FunctionTest.npv(0.08,8000,9200,10000,12000,14500,-9000).should be_within(0.01).of(-3749.47+40000)
FunctionTest.npv(0.1,FunctionTest.a('a1','a2'),20).should be_within(0.01).of(106.76)
end
end
+
+describe "text" do
+ it "should round a numeric value to a number of decimal places and then return a string if in the format text(3.1415,0), otherwise not implemented" do
+ FunctionTest.text(3.1415,0).should == "3"
+ FunctionTest.text(3.1415,1).should == "3.1"
+ end
+end
+
describe "excel comparisons" do
it "should carry out comparisons in the usual way" do
FunctionTest.excel_comparison(10,"==",5).should == false
\ No newline at end of file