From 8d76f90567e72235e1e44c9248f0e02727a3101b Mon Sep 17 00:00:00 2001 From: Mike Smith Date: Mon, 5 Feb 2024 15:54:06 +0100 Subject: [PATCH] Remove diagnostic printing --- src/H5D.c | 6 +----- tests/testthat/test_roundtrip.R | 15 ++++++--------- 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/src/H5D.c b/src/H5D.c index bf018f3..aaad22c 100644 --- a/src/H5D.c +++ b/src/H5D.c @@ -701,9 +701,7 @@ SEXP H5Dread_helper_COMPLEX(hid_t dataset_id, hid_t file_space_id, hid_t mem_spa if(herr < 0) { error("Unable to read dataset"); } - - Rprintf("Native: %d\n", native); - + if (native) PERMUTE(Rval, COMPLEX, mem_space_id); @@ -719,8 +717,6 @@ SEXP H5Dread_helper_COMPOUND(hid_t dataset_id, hid_t file_space_id, hid_t mem_sp SEXP Rval; if(is_complex(dtype_id)) { - Rprintf("Native: %d\n", native); - Rprintf("is complex\n"); Rval = H5Dread_helper_COMPLEX(dataset_id, file_space_id, mem_space_id, n, Rdim, dtype_id, native); return(Rval); } diff --git a/tests/testthat/test_roundtrip.R b/tests/testthat/test_roundtrip.R index 405b215..b6ae830 100644 --- a/tests/testthat/test_roundtrip.R +++ b/tests/testthat/test_roundtrip.R @@ -57,15 +57,12 @@ test_that("UTF-8 strings are preserved", { test_that("Complex numbers are writen to a compound datatype", { - mat <- matrix(as.complex(1:9), ncol = 3) + mat <- matrix(complex(length.out = 30, real = 1:30, imaginary = 30:1), ncol = 10) expect_silent(h5write(obj = mat, file = h5file, name = 'complex')) - ## we don't expect to get back a complex number at the moment - ## We should get a list of length 2 containing the real and imaginary parts - expect_silent(res <- h5read(file = h5file, name = 'complex', - compoundAsDataFrame = FALSE)) - expect_is(res, 'list') - expect_named(res, expected = c('r','i')) - expect_identical(res$r, Re(mat)) - expect_identical(res$i, Im(mat)) + expect_silent(res <- h5read(file = h5file, name = 'complex')) + expect_is(res, 'matrix') + expect_type(res, 'complex') + expect_identical(res, mat) + expect_identical(h5read(file = h5file, name = 'complex', native = TRUE), t(mat)) })