tests/testthat/test_checks.R

test_that("isPeaksMatrix", {
    expect_false(isPeaksMatrix(1:2))
    expect_false(isPeaksMatrix(matrix(1:3, nrow = 1)))
    expect_false(isPeaksMatrix(matrix(1:2, ncol = 2)))
    expect_false(isPeaksMatrix(cbind(foo = 1, bar = 2)))
    expect_false(isPeaksMatrix(cbind(mz = 1, bar = 2)))
    expect_false(isPeaksMatrix(cbind(mz = "A", intensity = "B")))
    expect_false(isPeaksMatrix(cbind(mz = 2:1, intensity = 2:1)))
    expect_true(isPeaksMatrix(cbind(mz = 1:2, intensity = 1:2)))
})
rformassspectrometry/MsCoreUtils documentation built on Oct. 24, 2024, 1:52 p.m.