tests/testthat/test_random_classifier.R

context('Random Classifier')

test_that('The random classifier works', {
  bin <- DNAStringSet(c(rep('AA', 5), rep('CC', 10), 
                        rep('GG', 2), rep('TT', 1)))
  classified <- classify_bin_random(bin, 0.25)
  expect_that(check_classification(bin, classified), is_true())
  expect_that(length(classified$src) > 0, is_true())
  expect_that(length(classified$out) > 0, is_true())

  classified <- classify_bin(bin, technique='random', params=list(n= 0.25))
  expect_that(check_classification(bin, classified), is_true())
  expect_that(length(classified$src) > 0, is_true())
  expect_that(length(classified$out) > 0, is_true())

  classified <- classify_bin_random(bin, 0)
  expect_that(check_classification(bin, classified), is_true())
  expect_that(length(classified$out) == 0, is_true())
})
philliplab/MotifBinner documentation built on Sept. 2, 2020, 11:41 a.m.