RFC 4648 Test Vectors

This commit is contained in:
Daniel J. Hofmann 2016-03-14 15:25:36 +01:00 committed by Patrick Niklaus
parent f948380fa2
commit 735b325d74
2 changed files with 18 additions and 0 deletions

View File

@ -14,6 +14,9 @@
#include <cstdint>
#include <climits>
// RFC 4648 "The Base16, Base32, and Base64 Data Encodings"
// See: https://tools.ietf.org/html/rfc4648
namespace osrm
{
namespace engine

View File

@ -3,8 +3,23 @@
#include <boost/test/unit_test.hpp>
#include <boost/test/test_case_template.hpp>
// RFC 4648 "The Base16, Base32, and Base64 Data Encodings"
BOOST_AUTO_TEST_SUITE(base64)
// For test vectors see section 10: https://tools.ietf.org/html/rfc4648#section-10
BOOST_AUTO_TEST_CASE(rfc4648_test_vectors)
{
using namespace osrm::engine;
BOOST_CHECK_EQUAL(encodeBase64(""), "");
BOOST_CHECK_EQUAL(encodeBase64("f"), "Zg==");
BOOST_CHECK_EQUAL(encodeBase64("fo"), "Zm8=");
BOOST_CHECK_EQUAL(encodeBase64("foo"), "Zm9v");
BOOST_CHECK_EQUAL(encodeBase64("foob"), "Zm9vYg==");
BOOST_CHECK_EQUAL(encodeBase64("fooba"), "Zm9vYmE=");
BOOST_CHECK_EQUAL(encodeBase64("foobar"), "Zm9vYmFy");
}
BOOST_AUTO_TEST_CASE(encoding) {}
BOOST_AUTO_TEST_CASE(decoding) {}