Added logml tests for #24

This commit is contained in:
Waldir Leoncio 2024-09-27 13:22:40 +02:00
parent 99ec89fd85
commit b57bc3f299

View file

@ -65,15 +65,18 @@ test_that("greedyMix() fails successfully", {
}) })
test_that("greedyMix() works when it should", { test_that("greedyMix() works when it should", {
tol <- 1e-4
baps_file <- file.path(path_inst, "BAPS_clustering_diploid.txt") baps_file <- file.path(path_inst, "BAPS_clustering_diploid.txt")
greedy_baps <- greedyMix(baps_file, "BAPS") greedy_baps <- greedyMix(baps_file, "BAPS")
expect_type(greedy_baps, "list") expect_type(greedy_baps, "list")
expect_length(greedy_baps, 10L) expect_length(greedy_baps, 10L)
expect_equal(greedy_baps[['logml']], -78.10151, tolerance = tol)
genepop_file <- file.path(path_inst, "GenePop.txt") genepop_file <- file.path(path_inst, "GenePop.txt")
greedy_genepop <- greedyMix(genepop_file, "GenePop") greedy_genepop <- greedyMix(genepop_file, "GenePop")
expect_type(greedy_genepop, "list") expect_type(greedy_genepop, "list")
expect_length(greedy_genepop, 10L) expect_length(greedy_genepop, 10L)
expect_equal(greedy_genepop[['logml']], -10.76224, tolerance = tol)
fasta_file <- file.path(path_inst, "FASTA_clustering_haploid.fasta") fasta_file <- file.path(path_inst, "FASTA_clustering_haploid.fasta")
}) })