R version 4.4.0 beta (2024-04-12 r86413 ucrt) -- "Puppy Cup" Copyright (C) 2024 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > # Test constructors > > library(testthat) > library(SPUTNIK) > > # msiDataset > > imageShape <- c(100, 100) > numPixels <- prod(imageShape) > numPeaks <- 500 > mzVector <- sort(sample(seq(150, 1000), numPeaks)) > print(is.numeric(mzVector)) [1] TRUE > print(is.array(mzVector)) [1] FALSE > randIntensity <- matrix(rnorm(numPixels * numPeaks), numPixels, numPeaks) > > test_that("msi.dataset constructor", { + msX <- msiDataset( + values = randIntensity, mz = mzVector, rsize = imageShape[1], + csize = imageShape[2] + ) + expect_s4_class(msX, "msi.dataset") + }) Creating msiDataset object... Detecting constant peaks... Generating image of detected peaks... Generating total-ion-count image... Test passed 🎉 > > # msImage > > randPixels <- matrix(rnorm(numPixels), imageShape[1], imageShape[2]) > > test_that("ms.image constructor", { + msIm <- msImage(values = randPixels, name = "Test", scale = TRUE) + expect_s4_class(msIm, "ms.image") + }) Test passed 🌈 > > # peakFilter > > numKeep <- 100 > keepIdx <- sample(numPeaks, numKeep) > names(keepIdx) <- mzVector[keepIdx] > > test_that("peak.filter constructor", { + filt <- createPeaksFilter(peaksIndices = keepIdx) + expect_is(filt, "list") + expect_equal(attr(filt, "peak.filter"), TRUE) + expect_equal(attr(filt, "filter"), "custom") + }) Test passed 🥇 > > proc.time() user system elapsed 3.00 0.42 3.40