Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New generic #787

Merged
merged 8 commits into from
Sep 11, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
test fixes and expansion
  • Loading branch information
mattfidler committed Sep 11, 2024
commit a3b25e464979eb98121581265e616b000826f729
6 changes: 6 additions & 0 deletions src/utilc.c
Original file line number Diff line number Diff line change
@@ -604,6 +604,12 @@ SEXP _rxode2_powerD(SEXP xS, SEXP lowS, SEXP highS, SEXP lambdaS, SEXP yjS, SEXP
int inverse = INTEGER(inverseS)[0];
int yj = INTEGER(yjS)[0];
double low, high, lambda;
if (Rf_length(inverseS) != 1) {
Rf_errorcall(R_NilValue, _("'inverse' must be an logical of length 1"));
}
if (Rf_length(yjS) != 1) {
Rf_errorcall(R_NilValue, _("'yj' must be an integer of length 1"));
}
if (Rf_length(lambdaS) != 1){
Rf_errorcall(R_NilValue, _("'lambda' must be a numeric of length 1"));
}
15 changes: 9 additions & 6 deletions tests/testthat/test-logit.R
Original file line number Diff line number Diff line change
@@ -51,8 +51,15 @@ rxTest({

expect_equal(logit(1:10, 0L, 11L), logit(as.double(1:10), 0.0, 11.0))

expect_error(logit(0.5, c(1, 2)))
expect_error(logit(0.5, 0, c(1, 2)))
expect_equal(logit(7, c(1, 2), c(10, 114)),
c(logit(7, 1, 10),
logit(7, 2, 114)))

expect_error(.Call(`_rxode2_powerD`, 0.5, c(1, 2), 3, 4, 4L, TRUE))
expect_error(.Call(`_rxode2_powerD`, 0.5, 1, c(3, 4), 4, 4L, TRUE))
expect_error(.Call(`_rxode2_powerD`, 0.5, 1, 3, 4, c(4L, 5L), TRUE))
expect_error(.Call(`_rxode2_powerD`, 0.5, 1, 3, 4, 4L, c(TRUE, FALSE)))

expect_error(logit(0.5, 1, -2))
})

@@ -107,9 +114,5 @@ rxTest({
)

expect_equal(expit(1:10, 0L, 11L), expit(as.double(1:10), 0.0, 11.0))

expect_error(expit(0.5, c(1, 2)))
expect_error(expit(0.5, 0, c(1, 2)))
expect_error(expit(0.5, 1, -2))
})
})
2 changes: 1 addition & 1 deletion tests/testthat/test-rxUiDeparse.R
Original file line number Diff line number Diff line change
@@ -8,6 +8,6 @@ test_that("rxUiDeparse()", {
naInterpolation="nocb", keepInterpolation="nocb", sigmaXform="variance",
omegaXform="variance", returnType="data.frame", sumType="fsum", prodType="logify",
sensType="central"), "a"),
str2lang("a <- rxControl(method = \"dop853\", covsInterpolation = \"linear\", returnType = \"data.frame\", sigmaXform = \"variance\", sumType = \"fsum\", prodType = c(\"long double\", \"double\", \"logify\"), sensType = \"central\", naInterpolation = \"nocb\", keepInterpolation = \"nocb\")"))
str2lang("a <- rxControl(method = \"dop853\", covsInterpolation = \"linear\", returnType = \"data.frame\", sigmaXform = \"variance\", sumType = \"fsum\", sensType = \"central\", naInterpolation = \"nocb\", keepInterpolation = \"nocb\")"))

})
Loading