tests/testthat/test_lexicon_size.R

library(RcppCWB)
use_tmp_registry()
testthat::context("cl_lexicon_size")

test_that(
  "lexicon size",
  {
    N <- cl_lexicon_size(
      corpus = "REUTERS",
      p_attribute = "word",
      registry = get_tmp_registry()
    )
    expect_equal(N, 1192)
  }
)

test_that(
  "lexicon size works for experimental functionality",
  {
    old <- cl_lexicon_size(
      corpus = "REUTERS",
      p_attribute = "word",
      registry = get_tmp_registry()
    )
    new <- p_attr_lexicon_size(
      p_attr("REUTERS", "word", registry = get_tmp_registry())
    )
    expect_identical(old, new)
  }
)

Try the RcppCWB package in your browser

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

RcppCWB documentation built on Sept. 24, 2024, 1:08 a.m.