tests/testthat/test-sim_obj.R

pacman::p_load("testthat","popgen.stats")

context("sim_obj constructor")

#discoal_sim<-function(mu,recomb_rate,Ne,nSites,samplesize,s,discoal_path,fix_generation,seed,sweep){


test_that ("simulation object constructly correctly", {
  cmd="~/command"
  seeds=c(1,2)
  segsites=10
  positions=c(0.4,0.6)
  set.seed(2019)
  genome_matrix=matrix(sample(0:1, size = 9, replace = TRUE), nc = 3)
  sweep="hard"
  select_coeff=0.1
  sim=sim_obj(cmd,seeds,segsites,positions,genome_matrix,sweep,select_coeff)

  expect_equal(cmd,sim$cmd)
  expect_equal(seeds,sim$seeds)
  expect_equal(segsites,sim$num_seg)
  expect_equal(positions,sim$pos)
  expect_equal(genome_matrix,sim$genomes)
  expect_equal(sweep,sim$sweep)
  expect_equal(select_coeff,sim$s)
})
deponent-verb/popgen.stats documentation built on Nov. 4, 2019, 10:26 a.m.