Skip to content

Commit

Permalink
Add runinfo and instrumentinfo to test_cdf
Browse files Browse the repository at this point in the history
  • Loading branch information
sneumann committed Sep 11, 2018
1 parent dfbd825 commit 1875682
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 0 deletions.
18 changes: 18 additions & 0 deletions inst/unitTests/Makefile
@@ -0,0 +1,18 @@
TOP=../..
PKG=${shell cd ${TOP};pwd}
SUITE=runTests.R
R=R

all: inst test

inst: # Install package
cd ${TOP}/..;\
${R} CMD INSTALL ${PKG}

test: # Run unit tests
export RCMDCHECK=FALSE;\
cd ${TOP}/tests;\
${R} --vanilla --slave < ${SUITE}

clean:
rm -f report.html reportSummary.txt report.txt *~
36 changes: 36 additions & 0 deletions inst/unitTests/test_cdf.R
Expand Up @@ -30,6 +30,30 @@ test_peaks <- function() {

p <- peaks(cdf,2:3)
checkTrue(length(p)==2)

p <- peaks(cdf,1278)
checkTrue(ncol(p)==2)
checkTrue(nrow(p)==40)

## Can we check that this indeed throws an error:
## Error in seq.default(rawdata$scanindex[scans] + 1, min(rawdata$scanindex[scans + : 'from' must be a finite number
## p <- peaks(cdf,1279)


ri1 <- list(scanCount = 1278L, lowMz = 200, highMz = 600,
dStartTime = 2501.378, dEndTime = 4499.824,
msLevels = NA, startTimeStamp = "2004,06,01,10:28:03+0800")
ri2 <- runInfo(cdf)
checkTrue(all.equal(ri1, ri2))

ii1 <- list(model = " ",
manufacturer = "Agilent Technologies",
ionisation = "Electrospray Ionization",
detector = "Conversion Dynode Electron Multiplier",
analyzer = NA)
ii2 <- instrumentInfo(cdf)

checkTrue(all.equal(ii1, ii2))

close(cdf)
}
Expand Down Expand Up @@ -84,3 +108,15 @@ test_chromatogramHeader <- function() {
checkTrue(nrow(ch) == 0)
close(x)
}


if (FALSE) {
suite <- RUnit::defineTestSuite(name = paste("mzR", "RUnit Tests"),
dirs = "/vol/R/BioC/devel/mzR/inst/unitTests",
testFileRegexp = "^test_.*\\.R$", rngKind = "default",
rngNormalKind = "default")

result <- RUnit::runTestSuite(suite)
RUnit::printTextProtocol(result, showDetails = FALSE)

}

0 comments on commit 1875682

Please sign in to comment.