Running ‘RQuantlib.R’ [1s/1s]
  Running ‘doRUnit.R’ [40s/55s]
Running the tests in ‘tests/RQuantlib.R’ failed.
Complete output:
  > 
  > stopifnot(require(RQuantLib))
  Loading required package: RQuantLib
  > 
  > ## values from Quantlib's test-suite
  > ## Reference: Haug, Option Pricing Formulas, McGraw-Hill, 1998
  > ##
  > ## and generally sourced from the code in the test-suite/
  > ## directory of the QuantLib distribution
  > 
  > ## europeanoption.cpp:  call value == 2.1334
  > print(EuropeanOption("call", underlying=60, strike=65, div=0, riskFree=0.08,
  +                      maturity=0.25, vol=0.3), digits=5)
  Concise summary of valuation for EuropeanOption 
     value    delta    gamma     vega    theta      rho   divRho 
   2.13337  0.37248  0.04204 11.35154 -8.42817  5.05390 -5.58724 
  > ## europeanoption.cpp:  put value == 2.4648
  > print(EuropeanOption("put", underlying=100, strike=95, div=0.05, riskFree=0.1,
  +                      maturity=0.5, vol=0.2), digits=5)
  Concise summary of valuation for EuropeanOption 
      value     delta     gamma      vega     theta       rho    divRho 
    2.46479  -0.26418   0.02284  22.83957  -3.00053 -14.44147  13.20908 
  > 
  > ## europeanoption.cpp:  call delta == 0.5946
  > print(EuropeanOption("call", underlying=105, strike=100,div=0.1,riskFree=0.1,
  +                      maturity=0.5, vol=0.36), digits=4)
  Concise summary of valuation for EuropeanOption 
     value    delta    gamma     vega    theta      rho   divRho 
   12.4328   0.5946   0.0135  26.7781  -8.3968  25.0016 -31.2180 
  > ## europeanoption.cpp:  put delta == -0.3566
  > print(EuropeanOption("put", underlying=105, strike=100,div=0.1,riskFree=0.1,
  +                      maturity=0.5, vol=0.36), digits=4)
  Concise summary of valuation for EuropeanOption 
     value    delta    gamma     vega    theta      rho   divRho 
    7.6767  -0.3566   0.0135  26.7781  -8.8725 -22.5599  18.7215 
  > 
  > ## europeanoption.cpp:  call gamma == 0.0278
  > print(EuropeanOption("call", underlying=55, strike=60,div=0.0,riskFree=0.1,
  +                      maturity=0.75, vol=0.30), digits=4)
  Concise summary of valuation for EuropeanOption 
     value    delta    gamma     vega    theta      rho   divRho 
    5.3928   0.5333   0.0278  18.9358  -6.1813  17.9557 -22.0003 
  > ## europeanoption.cpp:  put gamma == 0.0278
  > print(EuropeanOption("put", underlying=55, strike=60,div=0.0,riskFree=0.1,
  +                      maturity=0.75, vol=0.30), digits=4)
  Concise summary of valuation for EuropeanOption 
     value    delta    gamma     vega    theta      rho   divRho 
    6.0574  -0.4667   0.0278  18.9358  -0.6148 -23.7927  19.2497 
  > 
  > ## europeanoption.cpp:  call vega == 18.9358
  > print(EuropeanOption("call", underlying=55, strike=60,div=0.0,riskFree=0.1,
  +                      maturity=0.75, vol=0.30), digits=4)
  Concise summary of valuation for EuropeanOption 
     value    delta    gamma     vega    theta      rho   divRho 
    5.3928   0.5333   0.0278  18.9358  -6.1813  17.9557 -22.0003 
  > ## europeanoption.cpp:  put vega == 18.9358
  > print(EuropeanOption("put", underlying=55, strike=60,div=0.0,riskFree=0.1,
  +                      maturity=0.75, vol=0.30), digits=4)
  Concise summary of valuation for EuropeanOption 
     value    delta    gamma     vega    theta      rho   divRho 
    6.0574  -0.4667   0.0278  18.9358  -0.6148 -23.7927  19.2497 
  > 
  > 
  > ## americanoption.cpp:  call value == 10.0089 -- we show 10.00606
  > print(AmericanOption("call", underlying=110, strike=100, div=0.1, riskFree=0.1,
  +                      maturity=0.1, vol=0.15), digits=5)
  Concise summary of valuation for AmericanOption 
     value    delta    gamma     vega    theta      rho   divRho 
  10.00606       NA       NA       NA       NA       NA       NA 
  > ## americanoption.cpp:  put value == 0.3159
  > print(AmericanOption("call", underlying=90, strike=100, div=0.1, riskFree=0.1,
  +                      maturity=0.1, vol=0.25), digits=5)
  Concise summary of valuation for AmericanOption 
   value  delta  gamma   vega  theta    rho divRho 
  0.3159     NA     NA     NA     NA     NA     NA 
  > 
  > 
  > # Discrete dividend
  > ## europeanoption.cpp:  call value ==  3.67
  > ## Reference pg. 253 - Hull 5th ed Exercise 12.8 - From QuantLib tests
  > print(EuropeanOption("call", underlying=40, strike=40, div=0, riskFree=0.09,
  +                      maturity=0.5, vol=0.3,
  +                      discreteDividends = c(0.5, 0.5),
  +                      discreteDividendsTimeUntil = c(2/12, 5/12)), digits=5)
  Concise summary of valuation for EuropeanOption 
     value    delta    gamma     vega    theta      rho   divRho 
   3.67123  0.58003  0.04722 10.78672 -4.99372  9.64649       NA 
  > 
  > ## americanoption.cpp:  call value == 3.72 (Hull) -- we show 3.75
  > ## Reference p. 256 - Hull 5th ed. Exercise 12.9 using (flawed) Roll, Geske, Whaley formula
  > print(AmericanOption("call", underlying=40, strike=40, div=0, riskFree=0.09,
  +                      maturity=0.5, vol=0.3,
  +                      engine = "CrankNicolson",
  +                      discreteDividends = c(0.5, 0.5),
  +                      discreteDividendsTimeUntil = c(2/12, 5/12)), digits=5)
  Concise summary of valuation for AmericanOption 
    value   delta   gamma    vega   theta     rho  divRho 
  3.75022 0.57989 0.04613      NA      NA      NA      NA 
  > 
  > ## barrier: down and out call == 9.0246
  > print(BarrierOption("downout", barrier=95, rebate=3, type="call",
  +                     strike=90, underlying=100, div=0.04, riskF=0.08,
  +                     mat=0.5, vol=0.25), digits=4)
  Concise summary of valuation for BarrierOption 
   value  delta  gamma   vega  theta    rho divRho 
  9.0246     NA     NA     NA     NA     NA     NA 
  > ## barrier: down and in call == 7.7627
  > print(BarrierOption("downin", barrier=95, rebate=3, type="call",
  +                     strike=90, underlying=100, div=0.04, riskF=0.08,
  +                     mat=0.5, vol=0.25), digits=4)
  Concise summary of valuation for BarrierOption 
   value  delta  gamma   vega  theta    rho divRho 
  7.7627     NA     NA     NA     NA     NA     NA 
  > 
  > 
  > ## binary aka digital: put == 2.6710
  > print(BinaryOption(binType="cash", type="put", excType="european",
  +                    strike=80, underl=100, div=0.06, r=0.06,
  +                    mat=0.75, vol=0.35, cash=10), digits=4)
  Concise summary of valuation for BinaryOption 
    value   delta   gamma    vega   theta     rho  divRho 
   2.6710 -0.1061  0.0031  8.1539 -1.7423 -9.9577  7.9545 
  > 
  > ## asianoption.cpp:  put == 4.6922 (from testAnalyticContinuousGeometricAveragePrice())
  > print( AsianOption("geometric", "put", underlying=80, strike=85, div=-0.03, riskFree=0.05, maturity=0.25, vol=0.2))
  Concise summary of valuation for AsianOption 
    value   delta   gamma    vega   theta     rho  divRho 
   4.6922 -0.8031  0.0594  6.8662  0.0580 -9.2039  8.0309 
  > 
  > # simple call with unnamed parameters
  > 
  > bond <- list(faceAmount=100,issueDate=as.Date("2004-11-30"),
  +              maturityDate=as.Date("2008-11-30"), redemption=100 )
  > 
  > dateparams <-list(settlementDays=1, calendar="UnitedStates/GovernmentBond", businessDayConvention='Unadjusted')
  > 
  > 
  > discountCurve.param <- list(tradeDate=as.Date('2002-2-15'),
  +                            settleDate=as.Date('2002-2-15'),
  +                            dt=0.25,
  +                            interpWhat='discount', interpHow='loglinear')
  > discountCurve <- DiscountCurve(discountCurve.param, list(flat=0.05))
  > 
  > ZeroCouponBond(bond, discountCurve, dateparams)
  Concise summary of valuation for ZeroCouponBond 
   Net present value :  71.21519 
         clean price :  81.884 
         dirty price :  81.884 
      accrued coupon :  0 
               yield :  0.050516 
          cash flows : 
         Date Amount
   2008-11-30    100
  > 
  > 
  > ## bond.cpp: examples from Fixed Income page of Matlab
  > ZeroYield(95, 100, as.Date("1993-6-24"), as.Date("1993-11-1"))
  
   *** caught segfault ***
  address 0x34624d8, cause 'invalid permissions'
  
  Traceback:
   1: zeroYieldByPriceEngine(price, faceAmount, dayCounter, frequency,     businessDayConvention, compound, maturityDate, issueDate)
   2: ZeroYield.default(95, 100, as.Date("1993-6-24"), as.Date("1993-11-1"))
   3: ZeroYield(95, 100, as.Date("1993-6-24"), as.Date("1993-11-1"))
  An irrecoverable exception occurred. R is aborting now ...
  Segmentation fault
