Skip to content

Commit 96e6ec6

Browse files
committed
Tweak three schedule test results for QuantLib 1.38
1 parent 3bdaa51 commit 96e6ec6

2 files changed

Lines changed: 14 additions & 3 deletions

File tree

ChangeLog

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
2025-04-23 Dirk Eddelbuettel <edd@debian.org>
2+
3+
* inst/tinytest/test_schedule.R: Three adjustments for test behaviour
4+
in QuantLib 1.38 (released today)
5+
16
2025-03-25 Dirk Eddelbuettel <edd@debian.org>
27

38
* DESCRIPTION (Version, Date): Roll micro release and date

inst/tinytest/test_schedule.R

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ library(RQuantLib)
33

44
## For QuantLib 1.31 or newer we need to adjust three test expectations
55
is131 <- gsub("-[a-z]+", "", RQuantLib::getQuantLibVersion()) >= "1.31"
6+
is138 <- gsub("-[a-z]+", "", RQuantLib::getQuantLibVersion()) >= "1.38"
67

78
#test.Schedule <- function() {
89
## these tests are taken from the QuantLib test-suite/schedule.cpp file
@@ -23,7 +24,7 @@ params <- list(effectiveDate= as.Date("2009-09-30"),
2324
dateGeneration="Forward",
2425
endOfMonth=T)
2526
expected <- as.Date(c("2009-09-30", "2010-03-31", "2010-09-30", "2011-03-31", "2011-09-30",
26-
"2012-03-30",
27+
if (is138) "2012-04-02" else "2012-03-30",
2728
if (is131) "2012-06-15" else "2012-06-29"))
2829
expect_equal(Schedule(params), expected, info="Testing end date for schedule with end-of-month adjustment...")
2930

@@ -76,8 +77,13 @@ params <- list(effectiveDate = as.Date("1996-08-22"),
7677
terminationDateConvention="Following",
7778
dateGeneration="Backward",
7879
endOfMonth=T)
79-
expected <- if (is131) { as.Date(c("1996-08-22", "1996-08-30", "1997-02-28", "1997-09-02"))
80-
} else { as.Date(c("1996-08-30", "1997-02-28", "1997-08-29")) }
80+
expected <- if (is138) {
81+
as.Date(c("1996-08-22", "1996-09-03", "1997-02-28", "1997-09-02"))
82+
} else if (is131) {
83+
as.Date(c("1996-08-22", "1996-08-30", "1997-02-28", "1997-09-02"))
84+
} else {
85+
as.Date(c("1996-08-30", "1997-02-28", "1997-08-29"))
86+
}
8187
expect_equal(Schedule(params), expected, info=paste("Testing that the first date is not duplicated due to",
8288
"EOM convention when going backwards..."))
8389

0 commit comments

Comments
 (0)