Skip to content
Snippets Groups Projects
Commit 961249fa authored by Clare's avatar Clare
Browse files

Added some extra tests

parent e11788a7
No related branches found
No related tags found
No related merge requests found
...@@ -240,5 +240,34 @@ test_that("create_LDprofile calculates the LD profile correctly with missing val ...@@ -240,5 +240,34 @@ test_that("create_LDprofile calculates the LD profile correctly with missing val
## Test the function with fitdistrplus package not loaded and beta_params = TRUE ## Test the function with fitdistrplus package not loaded and beta_params = TRUE
#Tested manually
## Test the function when beta estimation doesn't work the first try ## Test the function when beta estimation doesn't work the first try
x1<-matrix(c(1,1,1,2,1,2,1,1,1,2,1,2,2,2,2,
1,1,1,2,1,2,2,2,2,1,1,2,1,1,2,
1,2,1,2,1,1,1,2,1,1,2,1,2,2,2,
1,2,1,2,1,1,2,1,2,2,1,2,2,1,2,
1,2,1,2,1,2,1,2,1,2,1,1,2,1,2,
1,2,2,1,1,2,1,2,2,1,2,1,1,1,2,
1,1,2,2,1,1,2,1,2,2,2,1,1,1,2,
1,1,2,1,1,1,2,2,1,2,2,1,1,1,2,
1,1,1,1,1,2,2,2,2,1,2,1,2,2,2,
1,2,2,2,2,1,2,1,2,1,2,2,2,1,2,
1,2,1,1,1,1,2,1,1,1,2,1,1,2,2,
1,1,1,2,2,1,2,1,2,1,1,2,2,1,2,
1,1,1,1,1,1,1,2,2,2,1,2,2,1,2,
1,2,2,1,2,1,1,1,2,1,2,1,2,1,2,
1,1,2,1,1,1,2,2,2,1,1,1,2,1,2),byrow=TRUE,nrow=15)
test_that("create_LDprofile calculates the LD profile correctly when beta calculation fails on first attempt", {
expect_equal(create_LDprofile(dist = rep(0,15), x = x1, bin_size = 0.001, max_dist = 0.001, beta_params = TRUE),
data.frame(
bin=c(0),
rsq=c(0.0754751721676325),
sd=c(0.0928525038706074),
Beta_a=c(0.21155096488681),
Beta_b=c(2.8704915799235),
n=c(105)
),tolerance=0.0001)
})
## Test the function when beta estimation doesn't work on the second try
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment