tests/testthat/test-MortgagePool.R

testthat::context("amortize mortgage pool")

 test <- mortgage('fixed', term = 30, principal = 100000, rate = 4)
 test2 <- mortgage('fixed', term = 30, principal = 200000, rate = 5)
 test3 <- 
     mortgage(type = 'arm',
              term =  15,
              principal =  100000,
              rate =  .04,
              fixed_term =  7,
              period =  2,
              periodic_cap =  .01,
              lifetime_cap =  .07,
              lifetime_floor =  .03,
              periodic_floor =  .01,
              margin =  .01,
              index =  rep(.05, 12 * 15)
 )
 test_list <- list(test, test2, test3, test3,test3, test)
 
 test_that('MortgagePool Constructs pool of mortgages from list of Mortgages', {
     expect_s4_class(MortgagePool(test_list), 'MortgagePool')
 })
 
 test_that('amortize works on mortage pool of mixed loan types', {
     expect_is(amortize(MortgagePool(test_list)), 'list')
 })  
 
rds64/MortgageQuant documentation built on Nov. 20, 2017, 4:56 a.m.