From a03e0dff29423755c9ee09e01673f18f55016967 Mon Sep 17 00:00:00 2001
From: Clare <chorscroft@users.noreply.github.com>
Date: Fri, 29 May 2020 02:17:24 +0100
Subject: [PATCH] Added test for x and diff having a different number of
 elements

---
 tests/testthat/test-create_LDprofile.R | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/tests/testthat/test-create_LDprofile.R b/tests/testthat/test-create_LDprofile.R
index 7bb00ad..5cdf3f3 100644
--- a/tests/testthat/test-create_LDprofile.R
+++ b/tests/testthat/test-create_LDprofile.R
@@ -157,6 +157,15 @@ test_that("create_LDprofile fails when a SNP has more than two alleles", {
                "SNPs must all be biallelic")
 })
 
+## Test the function with dists and x have a different number of elements
+
+test_that("create_LDprofile fails when dist and x are different lengths", {
+
+  expect_error(create_LDprofile(dist = list(df$dist,df$dist), x = as.matrix(df[,3:7]), bin_size = 0.001, max_dist = 0.005, beta_params = TRUE),
+               "dist and x should contain the same number of elements")
+})
+
+
 ## Test the function with bin_size as non-numeric
 
 test_that("create_LDprofile fails when bin_size is non-numeric", {
-- 
GitLab