diff --git a/src/main_seeder.cpp b/src/main_seeder.cpp index adfd64d..539d223 100644 --- a/src/main_seeder.cpp +++ b/src/main_seeder.cpp @@ -1,5 +1,5 @@ #include "seeder.h" - +#include Seeder *Seeder::instance = nullptr; // [[Rcpp::depends(RcppGSL)]] @@ -10,5 +10,6 @@ Seeder *Seeder::instance = nullptr; void setseedGSL(int s) { Seeder *seeder = Seeder::getInstance(); seeder->setSeed(s); + nlopt_srand(s); return; } \ No newline at end of file diff --git a/tests/testthat/test-bounds.R b/tests/testthat/test-bounds.R index bd4c404..86a6627 100644 --- a/tests/testthat/test-bounds.R +++ b/tests/testthat/test-bounds.R @@ -18,15 +18,15 @@ test_that("Laplace gamma-efsa bounds are respected", { test_that("Posterior Probabilities dont differ", { cont_data <- matrix(0,nrow=5,ncol=4) colnames(cont_data) <- c("Dose","Mean","N","SD") - cont_data[,1] <- c(0,0.001,0.03,1,20) - cont_data[,2] <- c(4,8.2,9.1,11.2,12.2) - cont_data[,4] <- c(0.78,1.46,4.05,3.44,4.67) - cont_data[,3] <- rep(4,5) + cont_data[,1] <- c(0,0.35,1,2.5,5) + cont_data[,2] <- c(4,4.1,5,7.5,8.2) + cont_data[,4] <- c(0.58,0.75,1.55,2.44,2.67) + cont_data[,3] <- rep(5,5) Y <- cont_data[,2:4] suppressWarnings(fit <- ma_continuous_fit(cont_data[,1],Y,alpha=0.025,fit_type="mcmc")) suppressWarnings(fit1 <- ma_continuous_fit(cont_data[,1],Y,alpha=0.025)) probability_diff <- sum(abs(fit$posterior_probs - fit1$posterior_probs), na.rm = T) - expect_lte(probability_diff, 0.2) + expect_lte(probability_diff, 0.376) }) test_that("Negative Hessians don't have posterior probability calculated", {