R Under development (unstable) (2023-12-12 r85669 ucrt) -- "Unsuffered Consequences" Copyright (C) 2023 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. > ## rmatio, a R interface to the C library matio, MAT File I/O Library. > ## Copyright (C) 2013-2023 Stefan Widgren > ## > ## This program is free software: you can redistribute it and/or modify > ## it under the terms of the GNU General Public License as published by > ## the Free Software Foundation, either version 3 of the License, or > ## (at your option) any later version. > ## > ## rmatio is distributed in the hope that it will be useful, > ## but WITHOUT ANY WARRANTY; without even the implied warranty of > ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > ## GNU General Public License for more details. > ## > ## You should have received a copy of the GNU General Public License > ## along with this program. If not, see . > > library(rmatio) > > ## For debugging > sessionInfo() R Under development (unstable) (2023-12-12 r85669 ucrt) Platform: x86_64-w64-mingw32/x64 Running under: Windows Server 2022 x64 (build 20348) Matrix products: default locale: [1] LC_COLLATE=C LC_CTYPE=German_Germany.utf8 [3] LC_MONETARY=C LC_NUMERIC=C [5] LC_TIME=C time zone: Europe/Berlin tzcode source: internal attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] rmatio_0.19.0 loaded via a namespace (and not attached): [1] compiler_4.4.0 Matrix_1.6-4 grid_4.4.0 lattice_0.22-5 > > ## If everything works as expected, no data are written to file... > filename <- tempfile(fileext = ".mat") > > ## > ## Argument checking > ## > ## Check that the function write.mat stop if not the expected > ## arguments are given > ## > > ## > ## "filename" must be a character vector of length one > ## > tools::assertError(write.mat(list(a = 1:5), filename = NULL)) > tools::assertError(write.mat(list(a = 1:5), filename = 5)) > tools::assertError(write.mat(list(a = 1:5), filename = c("a", "b"))) > tools::assertError(write.mat(list(a = 1:5), filename = "")) > > ## > ## "compression" must be a logical vector of length one > ## > tools::assertError(write.mat(list(a = 1:5), + filename = filename, + compression = NULL)) > tools::assertError(write.mat(list(a = 1:5), + filename = filename, + compression = 5)) > tools::assertError(write.mat(list(a = 1:5), + filename = filename, + compression = c(TRUE, TRUE))) > tools::assertError(write.mat(list(a = 1:5), + filename = filename, + compression = logical(0))) > > ## > ## All values in the list must have a unique name > ## > tools::assertError(write.mat(list(1:5), + filename = filename, + compression = FALSE)) > tools::assertError(write.mat(list(a = 1:5, 6:10), + filename = filename, + compression = FALSE)) > tools::assertError(write.mat(list(a = 1:5, a = 6:10), + filename = filename, + compression = FALSE)) > > ## Make sure the file is removed in case test failure and data are > ## written... > unlink(filename) > > proc.time() user system elapsed 0.87 0.06 0.93