Skip to content

Commit

Permalink
new unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rderoldan1 committed Mar 12, 2013
1 parent d67e8cb commit 6566d95
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 6 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ spec/reports
test/tmp
test/version_tmp
tmp
.DS_Store
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,6 @@ anticipated_variable_payment_amortization (periods, amount, rate, payment)
#### Amortization with fixed payment due
due_fixed_payment_amortization (periods, amount, rate, payment)

#### Variable payment amortization anticipated
anticipated_fixed_payment_amortization (periods, amount, rate, payment)

$ due_fixed_payment_amortization(5,10000,1.8,2109)
$ [{:period=>0, :monthly_payment=>nil, :interest=>nil, :payment=>nil, :balance=>10000},
{:period=>1, :payment=>2109, :interest=>18000.0, :monthly_payment=>-15891.0, :balance=>25891.0},
Expand All @@ -70,6 +67,11 @@ anticipated_fixed_payment_amortization (periods, amount, rate, payment)
{:period=>4, :payment=>2109, :interest=>350948.232, :monthly_payment=>-348839.232, :balance=>543810.4720000001},
{:period=>5, :payment=>2109, :interest=>978858.8496000002, :monthly_payment=>-976749.8496000002, :balance=>1520560.3216000004}]


#### Variable payment amortization anticipated
anticipated_fixed_payment_amortization (periods, amount, rate, payment)


#### Find future given the present value
future_given_present (present_value, interest, term)

Expand Down
28 changes: 25 additions & 3 deletions spec/test_payment_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,8 @@
require 'spec_helper'

describe "fixed payment test" do

it 'should be the monthly payment' do

annuity_given_present(100000000, 0.0144594763, 180).should eq(1563975.1395)

end
end

Expand All @@ -15,3 +12,28 @@
variable_payment(10000000.0,40).should eq(250000)
end
end

describe "due variable payment amortization" do
it "should be a hash of payments" do
due_variable_payment_amortization(5,10000,1.8,2000).should be_an(Array)
end
end

describe "anticipated vabiable payment amortization" do
it "should be a hash of payments" do
anticipated_variable_payment_amortization(5,10000,1.8,2000).should be_an(Array)
end
end

describe "due fixed payment amortization" do
it "should be a hash of payments" do
due_fixed_payment_amortization(5,10000,1.8,2000).should be_an(Array)
end
end

describe "anticipated fixed payment amortization" do
it "should be a hash of payments" do
anticipated_fixed_payment_amortization(5,10000,1.8,2000).should be_an(Array)
end
end

0 comments on commit 6566d95

Please sign in to comment.