Nothing
# ==============================================================================
# Reading objects written by other software. files/foreign.h5 is generated by
# scripts/foreign_fixture.c.
# ==============================================================================
ff <- "files/foreign.h5"
if (!file.exists(ff)) exit_file("files/foreign.h5 not found")
local({
#test_that("dimension scales with the wrong length are ignored", {
n_open <- h5lite:::open_id_count()
# A partial read past the end of a too-short scale used to crash R
expect_equal(h5_read(ff, "short_scale", start = 3, count = 3), c(3, 4, 5))
expect_null(names(h5_read(ff, "short_scale")))
expect_equal(h5_read(ff, "long_scale"), c(1, 2, 3))
expect_equal(h5_read(ff, "mat_short_scale"), matrix(c(1, 4, 2, 5, 3, 6), 2))
expect_equal(h5lite:::open_id_count(), n_open)
})
local({
#test_that("full-width NULLPAD and SPACEPAD strings keep every character", {
expect_equal(h5_read(ff, "str_nullpad"), c("abcd", "ab"))
expect_equal(h5_read(ff, "str_spacepad"), c("ab", "abcde"))
df <- h5_read(ff, "cmpd_pad", as = c(e = "null"))
expect_equal(df$s, c("abcd", "xy"))
expect_equal(h5_read(ff, "cmpd_pad", attr = "label"), c("wxyz", "ab"))
})
local({
#test_that("enum values with no matching member read as NA", {
res <- h5_read(ff, "enum_bad")
expect_inherits(res, "factor")
expect_equal(as.character(res), c("MID", NA, "LOW", "HIGH"))
df <- h5_read(ff, "cmpd_pad")
expect_equal(as.character(df$e), c("hi", NA))
})
local({
#test_that("attributes named like R's structural attributes are not applied", {
expect_equal(h5_read(ff, "attr_dim"), c(1, 2, 3))
expect_equal(h5_read(ff, "attr_class"), c(1, 2, 3))
expect_equal(h5_read(ff, "attr_class", attr = "class"), "foo")
})
local({
#test_that("uint64 values beyond int64 become NA with a warning", {
if (!requireNamespace("bit64", quietly = TRUE)) exit_file("bit64 not installed")
expect_warning(res <- h5_read(ff, "uint64_big", as = "bit64"), "int64")
expect_equal(is.na(res), c(TRUE, FALSE))
expect_equal(as.character(res[2]), "7")
})
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.