]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/beast/test/beast/core/detail/base64.cpp
Add patch for failing prerm scripts
[ceph.git] / ceph / src / boost / libs / beast / test / beast / core / detail / base64.cpp
1 //
2 // Copyright (c) 2016-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 // Official repository: https://github.com/boostorg/beast
8 //
9
10 // Test that header file is self-contained.
11 #include <boost/beast/core/detail/base64.hpp>
12
13 #include <boost/beast/unit_test/suite.hpp>
14
15 namespace boost {
16 namespace beast {
17 namespace detail {
18
19 class base64_test : public beast::unit_test::suite
20 {
21 public:
22 void
23 check (std::string const& in, std::string const& out)
24 {
25 auto const encoded = base64_encode (in);
26 BEAST_EXPECT(encoded == out);
27 BEAST_EXPECT(base64_decode (encoded) == in);
28 }
29
30 void
31 run()
32 {
33 check ("", "");
34 check ("f", "Zg==");
35 check ("fo", "Zm8=");
36 check ("foo", "Zm9v");
37 check ("foob", "Zm9vYg==");
38 check ("fooba", "Zm9vYmE=");
39 check ("foobar", "Zm9vYmFy");
40
41 check(
42 "Man is distinguished, not only by his reason, but by this singular passion from "
43 "other animals, which is a lust of the mind, that by a perseverance of delight "
44 "in the continued and indefatigable generation of knowledge, exceeds the short "
45 "vehemence of any carnal pleasure."
46 ,
47 "TWFuIGlzIGRpc3Rpbmd1aXNoZWQsIG5vdCBvbmx5IGJ5IGhpcyByZWFzb24sIGJ1dCBieSB0aGlz"
48 "IHNpbmd1bGFyIHBhc3Npb24gZnJvbSBvdGhlciBhbmltYWxzLCB3aGljaCBpcyBhIGx1c3Qgb2Yg"
49 "dGhlIG1pbmQsIHRoYXQgYnkgYSBwZXJzZXZlcmFuY2Ugb2YgZGVsaWdodCBpbiB0aGUgY29udGlu"
50 "dWVkIGFuZCBpbmRlZmF0aWdhYmxlIGdlbmVyYXRpb24gb2Yga25vd2xlZGdlLCBleGNlZWRzIHRo"
51 "ZSBzaG9ydCB2ZWhlbWVuY2Ugb2YgYW55IGNhcm5hbCBwbGVhc3VyZS4="
52 );
53 }
54 };
55
56 BEAST_DEFINE_TESTSUITE(beast,core,base64);
57
58 } // detail
59 } // beast
60 } // boost