tests/testthat/test_is_ngram.R

context("n-gram validation")

test_that("Real n-grams",{
  
  #n-gram with position information
  expect_true(is_ngram("1_1.1.1_0.0"))
  
  #n-gram without position information
  expect_true(is_ngram("1.1.1_0.0"))
  
  #False n-grams
  
  #n-gram with position information but no distance
  expect_false(is_ngram("1_1.1.1"))
})

test_that("Totally wrong n-grams",{
  
  expect_false(is_ngram("a"))
  
  expect_false(is_ngram(list("a")))
})

Try the biogram package in your browser

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

biogram documentation built on March 31, 2020, 5:14 p.m.