Skip to content

Commit

Permalink
test: removed the test_Indexed_as_IndexedOption test
Browse files Browse the repository at this point in the history
  • Loading branch information
zonca committed Dec 7, 2023
1 parent d4cdb70 commit 8134911
Showing 1 changed file with 0 additions and 54 deletions.
54 changes: 0 additions & 54 deletions header-only/tests/test_1494-layout-builder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1266,60 +1266,6 @@ test_Indexed() {
assert(builder.length() == 0);
}

void
test_Indexed_as_IndexedOption() {
IndexedOptionBuilder<uint32_t, NumpyBuilder<double>> builder;
assert(builder.length() == 0);

auto& subbuilder = builder.append_valid();
subbuilder.append(1.1);

builder.append_valid();
subbuilder.append(2.2);

double data[3] = {3.3, 4.4, 5.5};

builder.extend_valid(3);
subbuilder.extend(data, 3);

// [1.1, 2.2, 3.3, 4.4, 5.5]

std::string error;
assert(builder.is_valid(error) == true);

std::map<std::string, size_t> names_nbytes = {};
builder.buffer_nbytes(names_nbytes);
assert(names_nbytes.size() == 2);

auto buffers = empty_buffers(names_nbytes);
builder.to_buffers(buffers);

std::ostringstream out;
dump(out,
"node0-index", (uint32_t*)buffers["node0-index"], names_nbytes["node0-index"]/sizeof(uint32_t),
"node1-data", (double*)buffers["node1-data"], names_nbytes["node1-data"]/sizeof(double));

std::string check{"node0-index: 0 1 2 3 4 \n"
"node1-data: 1.1 2.2 3.3 4.4 5.5 \n"};
assert(out.str().compare(check) == 0);

assert(builder.form() ==
"{ "
"\"class\": \"IndexedOptionArray\", "
"\"index\": \"u32\", "
"\"content\": { "
"\"class\": \"NumpyArray\", "
"\"primitive\": \"float64\", "
"\"form_key\": \"node1\" "
"}, "
"\"form_key\": \"node0\" "
"}");

clear_buffers(buffers);
builder.clear();
assert(builder.length() == 0);
}

void
test_IndexedOption() {
IndexedOptionBuilder<int32_t, NumpyBuilder<double>> builder;
Expand Down

0 comments on commit 8134911

Please sign in to comment.