Running the tests in ‘tests/doRUnit.R’ failed.
Complete output:
  > ## doRUnit.R --- Run RUnit tests
  > ##
  > ## with credits to package fUtilities in RMetrics
  > ## which credits Gregor Gojanc's example in CRAN package  'gdata'
  > ## as per the R Wiki http://wiki.r-project.org/rwiki/doku.php?id=developers:runit
  > ## and changed further by Martin Maechler
  > ## and more changes by Murray Stokely in HistogramTools
  > ## and then used adapted in RProtoBuf
  > ## and now used in Rcpp* and here 
  > ##
  > ## (Initially) inAdapted for RQuantLib by Dirk Eddelbuettel, 29 Dec 2007
  > 
  > stopifnot(require(RUnit, quietly=TRUE))
  > stopifnot(require(RQuantLib, quietly=TRUE))
  > 
  > ## Define tests
  > testSuite <- defineTestSuite(name="RQuantLib Unit Tests",
  +                              dirs=system.file("unitTests", package = "RQuantLib"),
  +                              testFuncRegexp = "^[Tt]est.+")
  > 
  > ## without this, we get (or used to get) unit test failures
  > Sys.setenv("R_TESTS"="")
  > 
  > ## Run tests
  > tests <- runTestSuite(testSuite)
  
  
  Executing test function test.HalfMonthModifiedFollowing  ...  done successfully.
  
  
  
  Executing test function test.Nearest  ...  done successfully.
  
  
  
  Executing test function test.isBusinessDay  ...  done successfully.
  
  
  
  Executing test function test.isHoliday  ...  done successfully.
  
  
  
  Executing test function test.date.conversion  ...  done successfully.
  
  
  
  Executing test function test.datevector.conversion  ...  done successfully.
  
  
  
  Executing test function test.american.Haug  ...  done successfully.
  
  
  
  Executing test function test.asian  ... 
   *** caught segfault ***
  address (nil), cause 'unknown'
  
  Traceback:
   1: asianOptionEngine(averageType, type, underlying, strike, dividendYield,     riskFreeRate, maturity, volatility, first, length, fixings)
   2: AsianOption.default("arithmetic", "put", underl = 90, strike = 87,     div = 0.06, riskF = 0.025, first = 0, length = 11/12, fixings = 2,     vol = 0.13)
   3: AO("arithmetic", "put", underl = 90, strike = 87, div = 0.06,     riskF = 0.025, first = 0, length = 11/12, fixings = 2, vol = 0.13)
   4: all.equal(target, current, tolerance = tolerance, ...)
   5: checkEquals(AO("arithmetic", "put", underl = 90, strike = 87,     div = 0.06, riskF = 0.025, first = 0, length = 11/12, fixings = 2,     vol = 0.13)$value, 1.3942835683, tol = 0.01)
   6: func()
   7: system.time(func(), gcFirst = RUnitEnv$.gcBeforeTest)
   8: doTryCatch(return(expr), name, parentenv, handler)
   9: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  10: tryCatchList(expr, classes, parentenv, handlers)
  11: tryCatch(expr, error = function(e) {    call <- conditionCall(e)    if (!is.null(call)) {        if (identical(call[[1L]], quote(doTryCatch)))             call <- sys.call(-4L)        dcall <- deparse(call)[1L]        prefix <- paste("Error in", dcall, ": ")        LONG <- 75L        sm <- strsplit(conditionMessage(e), "\n")[[1L]]        w <- 14L + nchar(dcall, type = "w") + nchar(sm[1L], type = "w")        if (is.na(w))             w <- 14L + nchar(dcall, type = "b") + nchar(sm[1L],                 type = "b")        if (w > LONG)             prefix <- paste0(prefix, "\n  ")    }    else prefix <- "Error : "    msg <- paste0(prefix, conditionMessage(e), "\n")    .Internal(seterrmessage(msg[1L]))    if (!silent && isTRUE(getOption("show.error.messages"))) {        cat(msg, file = outFile)        .Internal(printDeferredWarnings())    }    invisible(structure(msg, class = "try-error", condition = e))})
  12: try(system.time(func(), gcFirst = RUnitEnv$.gcBeforeTest))
  13: .executeTestCase(funcName, envir = sandbox, setUpFunc = .setUp,     tearDownFunc = .tearDown)
  14: .sourceTestFile(testFile, testSuite$testFuncRegexp)
  15: runTestSuite(testSuite)
  An irrecoverable exception occurred. R is aborting now ...
  Segmentation fault