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")))
})
michbur/biogram documentation built on Feb. 4, 2024, 6:38 p.m.