Skip to content

Commit

Permalink
Remove diagnostic printing
Browse files Browse the repository at this point in the history
  • Loading branch information
grimbough committed Feb 5, 2024
1 parent 193c48e commit 8d76f90
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 14 deletions.
6 changes: 1 addition & 5 deletions src/H5D.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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);
}
Expand Down
15 changes: 6 additions & 9 deletions tests/testthat/test_roundtrip.R
Original file line number Diff line number Diff line change
Expand Up @@ -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))
})

0 comments on commit 8d76f90

Please sign in to comment.