Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 0da4f72

Browse files
committedDec 15, 2020
Add test for chunked zarray assignment
1 parent 7518411 commit 0da4f72

File tree

7 files changed

+191
-48
lines changed

7 files changed

+191
-48
lines changed
 

‎.azure-pipelines/azure-pipelines-linux.yml

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ jobs:
88
vmImage: $(image_name)
99
timeoutInMinutes: 360
1010
steps:
11-
1211
- bash: echo "##vso[task.prependpath]$CONDA/bin"
1312
displayName: Add conda to PATH
1413

‎examples/zarr_v2.ipynb

+173-40
Large diffs are not rendered by default.

‎include/xtensor-zarr/xzarr_aws_store.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ namespace xt
115115
request.SetKey(m_path);
116116

117117
std::shared_ptr<Aws::IOStream> writer = Aws::MakeShared<Aws::FStream>("SampleAllocationTag", m_path.c_str(), std::ios_base::in | std::ios_base::binary);
118-
writer->write(value, size);
118+
writer->write(value, (std::streamsize)size);
119119
writer->flush();
120120

121121
request.SetBody(writer);

‎include/xtensor-zarr/xzarr_common.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ namespace xt
2020
std::size_t zarr_major;
2121
if (i == std::string::npos)
2222
{
23-
zarr_major = std::stoi(zarr_version);
23+
zarr_major = (std::size_t)std::stoi(zarr_version);
2424
}
2525
else
2626
{
27-
zarr_major = std::stoi(zarr_version.substr(0, i));
27+
zarr_major = (std::size_t)std::stoi(zarr_version.substr(0, i));
2828
}
2929
if ((zarr_major < 2) || (zarr_major > 3))
3030
{

‎include/xtensor-zarr/xzarr_file_system_store.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ namespace xt
129129
}
130130
}
131131
std::ofstream stream(m_path, std::ofstream::binary);
132-
stream.write(value, size);
132+
stream.write(value, (std::streamsize)size);
133133
stream.flush();
134134
}
135135

‎include/xtensor-zarr/xzarr_gcs_store.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ namespace xt
9595
void xzarr_gcs_stream::assign(const char* value, std::size_t size)
9696
{
9797
auto writer = m_client.WriteObject(m_bucket, m_path);
98-
writer.write(value, size);
98+
writer.write(value, (std::streamsize)size);
9999
writer.flush();
100100
}
101101

‎test/test_zarr.cpp

+13-2
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ namespace xt
156156
"data/root/arthur/dent/c1/1",
157157
"data/root/arthur/dent/c2/0",
158158
"data/root/arthur/dent/c2/1"};
159-
for (int i = 0; i < 6; i++)
159+
for (unsigned long int i = 0; i < 6; i++)
160160
{
161161
EXPECT_EQ(keys1[i], ref1[i]);
162162
}
@@ -165,7 +165,7 @@ namespace xt
165165
auto keys2 = s2.list();
166166
std::string ref2[] = {"android.array.json",
167167
"paranoid.group.json"};
168-
for (int i = 0; i < 2; i++)
168+
for (unsigned long int i = 0; i < 2; i++)
169169
{
170170
EXPECT_EQ(keys2[i], ref2[i]);
171171
// we don't have rights to erase objects in this bucket as an anonymous client
@@ -192,4 +192,15 @@ namespace xt
192192
auto h = create_zarr_hierarchy("test.zr3");
193193
auto z = h.create_array("/foo", shape, chunk_shape, "<f8");
194194
}
195+
196+
TEST(xzarr_hierarchy, zarr_assign)
197+
{
198+
std::vector<size_t> shape = {4, 4};
199+
std::vector<size_t> chunk_shape = {2, 2};
200+
auto h1 = create_zarr_hierarchy("src.zr3");
201+
zarray z1 = h1.create_array("/", shape, chunk_shape, "<f8");
202+
auto h2 = create_zarr_hierarchy("dst.zr3");
203+
zarray z2 = h2.create_array("/", shape, chunk_shape, "<f8");
204+
z2 = z1;
205+
}
195206
}

0 commit comments

Comments
 (0)
Please sign in to comment.