From a31fafd5de47b6f84a22a5204d86ce45399beb07 Mon Sep 17 00:00:00 2001 From: Waldir Leoncio Date: Fri, 31 Jul 2020 13:59:30 +0200 Subject: [PATCH] Added test for linkage() --- tests/testthat/test-greedyMix.R | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/tests/testthat/test-greedyMix.R b/tests/testthat/test-greedyMix.R index 18e72e7..9a1c05a 100644 --- a/tests/testthat/test-greedyMix.R +++ b/tests/testthat/test-greedyMix.R @@ -1,11 +1,21 @@ # library(devtools)#TEMP -# library(testthat)#TEMP +library(testthat)#TEMP # library(rBAPS)#TEMP context("Opening files on greedyMix") -# greedyMix( -# tietue = "data/ExamplesDataFormatting/Example baseline data in GENEPOP format for Trained clustering.txt", -# format = "GenePop", -# savePreProcessed = FALSE -# ) \ No newline at end of file +greedyMix( + tietue = "data/ExamplesDataFormatting/Example baseline data in GENEPOP format for Trained clustering.txt", + format = "GenePop", + savePreProcessed = FALSE +) + +context("Linkage") + +test_that("Linkages are properly calculated", { + Y <- c(0.5, 0.3, 0.6, 0.3, 0.3, 0.2, 0.3, 0.3, 0.3, 0.5) + expect_equal( + object = linkage(Y), + expected = matrix(c(2, 1, 7, 8, 4, 3, 5, 6, .2, .3, .3, .6), ncol=3) + ) +}) \ No newline at end of file