Skip to content

Commit

Permalink
unit-test cases for UINT32 attribute get/set fill value
Browse files Browse the repository at this point in the history
  • Loading branch information
johnkerl committed Jan 7, 2022
1 parent 8fe730b commit c3dbb65
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
13 changes: 13 additions & 0 deletions inst/tinytest/test_attr.R
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,19 @@ val <- arr[]
expect_equal(val, array(rep(42, 4)))
expect_equal(tiledb_attribute_get_fill_value(attr), 42)

dom <- tiledb_domain(dims = tiledb_dim("rows", c(1L, 4L), 4L, "UINT32"))
attr <- tiledb_attr("a", type = "UINT32")
tiledb_attribute_set_fill_value(attr, 42L)
sch <- tiledb_array_schema(dom, attr)
uri <- tempfile()
if (dir.exists(uri)) unlink(uri, recursive=TRUE)
tiledb_array_create(uri, sch)
arr <- tiledb_dense(uri)
val <- arr[]
## when fill value has been set, expect value
expect_equal(val, array(rep(42, 4)))
expect_equal(tiledb_attribute_get_fill_value(attr), 42)

attr <- tiledb_attr("b", type = "CHAR", ncells = NA)
tiledb_attribute_set_fill_value(attr, "abc")
sch <- tiledb_array_schema(dom, attr)
Expand Down
9 changes: 9 additions & 0 deletions inst/tinytest/test_libtiledb.R
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,15 @@ attr <- tiledb:::libtiledb_attribute(ctx, "a1", "INT32", filter_list, 1, FALSE)
expect_true(is(attr, "externalptr"))
#})

#test_that("basic integer libtiledb_attr constructor works", {
##ctx <- tiledb:::libtiledb_ctx()
ctx <- tiledb_get_context()@ptr
filter <- tiledb:::libtiledb_filter(ctx, "NONE")
filter_list <- tiledb:::libtiledb_filter_list(ctx, c(filter))
attr <- tiledb:::libtiledb_attribute(ctx, "a1", "UINT32", filter_list, 1, FALSE)
expect_true(is(attr, "externalptr"))
#})

#test_that("basic float64 libtiledb_attr constructor works", {
##ctx <- tiledb:::libtiledb_ctx()
ctx <- tiledb_get_context()@ptr
Expand Down

0 comments on commit c3dbb65

Please sign in to comment.