Skip to content

Commit

Permalink
add unit test for monoisotopicPeaks
Browse files Browse the repository at this point in the history
  • Loading branch information
sgibb committed Apr 3, 2016
1 parent 1197cf4 commit aba87ee
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/testthat/test_monoisotopicPeaks-methods.R
@@ -0,0 +1,18 @@
context("monoisotopicPeaks")

p <- createMassPeaks(mass=995:1005,
intensity=c(100, 10, 30, 10, 40, 550, 330, 110, 10, 5, 15))
m <- createMassPeaks(mass=1000, intensity=550)

test_that("monoisotopicPeaks", {
expect_equal(monoisotopicPeaks(p), m)
})

test_that("detectPeaks works with list of MassPeaks objects", {
expect_error(monoisotopicPeaks(list(x=1, y=1)),
"no list of MALDIquant::MassPeaks objects")
expect_error(monoisotopicPeaks(list(createMassSpectrum(1, 1),
createMassSpectrum(1, 1)),
"no list of MALDIquant::MassPeaks objects"))
expect_equal(monoisotopicPeaks(list(p, p)), list(m, m))
})

0 comments on commit aba87ee

Please sign in to comment.