Files
xahaud/test/core/detail/base64.cpp
Vinnie Falco e0956c36c1 Tidy up core sources:
The core headers are moved to their own directory (but remain in
the same namespace).
2016-05-10 13:41:28 -04:00

45 lines
1020 B
C++

//
// Copyright (c) 2013-2016 Vinnie Falco (vinnie dot falco at gmail dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
// Test that header file is self-contained.
#include <beast/core/detail/base64.hpp>
#include <beast/unit_test/suite.hpp>
namespace beast {
namespace detail {
class base64_test : public beast::unit_test::suite
{
public:
void
check (std::string const& in, std::string const& out)
{
auto const encoded = base64_encode (in);
expect (encoded == out);
expect (base64_decode (encoded) == in);
}
void
run()
{
check ("", "");
check ("f", "Zg==");
check ("fo", "Zm8=");
check ("foo", "Zm9v");
check ("foob", "Zm9vYg==");
check ("fooba", "Zm9vYmE=");
check ("foobar", "Zm9vYmFy");
}
};
BEAST_DEFINE_TESTSUITE(base64,core,beast);
} // detail
} // beast