-
Notifications
You must be signed in to change notification settings - Fork 30
Expand file tree
/
Copy pathtest_xio_aws_handler.cpp
More file actions
58 lines (47 loc) · 1.84 KB
/
Copy pathtest_xio_aws_handler.cpp
File metadata and controls
58 lines (47 loc) · 1.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/***************************************************************************
* Copyright (c) Wolf Vollprecht, Sylvain Corlay and Johan Mabille *
* Copyright (c) QuantStack *
* *
* Distributed under the terms of the BSD 3-Clause License. *
* *
* The full license is in the file LICENSE, distributed with this software. *
****************************************************************************/
#include <cstdint>
#include <sstream>
#include <exception>
#include "gtest/gtest.h"
#include "xtensor-io/xfile_array.hpp"
#include "xtensor-io/xio_binary.hpp"
#include "xtensor-io/xio_aws_handler.hpp"
namespace xt
{
TEST(xio_aws_handler, read)
{
Aws::SDKOptions options;
Aws::InitAPI(options);
xio_aws_handler<xio_binary_config> h;
Aws::S3::S3Client client;
xio_aws_config c = {client, "elevation-tiles-prod"};
h.configure_io(c);
xarray<char> a0;
std::string path = "main.js";
h.read(a0, path);
std::string ref = "/*jslint browser: true*/";
std::string res = a0.data();
EXPECT_EQ(ref, res.substr(0, ref.size()));
Aws::ShutdownAPI(options);
}
TEST(xio_aws_handler, xfile_array)
{
Aws::SDKOptions options;
Aws::InitAPI(options);
Aws::S3::S3Client client;
xio_aws_config c = {client, "elevation-tiles-prod"};
xfile_array<char, xio_aws_handler<xio_binary_config>> a0("main.js", c);
xarray<char> a1 = a0;
std::string ref = "/*jslint browser: true*/";
std::string res = a1.data();
EXPECT_EQ(ref, res.substr(0, ref.size()));
Aws::ShutdownAPI(options);
}
}