Renamed global environment, fixed assignments (#24)
This commit is contained in:
parent
ec959fcfb2
commit
99f28ba215
22 changed files with 154 additions and 130 deletions
|
|
@ -11,14 +11,33 @@ test_that("Auxiliary functions work properly", {
|
|||
expect_equal(findOutRowsFromInd(x, y, "Diploid"), z)
|
||||
|
||||
# Testing getPopDistancesByKL ------------------------------------------------
|
||||
set.seed(5562143)
|
||||
globals$COUNTS <- array(rpois(10 ^ 3, lambda = 10), dim = c(10, 10, 10))
|
||||
x2 <- matrix(seq(4, 14, 2), 3)
|
||||
expect_equal(
|
||||
getPopDistancesByKL(x2),
|
||||
list(
|
||||
Z = matrix(c(c(1, 101:198), 2:100, rep(0, 99)), nrow = 99, ncol = 3),
|
||||
distances = as.matrix(rep(0, 4950))
|
||||
)
|
||||
Z <- matrix(
|
||||
c(
|
||||
5, 8, 0.004410383, 11, 10, 0.009386554, 2, 7, 0.010046641,
|
||||
3, 12, 0.011518562, 1, 4, 0.013682110, 14, 6, 0.027109229,
|
||||
15, 13, 0.032833011, 16, 9, 0.045394132, 17, 18, 0.086729590
|
||||
),
|
||||
nrow = 9, ncol = 3, byrow = TRUE
|
||||
)
|
||||
distances <- matrix(
|
||||
c(
|
||||
0.015767099, 0.020110943, 0.013682110, 0.010214691, 0.050375802,
|
||||
0.019692440, 0.010294099, 0.053740306, 0.028410233, 0.034496635,
|
||||
0.025356695, 0.015267764, 0.045409885, 0.010046641, 0.012797950,
|
||||
0.065436956, 0.026308651, 0.019896390, 0.006193117, 0.011735103,
|
||||
0.036077638, 0.011518562, 0.029233839, 0.010798344, 0.013262098,
|
||||
0.034671122, 0.032833011, 0.024732472, 0.033976345, 0.040243817,
|
||||
0.020374790, 0.024770297, 0.004410383, 0.024329842, 0.009386554,
|
||||
0.052217370, 0.027109229, 0.038127778, 0.016888110, 0.024061302,
|
||||
0.086729590, 0.038787638, 0.045394132, 0.005206076, 0.042606915
|
||||
),
|
||||
nrow = 45, ncol = 1,
|
||||
byrow = TRUE
|
||||
)
|
||||
expect_equal(getPopDistancesByKL(x2), list(Z = Z, distances = distances))
|
||||
|
||||
# Testing handlePopData ------------------------------------------------------
|
||||
x3 <- matrix(c(9, 4, 1, 8, 5, 2, 1, 2, 3), 3)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue