File: binary_test.cpp

package info (click to toggle)
yaml-cpp 0.8.0%2Bdfsg-7
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,380 kB
  • sloc: cpp: 23,493; ansic: 956; python: 196; makefile: 47
file content (14 lines) | stat: -rw-r--r-- 495 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include "gtest/gtest.h"
#include <yaml-cpp/binary.h>

TEST(BinaryTest, DecodingSimple) {
  std::string input{90, 71, 86, 104, 90, 71, 74, 108, 90, 87, 89, 61};
  const std::vector<unsigned char> &result = YAML::DecodeBase64(input);
  EXPECT_EQ(std::string(result.begin(), result.end()), "deadbeef");
}

TEST(BinaryTest, DecodingNoCrashOnNegative) {
  std::string input{-58, -1, -99, 109};
  const std::vector<unsigned char> &result = YAML::DecodeBase64(input);
  EXPECT_TRUE(result.empty());
}