Skip to content

Commit 36c9cc6

Browse files
author
Luke Shaw
committed
Fix b2nd_copy for copying of arrays with inner 0-dimsç
1 parent 1dd6ea6 commit 36c9cc6

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

blosc/schunk.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,8 @@ blosc2_schunk* blosc2_schunk_copy(blosc2_schunk *schunk, blosc2_storage *storage
253253
BLOSC_TRACE_ERROR("Can not create a new schunk");
254254
return NULL;
255255
}
256+
// Set the chunksize for the schunk, as it cannot be derived from storage
257+
new_schunk->chunksize = schunk->chunksize ;
256258

257259
// Copy metalayers
258260
for (int nmeta = 0; nmeta < schunk->nmetalayers; ++nmeta) {

tests/b2nd/test_b2nd_concatenate.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ CUTEST_TEST_SETUP(concatenate) {
135135

136136
CUTEST_PARAMETRIZE(backend, _test_backend, CUTEST_DATA(
137137
{false, false},
138-
{true, false},
138+
{true, false}, // contiguous = True, persistent = False
139139
{true, true},
140140
{false, true},
141141
));
@@ -145,8 +145,8 @@ CUTEST_TEST_SETUP(concatenate) {
145145
// 0-dim is not supported in concatenate
146146
// {0, 0, {0}, {0}, {0}, {0}, {0}, {0}},
147147
// 1-dim
148-
{1, 0, {10}, {5}, {1}, {5}, {5}, {1}},
149-
{1, 0, {2}, {25}, {5}, {49}, {25}, {5}},
148+
{1, 0, {10}, {5}, {1}, {5}, {5}, {1}},
149+
{1, 0, {2}, {25}, {5}, {49}, {25}, {5}},
150150
// 2-dim
151151
{2, 0, {10, 10}, {2, 2}, {1, 1}, {4, 10}, {2, 2}, {1, 1}},
152152
{2, 1, {10, 8}, {2, 2}, {1, 1}, {10, 8}, {2, 2}, {1, 1}},
@@ -159,9 +159,9 @@ CUTEST_TEST_SETUP(concatenate) {
159159
{3, 0, {5, 5, 50}, {25, 13, 10}, {5, 8, 5}, {51, 5, 50}, {25, 13, 10}, {5, 8, 5}},
160160
// Inner 0-dims are supported
161161
{3, 1, {50, 1, 50}, {25, 13, 10}, {5, 8, 5}, {50, 0, 50}, {25, 13, 10}, {5, 8, 5}},
162-
// // // TODO: the next is not working yet
163-
// // {3, 2, {50, 50, 0}, {25, 13, 10}, {5, 8, 5}, {50, 50, 49}, {25, 13, 10}, {5, 8, 5}},
164-
// // 4-dim
162+
{3, 2, {50, 50, 0}, {25, 13, 10}, {5, 8, 5}, {50, 50, 49}, {25, 13, 10}, {5, 8, 5}},
163+
{3, 2, {10, 10, 0}, {10, 10, 10}, {10, 10, 10}, {10, 10, 10},{10, 10, 10}, {10, 10, 10}},
164+
// 4-dim
165165
{4, 0, {5, 5, 5, 5}, {2, 5, 10, 5}, {5, 2, 5, 2}, {5, 5, 5, 5}, {5, 5, 10, 5}, {5, 2, 5, 2}},
166166
{4, 1, {5, 5, 5, 5}, {2, 5, 10, 5}, {5, 2, 5, 2}, {5, 5, 5, 5}, {5, 5, 10, 5}, {5, 2, 5, 2}},
167167
{4, 2, {5, 5, 5, 5}, {2, 13, 10, 5}, {5, 8, 5, 2}, {5, 5, 5, 5}, {5, 13, 10, 5}, {5, 8, 5, 2}},
@@ -204,7 +204,6 @@ CUTEST_TEST_TEST(concatenate) {
204204
blosc2_remove_urlpath(urlpath);
205205
blosc2_remove_urlpath(urlpath1);
206206
blosc2_remove_urlpath(urlpath2);
207-
// if (arange && typesize==13){return 0;} // arange is not supported for typesize 13
208207

209208
// Create a helper buffer for storing the final array for the concatenation in C
210209
int64_t helpershape[B2ND_MAX_DIM] = {0};

0 commit comments

Comments
 (0)