tests/testthat/test_nuclPerm.R

# BUM-HMM
# Copyright (C) 2016 Alina Selega

context("Generating nucleobase patterns")

test_that("function generates nucleobase patterns of length n", {
    expect_equal(nchar(nuclPerm(1)[1]), 1)
    expect_equal(nchar(nuclPerm(2)[1]), 2)
    expect_equal(all(sapply(nuclPerm(2), function(x) nchar(x) == 2)), TRUE)
})

test_that("function asks for positive length", {
    expect_error(nuclPerm(0),
                 "The length of patterns provided is not a positive number.")
    expect_error(nuclPerm(-1),
                 "The length of patterns provided is not a positive number.")
})
alinaselega/BUMHMM documentation built on March 2, 2024, 10 p.m.