tests/testthat/test-age.apply.R

context("Test: age.apply() ")

# adapted from: https://github.com/hadley/dplyr/blob/master/tests/testthat/test-arrange.r
equal_df <- function(df1, df2) {
        rownames(df1) <- NULL
        rownames(df2) <- NULL
        isTRUE(all.equal(df1, df2))
}

data(PhyloExpressionSetExample)
data(DivergenceExpressionSetExample)

nonStandardExpressionSet <- PhyloExpressionSetExample[ , 2:9]

test_that("is.ExpressionSet() throughs error when no ExpressionSet is entered to age.apply()",
          {
                  expect_error(
                          age.apply(nonStandardExpressionSet , RE)
                  )
          })

test_that("age.apply() + RE equals REMatrix() for PhyloExpressionSetExample",
          {
                  expect_true(equal_df(
                          age.apply(PhyloExpressionSetExample, RE)
                          ,
                          REMatrix(PhyloExpressionSetExample)
                  ))
                  
          })

test_that("age.apply() + RE equals REMatrix() for DivergenceExpressionSetExample",
          {
                  expect_true(equal_df(
                          age.apply(DivergenceExpressionSetExample, RE)
                          ,
                          REMatrix(DivergenceExpressionSetExample)
                  ))
                  
          })

Try the myTAI package in your browser

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

myTAI documentation built on Feb. 24, 2021, 9:06 a.m.