My favorites | Sign in
Project Home Downloads Wiki Issues Source
Checkout   Browse   Changes    
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
require 'test/unit'
require 'Loan.rb'

class LoanTest < Test::Unit::TestCase
def test_init
loan = Loan.new(10.0, 12, 5000)
assert_equal(loan.rate, 10.0, "Rate should be 0.1")
assert_equal(loan.months, 12, "Months should be 12")
assert_equal(loan.presentValue, 5000, "Present Value should be 5000")
end

def test_calc
loan = Loan.new(12, 12, 1200)
amount = loan.calculateMonthlyPayment()
assert_equal(amount, 106.62, "Monthly payment should be 106.62")
end

def test_schedule
loan = Loan.new(12, 12, 1200)
amount = loan.calculatePaymentSchedule()
assert_equal(amount, 106.62, "Monthly payment should be 106.62")

end
end

Change log

r54 by pragkirk on Apr 8, 2009   Diff
Initial Checkin
Go to: 
Project members, sign in to write a code review

Older revisions

All revisions of this file

File info

Size: 732 bytes, 24 lines

File properties

svn:executable
Powered by Google Project Hosting