tests/testthat/test-feature-outgroup.R

context("Feature Outgroup")

test_that("Creation of outgroup feature works", {
  expect_equal(feat_outgroup(1)$get_population(), 1)
  expect_equal(feat_outgroup(2)$get_population(), 2)
})


test_that("Outgroup setting and getting works", {
  model <- coal_model(1:4 * 2, 100)
  expect_equal(get_outgroup(model), NA)

  for (i in 1:4) {
    expect_equal(get_outgroup(model + feat_outgroup(i)), i)
    expect_equal(get_outgroup_size(model + feat_outgroup(i)), 2 * i)
  }
})

Try the coala package in your browser

Any scripts or data that you put into this service are public.

coala documentation built on Jan. 5, 2023, 5:11 p.m.