| 77 | } |
| 78 | |
| 79 | void write_array_1( |
| 80 | const Context& ctx, |
| 81 | const std::string& array_name, |
| 82 | std::vector<char>& dim1, |
| 83 | bool allow_dups = false) { |
| 84 | VFS vfs(ctx); |
| 85 | |
| 86 | if (vfs.is_dir(array_name)) |
| 87 | vfs.remove_dir(array_name); |
| 88 | |
| 89 | // Define a sparse, 3D array where the first and third dimension is a string. |
| 90 | Domain domain(ctx); |
| 91 | domain |
| 92 | .add_dimension( |
| 93 | Dimension::create(ctx, "dim1", TILEDB_STRING_ASCII, nullptr, nullptr)) |
| 94 | .add_dimension(Dimension::create<int32_t>(ctx, "dim2", {{0, 9}}, 10)) |
| 95 | .add_dimension(Dimension::create( |
| 96 | ctx, "dim3", TILEDB_STRING_ASCII, nullptr, nullptr)); |
| 97 | ArraySchema schema(ctx, TILEDB_SPARSE); |
| 98 | schema.set_domain(domain).set_order({{TILEDB_ROW_MAJOR, TILEDB_ROW_MAJOR}}); |
| 99 | schema.add_attribute(Attribute::create<int32_t>(ctx, "a1")); |
| 100 | if (allow_dups) |
| 101 | schema.set_allows_dups(true); |
| 102 | Array::create(array_name, schema); |
| 103 | |
| 104 | // Write data to the array. |
| 105 | // one of the following provided by parameter. |
| 106 | std::vector<uint64_t> dim1_offsets = {0, 1, 3, 4, 5, 7}; |
| 107 | std::vector<int32_t> dim2 = {1, 1, 1, 2, 2, 2}; |
| 108 | std::vector<char> dim3 = {'g', 'h', 'h', 'i', 'j', 'k', 'k', 'l'}; |
| 109 | std::vector<uint64_t> dim3_offsets = {0, 1, 3, 4, 5, 7}; |
| 110 | std::vector<int32_t> a1_data = {1, 2, 3, 4, 5, 6}; |
| 111 | Array array_write(ctx, array_name, TILEDB_WRITE); |
| 112 | Query query_write(ctx, array_write, TILEDB_WRITE); |
| 113 | query_write.set_layout(TILEDB_UNORDERED) |
| 114 | .set_data_buffer("a1", a1_data) |
| 115 | .set_data_buffer("dim1", dim1) |
| 116 | .set_offsets_buffer("dim1", dim1_offsets) |
| 117 | .set_data_buffer("dim2", dim2) |
| 118 | .set_data_buffer("dim3", dim3) |
| 119 | .set_offsets_buffer("dim3", dim3_offsets); |
| 120 | |
| 121 | // Perform the write and close the array. |
| 122 | query_write.submit(); |
| 123 | array_write.close(); |
| 124 | } |
| 125 | |
| 126 | TEST_CASE( |
| 127 | "C++ API: Test infinite string splits", |
no test coverage detected