File: test_xbase64.cpp

package info (click to toggle)
xeus 5.2.6-1
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 9,764 kB
  • sloc: cpp: 7,406; makefile: 157; python: 25
file content (36 lines) | stat: -rw-r--r-- 1,270 bytes parent folder | download | duplicates (2)
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
35
36
/***************************************************************************
* Copyright (c) Johan Mabille, Sylvain Corlay and Wolf Vollprecht          *
* Copyright (c) QuantStack                                                 *
*                                                                          *
* Distributed under the terms of the BSD 3-Clause License.                 *
*                                                                          *
* The full license is in the file LICENSE, distributed with this software. *
****************************************************************************/

#include "doctest/doctest.h"

#include "xeus/xbase64.hpp"

namespace xeus
{
    TEST_SUITE("xbase64")
    {
        TEST_CASE("base64encode")
        {
            std::string input = "hello world";
            std::string expected_output = "aGVsbG8gd29ybGQ=";
            std::string encoded = base64encode(input);

            REQUIRE(encoded == expected_output);
        }

        TEST_CASE("base64decode")
        {
            std::string input = "aGVsbG8gd29ybGQ=";
            std::string expected_output = "hello world";
            std::string decoded = base64decode(input);

            REQUIRE(decoded == expected_output);
        }
    }
}