set.seed(451) data=rbind(matrix(runif(20,1,5), nrow = 2, ncol = 10),matrix(runif(20,20,30), nrow = 2, ncol = 10),matrix(runif(20,50,70), nrow = 2, ncol = 10)) distance=RelativeDistance centers_function<-centers_function_RelativeDistance init_centers=init_centers_random RES=NEC_total(data, distance,centers_function,init_centers, seed=10, ITER=10, 0.01,KK=4, index="DaviesBould", k=NULL) o2=NEC(data, distance,4,centers_function,init_centers, seed=10, 10, 0.01) RES2=NEC_total(data, distance,centers_function,init_centers,seed=10, ITER=10, 0.01, k=4) #We make sure they are the same test_that("NEC_total", { expect_equal(RES$Output_of_grouping$centers, o2$FHW_output$centers) expect_equal(RES$Output_of_grouping$grouping, o2$FHW_output$grouping,tolerance=1e-6) expect_equal(length(RES$Quality), 5,tolerance=1e-6) expect_equal(RES2$Output_of_grouping$centers, o2$FHW_output$centers) expect_equal(RES2$Output_of_grouping$grouping, o2$FHW_output$grouping,tolerance=1e-6) })