summaryrefslogtreecommitdiff
path: root/test/storage/storage.hpp
blob: a4bb1bfbb7d8064f1a80c03e36a27cc4cee3a3f5 (plain)
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
#ifndef MBGL_TEST_STORAGE_STORAGE
#define MBGL_TEST_STORAGE_STORAGE

#include "../fixtures/util.hpp"
#include <mbgl/storage/response.hpp>
#include <iostream>
#include <memory>

class Storage : public testing::Test {
public:
    static void SetUpTestCase();
    static void TearDownTestCase();

protected:
    static std::unique_ptr<mbgl::test::Server> server;
};

namespace mbgl {

inline std::ostream& operator<<(std::ostream& os, Response::Error::Reason r) {
    // Special case
    if (uint8_t(r) == 1) return os << "Response::Error::Reason::Success";
    switch (r) {
        case Response::Error::Reason::NotFound: return os << "Response::Error::Reason::NotFound";
        case Response::Error::Reason::Server: return os << "Response::Error::Reason::Server";
        case Response::Error::Reason::Connection: return os << "Response::Error::Reason::Connection";
        case Response::Error::Reason::Other: return os << "Response::Error::Reason::Other";
        default: return os << "<Unknown>";
    }
}

} // namespace mbgl

#endif