@@ -1198,6 +1198,73 @@ TEST_CASE(
11981198 vfs.remove_dir (array_name);
11991199}
12001200
1201+ TEST_CASE (
1202+ " C++ API: Writing single byte cell with global order" ,
1203+ " [cppapi][std::byte]" ) {
1204+ bool serialize = false , refactored_query_v2 = false ;
1205+ const std::string array_name = " cpp_unit_array" ;
1206+
1207+ Context ctx;
1208+ VFS vfs (ctx);
1209+ if (vfs.is_dir (array_name)) {
1210+ vfs.remove_dir (array_name);
1211+ }
1212+
1213+ // Create
1214+ Domain domain (ctx);
1215+ domain.add_dimension (Dimension::create<int >(ctx, " rows" , {{0 , 0 }}, 1 ));
1216+ ArraySchema schema (ctx, TILEDB_DENSE);
1217+ schema.set_domain (domain).set_order ({{TILEDB_ROW_MAJOR, TILEDB_ROW_MAJOR}});
1218+ schema.add_attribute (
1219+ Attribute::create (ctx, " a" , tiledb_datatype_t ::TILEDB_BLOB));
1220+ Array::create (array_name, schema);
1221+
1222+ // Write
1223+ std::byte data_w{1 };
1224+ Array array_w (ctx, array_name, TILEDB_WRITE);
1225+ Query query_w (ctx, array_w);
1226+ query_w.set_layout (TILEDB_GLOBAL_ORDER).set_data_buffer (" a" , &data_w, 1 );
1227+
1228+ SECTION (" no serialization" ) {
1229+ serialize = false ;
1230+ }
1231+ #ifdef TILEDB_SERIALIZATION
1232+ SECTION (" serialization enabled global order write" ) {
1233+ serialize = true ;
1234+ refactored_query_v2 = GENERATE (true , false );
1235+ }
1236+ #endif
1237+
1238+ // Submit query
1239+ test::ServerQueryBuffers server_buffers_;
1240+ auto rc = test::submit_query_wrapper (
1241+ ctx,
1242+ array_name,
1243+ &query_w,
1244+ server_buffers_,
1245+ serialize,
1246+ refactored_query_v2);
1247+ REQUIRE (rc == TILEDB_OK);
1248+ array_w.close ();
1249+
1250+ // Read
1251+ Array array (ctx, array_name, TILEDB_READ);
1252+ Query query (ctx, array);
1253+ Subarray subarray (ctx, array);
1254+ subarray.add_range (0 , 0 , 0 );
1255+ std::byte data;
1256+ query.set_layout (TILEDB_ROW_MAJOR)
1257+ .set_subarray (subarray)
1258+ .set_data_buffer (" a" , &data, 1 );
1259+ query.submit ();
1260+ array.close ();
1261+
1262+ REQUIRE (data == data_w);
1263+
1264+ if (vfs.is_dir (array_name))
1265+ vfs.remove_dir (array_name);
1266+ }
1267+
12011268TEST_CASE (" C++ API: Write cell with large cell val num" , " [cppapi][sparse]" ) {
12021269 const std::string array_name = " cpp_unit_array" ;
12031270 Context ctx;
0 commit comments