Skip to content

Commit

Permalink
test l2cons
Browse files Browse the repository at this point in the history
  • Loading branch information
ms609 committed Jun 27, 2024
1 parent 56e587d commit be46537
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions tests/testthat/test-information.R
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,20 @@ test_that("TreesConsistentWithTwoSplits works", {

Test <- function(n, a, b, score) {
logScore <- log(score)
l2Score <- log2(score)

expect_equal(score, TreesConsistentWithTwoSplits(n, a, b))
expect_equal(score, TreesConsistentWithTwoSplits(n, b, a))
expect_equal(score, TreesConsistentWithTwoSplits(n, n - a, n - b))
expect_equal(score, TreesConsistentWithTwoSplits(n, n - b, n - a))
expect_equal(logScore, LnTreesConsistentWithTwoSplits(n, a, b))
expect_equal(logScore, LnTreesConsistentWithTwoSplits(n, b, a))
expect_equal(logScore, LnTreesConsistentWithTwoSplits(n, n - a, n - b))
expect_equal(logScore, LnTreesConsistentWithTwoSplits(n, n - b, n - a))
expect_equal(TreesConsistentWithTwoSplits(n, a, b), score)
expect_equal(TreesConsistentWithTwoSplits(n, b, a), score)
expect_equal(TreesConsistentWithTwoSplits(n, n - a, n - b), score)
expect_equal(TreesConsistentWithTwoSplits(n, n - b, n - a), score)
expect_equal(Log2TreesConsistentWithTwoSplits(n, a, b), l2Score)
expect_equal(Log2TreesConsistentWithTwoSplits(n, b, a), l2Score)
expect_equal(Log2TreesConsistentWithTwoSplits(n, n - a, n - b), l2Score)
expect_equal(Log2TreesConsistentWithTwoSplits(n, n - b, n - a), l2Score)
expect_equal(LnTreesConsistentWithTwoSplits(n, a, b), logScore)
expect_equal(LnTreesConsistentWithTwoSplits(n, b, a), logScore)
expect_equal(LnTreesConsistentWithTwoSplits(n, n - a, n - b), logScore)
expect_equal(LnTreesConsistentWithTwoSplits(n, n - b, n - a), logScore)
}

Test(8, 3, 0, 315)
Expand Down

0 comments on commit be46537

Please sign in to comment.