tests/testthat/test-which_antichain.R

test_that("which_antichain", {
    expect_equal(which_antichain(list()),
                 integer(0))
    expect_equal(which_antichain(list(1, 2, 3)),
                 c(1, 2, 3))
    expect_equal(which_antichain(list(1, 1, 2)),
                 c(1, 3))
    expect_equal(which_antichain(list(c(1, 2, 5), 1, 2, 5, c(5, 2), 7)),
                 c(1, 6))
    expect_equal(which_antichain(list(c(1, 2), c(1, 3), c(4, 2), 1, 2, 3, 4)),
                 c(1, 2, 3))

    expect_equal(which_antichain(list(c(1, 2, 3), c(1, 4), c(1, 2, 5, 6), c(1, 5, 6)),
                                 1),
                 c(1, 4))
})

Try the nuggets package in your browser

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

nuggets documentation built on April 3, 2025, 8:07 p.m.