Base64Test.cpp 908 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /*
  2. * Author: Patrick-Christopher Mattulat
  3. * Company: Lynar Studios
  4. * E-Mail: webmaster@lynarstudios.com
  5. * Created: 2022-01-08
  6. * Changed: 2022-05-17
  7. *
  8. * */
  9. #include <gtest/gtest.h>
  10. #include <ls_std/ls_std_encoding.hpp>
  11. namespace
  12. {
  13. class Base64Test : public ::testing::Test
  14. {
  15. protected:
  16. Base64Test() = default;
  17. ~Base64Test() override = default;
  18. void SetUp() override
  19. {}
  20. void TearDown() override
  21. {}
  22. };
  23. TEST_F(Base64Test, encode)
  24. {
  25. ls::std::encoding::Base64 base64{};
  26. ASSERT_STREQ("YWJj", base64.encode("abc").c_str());
  27. }
  28. TEST_F(Base64Test, decode)
  29. {
  30. ls::std::encoding::Base64 base64{};
  31. ASSERT_STREQ("abc", base64.decode("YWJj").c_str());
  32. ASSERT_STREQ("abcde", base64.decode("YWJjZGU=").c_str());
  33. ASSERT_STREQ("Hello C++!", base64.decode("SGVsbG8gQysrIQ==").c_str());
  34. }
  35. }