context("Reading sample XML file")
mriFile = system.file("extdata", "testMRIZH.xml", package = "Dmrixml")
ScanTests = function(mri){
expect_true(is.character(mri$Scan$Initials))
expect_true(is.integer(mri$Scan$RandNo))
expect_is(mri$Scan$RecordDate,"POSIXct")
expect_true(is.numeric(mri$Scan$resolutionX))
expect_true(is.numeric(mri$Scan$resolutionY))
expect_true(is.numeric(mri$Scan$resolutionZ))
}
test_that("Scan parameters from ReadMRIXML must have correct type", {
mri = ReadMRIXML(mriFile)
ScanTests(mri)
})
test_that("Scan parameters from ReadMRIXMLxyz must have correct type", {
mri = ReadMRIXMLxyz(mriFile)
ScanTests(mri)
})
SliceTests = function(mri){
expect_is(mri$Slices,"data.frame")
expect_equal(ncol(mri$Slices),5)
expect_true(nrow(mri$Slices) >= 1)
}
test_that("Slices and Voxels from ReadMRIXML must be non-empty data frames", {
mri = ReadMRIXML(mriFile)
SliceTests(mri)
expect_is(mri$Voxels,"data.frame")
expect_true(nrow(mri$Voxels) >1)
expect_equal(ncol(mri$Voxels),4)
})
test_that("Voxels from ReadMRIXMLxyz must be non-empty data frames", {
mri = ReadMRIXMLxyz(mriFile)
expect_is(mri$Voxels,"data.frame")
expect_equal(ncol(mri$Voxels),5)
expect_true(nrow(mri$Voxels) >1)
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.