Reorganizing tests

This commit is contained in:
Waldir Leoncio 2022-04-12 15:50:16 +02:00
parent 40f2b3f07a
commit f81a078365

View file

@ -1,14 +1,17 @@
context("greedyPopMix functions") context("greedyPopMix functions")
test_that("Auxiliary functions work properly", { test_that("Auxiliary functions work properly", {
# Testing findOutRowsFromInd -------------------------------------------------
x <- matrix(11:16, 3) x <- matrix(11:16, 3)
y <- matrix(2:7, 3) y <- matrix(2:7, 3)
z <- list( z <- list(
popnames2 = matrix(c(11:13, seq(1.5, 2.5, 0.5)), 3), popnames2 = matrix(c(11:13, seq(1.5, 2.5, 0.5)), 3),
rowsFromInd = 2 rowsFromInd = 2
) )
x2 <- matrix(seq(4, 14, 2), 3)
expect_equal(findOutRowsFromInd(x, y, "Diploid"), z) expect_equal(findOutRowsFromInd(x, y, "Diploid"), z)
# Testing getPopDistancesByKL ------------------------------------------------
x2 <- matrix(seq(4, 14, 2), 3)
expect_equal( expect_equal(
getPopDistancesByKL(x2), getPopDistancesByKL(x2),
list( list(
@ -16,10 +19,12 @@ test_that("Auxiliary functions work properly", {
distances = as.matrix(rep(0, 4950)) distances = as.matrix(rep(0, 4950))
) )
) )
# Testing handlePopData ------------------------------------------------------
x3 <- matrix(c(9, 4, 1, 8, 5, 2, 1, 2, 3), 3) x3 <- matrix(c(9, 4, 1, 8, 5, 2, 1, 2, 3), 3)
y3 <- list( y3 <- list(
newData = matrix(c(3:1, 3:1, 1:3), 3), newData = matrix(c(3: 1, 3: 1, 1: 3), 3),
rows = matrix(c(1:3, 1:3), 3), rows = matrix(c(1: 3, 1: 3), 3),
alleleCodes = matrix(c(1, 4, 9, 2, 5, 8), 3), alleleCodes = matrix(c(1, 4, 9, 2, 5, 8), 3),
noalle = c(3, 3), noalle = c(3, 3),
adjprior = matrix(rep(3/9, 6), 3), adjprior = matrix(rep(3/9, 6), 3),