tests/testthat/test-partitions.R

context("partitions()")

test_that("basic partitions() functionality works", {
  expect_equal(
    partitions(3), 
    structure(c(3L, 2L, 1L, 0L, 1L, 1L, 0L, 0L, 1L), .Dim = c(3L, 3L))
  )
})


test_that("vectorized", {
  expect_equal(
    partitions(1:3), 
    list(
      structure(1L, .Dim = c(1L, 1L)), 
      structure(c(2L, 1L, 0L, 1L), .Dim = c(2L, 2L)), 
      structure(c(3L, 2L, 1L, 0L, 1L, 1L, 0L, 0L, 1L), .Dim = c(3L, 3L))
    )
  )
})

Try the mpoly package in your browser

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

mpoly documentation built on March 26, 2020, 7:33 p.m.