Skip to content

Commit

Permalink
Added unit test for previous bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
LaurentGatto committed Feb 16, 2016
1 parent ecaaa32 commit 77515b9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
CHANGES IN VERSION 1.19.13
--------------------------
o Fixed bug in bin_Spectrum, reported by Weibo Xie <2016-02-16 Tue>
o Added unit test for bug above <2016-02-16 Tue>

CHANGES IN VERSION 1.19.12
--------------------------
Expand Down
12 changes: 12 additions & 0 deletions tests/testthat/test_Spectrum.R
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,18 @@ test_that("bin_Spectrum", {
})


test_that("bin_Spectrum - bug fix #ecaaa324505b17ee8c4855806f7e37f14f1b27b8", {
s <- new("Spectrum2", mz=c(1:7, 55, 78, 100), intensity=1:10)
s2 <- bin(s)
expect_equal(mz(s2), c(seq(1.5, 100, 1), 100))
ires <- rep(0, peaksCount(s2))
ires[peaksCount(s2)] <- intensity(s)[peaksCount(s)]
ires[1:7] <- 1:7
ires[55] <- 8
ires[78] <- 9
expect_equal(intensity(s2), ires)
})

test_that("removePeaks profile vs centroided", {
int <- c(2,0,0,0,1,5,1,0,0,1,3,1,0,0,1,4,2,1)
sp1 <- new("Spectrum2",
Expand Down

0 comments on commit 77515b9

Please sign in to comment.