diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 62cf91cb..0d0331d5 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -49,6 +49,7 @@ find_package(doctest REQUIRED) find_package(Threads) set(XEUS_TESTS + test_xbase64.cpp test_xbasic_fixed_string.cpp test_xhash.cpp test_xin_memory_history_manager.cpp diff --git a/test/test_xbase64.cpp b/test/test_xbase64.cpp new file mode 100644 index 00000000..d1ab18bb --- /dev/null +++ b/test/test_xbase64.cpp @@ -0,0 +1,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); + } + } +} \ No newline at end of file