thijsjanzen / nLTT

Repository for the R nLTT package
GNU General Public License v2.0
6 stars 4 forks source link

test fail #45

Closed thijsjanzen closed 5 years ago

thijsjanzen commented 5 years ago

With the new random number generator, two tests in 'test-nLTTstat.R' fail:

test_that("abs nLTTstat on known tree", {
  set.seed(314)
  p <- ape::rcoal(10)
  q <- ape::rcoal(10)

  testthat::expect_equal(
    0.1380347, nLTTstat(tree1 = p, tree2 = q, distance_method = "abs"), # nolint nLTTstat should be all lowercase, left in for backwards compatibility
    tolerance = 0.0001
  )
})

test_that("squ nLTTstat on known tree", {
  set.seed(314)
  p <- ape::rcoal(10)
  q <- ape::rcoal(10)

  testthat::expect_equal(
    0.02407742, nLTTstat(tree1 = p, tree2 = q, distance_method = "squ"), # nolint nLTTstat should be all lowercase, left in for backwards compatibility
    tolerance = 0.0001
  )
})

I suspect because ape::rcoal no longer negerates the same trees. Please confirm and update the hardcoded nLTT differences that should be met (but are not now).

thijsjanzen commented 5 years ago

Once this is resolved, I will submit the new version to CRAN.

richelbilderbeek commented 5 years ago

Blimey, I see I am assigned. No idea why, will unassign for now.

thijsjanzen commented 5 years ago

I don't know why these values were hardcoded - with the new random number generator, it seems that ape::rcoal no longer generates the same trees with the given seed as before.

However, alternatively it could be that @richelbilderbeek independently, outside R, verified the nLTT between these trees and hardcoded that outcome. If this is not the case, I will update the hardcoded values to what we get now (but that kind of defies the purpose of the test).