]> git.proxmox.com Git - ceph.git/blob - ceph/src/Beast/test/core/base64.cpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / Beast / test / core / base64.cpp
1 //
2 // Copyright (c) 2013-2017 Vinnie Falco (vinnie dot falco at gmail dot com)
3 //
4 // Distributed under the Boost Software License, Version 1.0. (See accompanying
5 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6 //
7
8 // Test that header file is self-contained.
9 #include <beast/core/detail/base64.hpp>
10
11 #include <beast/unit_test/suite.hpp>
12
13 namespace beast {
14 namespace detail {
15
16 class base64_test : public beast::unit_test::suite
17 {
18 public:
19 void
20 check (std::string const& in, std::string const& out)
21 {
22 auto const encoded = base64_encode (in);
23 BEAST_EXPECT(encoded == out);
24 BEAST_EXPECT(base64_decode (encoded) == in);
25 }
26
27 void
28 run()
29 {
30 check ("", "");
31 check ("f", "Zg==");
32 check ("fo", "Zm8=");
33 check ("foo", "Zm9v");
34 check ("foob", "Zm9vYg==");
35 check ("fooba", "Zm9vYmE=");
36 check ("foobar", "Zm9vYmFy");
37 }
38 };
39
40 BEAST_DEFINE_TESTSUITE(base64,core,beast);
41
42 } // detail
43 } // beast
44