Skip to content

Commit

Permalink
#17: increase test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
hudde committed Jan 31, 2024
1 parent 58b6d7f commit 40afbcf
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tests/testthat/test-Malliavin_Geometric_Asian_Greeks.R
Original file line number Diff line number Diff line change
Expand Up @@ -130,4 +130,15 @@ test_that("Malliavin_Geometric_Asian_Greeks is correct", {
"Malliavin_Geometric_Asian_Greeks: Vectorized computation wrt to
exercise_price does not work")

# We check, whether custom payoff functions work

call <- function(x, exercise_price) {
return(pmax(0, x - exercise_price))
}

expect(max(abs(
Malliavin_Geometric_Asian_Greeks(payoff = call, paths = 100) -
Malliavin_Geometric_Asian_Greeks(payoff = "call", paths = 100))) < 1e-9,
"Malliavin_Geometric_Asian_Greeks: Custom payoff functions do not work")

})

0 comments on commit 40afbcf

Please sign in to comment.