You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

14 lines
495 B

3 months ago
  1. #include "gtest/gtest.h"
  2. #include <yaml-cpp/binary.h>
  3. TEST(BinaryTest, DecodingSimple) {
  4. std::string input{90, 71, 86, 104, 90, 71, 74, 108, 90, 87, 89, 61};
  5. const std::vector<unsigned char> &result = YAML::DecodeBase64(input);
  6. EXPECT_EQ(std::string(result.begin(), result.end()), "deadbeef");
  7. }
  8. TEST(BinaryTest, DecodingNoCrashOnNegative) {
  9. std::string input{-58, -1, -99, 109};
  10. const std::vector<unsigned char> &result = YAML::DecodeBase64(input);
  11. EXPECT_TRUE(result.empty());
  12. }