Skip to content

Commit

Permalink
Added tests
Browse files Browse the repository at this point in the history
  • Loading branch information
anutosh491 committed May 30, 2024
1 parent 9a21035 commit 6b2ae53
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
1 change: 1 addition & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
36 changes: 36 additions & 0 deletions test/test_xbase64.cpp
Original file line number Diff line number Diff line change
@@ -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);
}
}
}

0 comments on commit 6b2ae53

Please sign in to comment.