tests/testthat/test-sequence_to_codons.R

test_that("codons are always three long", {
  expect_equal(
    all(
      sapply(
        sequence_to_codons("AUUGUCUAAA", start=1),
        nchar
      ) == 3
    ), TRUE)
  expect_equal(
    all(
      sapply(
        sequence_to_codons("AUUGUCUAAAA", start=1),
        nchar
      ) == 3
    ), TRUE)
  expect_equal(
    all(
      sapply(
        sequence_to_codons("AUUGUCUAAAAA", start=1),
        nchar
      ) == 3
    ), TRUE)
})

test_that("the reading frame index works", {
  expect_equal(sequence_to_codons("AUUCG", start=1), c("AUU"))
  expect_equal(sequence_to_codons("AUUCG", start=2), c("UUC"))
  expect_equal(sequence_to_codons("AUUCG", start=3), c("UCG"))
})
rforbiodatascience22/group_5_package documentation built on April 7, 2022, 8:20 p.m.