tests/testthat/test-tidy_comb.R

context("tidy_comb")

test_that("tidy combination all works on list", {
  df <- tidy_comb_all(LETTERS[1:3])
  expect_equal(nrow(df), 3)
  expect_equal(ncol(df), 2)
  expect_true(inherits(df, "tbl_df"))
  expect_true(inherits(df, "tbl"))
  expect_true(inherits(df, "data.frame"))
})

test_that("tidy combination works on list", {
  df <- tidy_comb("a", LETTERS[1:3])
  expect_equal(nrow(df), 3)
  expect_equal(ncol(df), 2)
  expect_true(inherits(df, "tbl_df"))
  expect_true(inherits(df, "tbl"))
  expect_true(inherits(df, "data.frame"))
})

test_that("tidy combination all works on data.frame", {
  df <- tidy_comb_all(iris, Species)
  expect_equal(nrow(df), 3)
  expect_equal(ncol(df), 2)
  expect_true(inherits(df, "tbl_df"))
  expect_true(inherits(df, "tbl"))
  expect_true(inherits(df, "data.frame"))
})

test_that("tidy combination works on data.frame", {
  df <- tidy_comb(iris, "this", Species)
  expect_equal(nrow(df), 3)
  expect_equal(ncol(df), 2)
  expect_true(inherits(df, "tbl_df"))
  expect_true(inherits(df, "tbl"))
  expect_true(inherits(df, "data.frame"))
})

Try the tidystringdist package in your browser

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

tidystringdist documentation built on Nov. 22, 2018, 5:04 p.m.