tests/testthat/test-check_spectra.R

# WARNING - Generated by {fusen} from dev/import-data.Rmd: do not edit by hand

test_that("check_spectra works", {
  expect_type(
    check_spectra(
      c(MALDIquant::createMassSpectrum(1:3, 1:3), MALDIquant::createMassSpectrum(11:13, 11:13))
    ), "list"
  )
})
test_that("check_spectra warns with empty spectra", {
  expect_message(
    check_spectra(c(MALDIquant::createMassSpectrum(mass = 0, intensity = 0))),
    "Some spectra are incorrect"
  )
})
uneven_size <- c(MALDIquant::createMassSpectrum(1:3, 1:3),
                 MALDIquant::createMassSpectrum(10:13, 10:13)
                 )
test_that("check_spectra works with tolerance argument",{
  expect_message(
    out <- check_spectra(uneven_size),
    "Some spectra are incorrect"
  )
  expect_identical(
    out$is_outlier_length,
    c(FALSE, TRUE)
  )
  expect_no_message(
    out_tolerance <- check_spectra(uneven_size, tolerance = 1)
  )
  expect_identical(
    out_tolerance$is_outlier_length,
    c(FALSE, FALSE)
  )
})

Try the maldipickr package in your browser

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

maldipickr documentation built on Sept. 13, 2024, 1:12 a.m.