17 #include <gtest/gtest.h> 25 using namespace folly;
30 auto createZeroedBuffer(
size_t size) {
33 std::memset(ret->writableData(), 0x00,
size);
51 auto buf3 = createZeroedBuffer(3);
52 auto buf11 = createZeroedBuffer(11);
53 auto buf16 = createZeroedBuffer(16);
85 auto buf = createZeroedBuffer(2);
90 TEST(LengthFieldFramePipeline, LittleEndian) {
105 auto buf = createZeroedBuffer(1);
110 TEST(LengthFieldFrameDecoder, Simple) {
123 auto bufFrame = createZeroedBuffer(4);
126 auto bufData = createZeroedBuffer(1);
139 TEST(LengthFieldFrameDecoder, NoStrip) {
152 auto bufFrame = createZeroedBuffer(2);
155 auto bufData = createZeroedBuffer(1);
168 TEST(LengthFieldFrameDecoder, Adjustment) {
181 auto bufFrame = createZeroedBuffer(2);
184 auto bufData = createZeroedBuffer(1);
197 TEST(LengthFieldFrameDecoder, PreHeader) {
210 auto bufFrame = createZeroedBuffer(4);
214 auto bufData = createZeroedBuffer(1);
227 TEST(LengthFieldFrameDecoder, PostHeader) {
240 auto bufFrame = createZeroedBuffer(4);
244 auto bufData = createZeroedBuffer(1);
257 TEST(LengthFieldFrameDecoderStrip, PrePostHeader) {
270 auto bufFrame = createZeroedBuffer(6);
275 auto bufData = createZeroedBuffer(1);
288 TEST(LengthFieldFrameDecoder, StripPrePostHeaderFrameInclHeader) {
301 auto bufFrame = createZeroedBuffer(6);
306 auto bufData = createZeroedBuffer(1);
319 TEST(LengthFieldFrameDecoder, FailTestLengthFieldEndOffset) {
331 auto bufFrame = createZeroedBuffer(8);
343 TEST(LengthFieldFrameDecoder, FailTestLengthFieldFrameSize) {
355 auto bufFrame = createZeroedBuffer(16);
369 TEST(LengthFieldFrameDecoder, FailTestLengthFieldInitialBytes) {
381 auto bufFrame = createZeroedBuffer(16);
395 TEST(LengthFieldFrameDecoder, FailTestNotEnoughBytes) {
407 auto bufFrame = createZeroedBuffer(16);
434 auto buf = createZeroedBuffer(3);
442 buf = createZeroedBuffer(1);
449 buf = createZeroedBuffer(4);
460 buf = createZeroedBuffer(1);
481 auto buf = createZeroedBuffer(3);
489 buf = createZeroedBuffer(1);
496 buf = createZeroedBuffer(3);
505 buf = createZeroedBuffer(1);
525 auto buf = createZeroedBuffer(11);
533 buf = createZeroedBuffer(1);
538 buf = createZeroedBuffer(2);
546 buf = createZeroedBuffer(12);
548 for (
int i = 0;
i < 11;
i++) {
551 c2.write<
char>(
'\n');
563 10,
true, LineBasedFrameDecoder::TerminatorType::NEWLINE))
571 auto buf = createZeroedBuffer(2);
589 10,
true, LineBasedFrameDecoder::TerminatorType::CARRIAGENEWLINE))
597 auto buf = createZeroedBuffer(3);
void append(std::unique_ptr< folly::IOBuf > &&buf, bool pack=false)
#define ASSERT_EQ(val1, val2)
static std::unique_ptr< IOBuf > create(std::size_t capacity)
void Fail(const char *msg)
std::enable_if< std::is_arithmetic< T >::value >::type write(T value)
#define EXPECT_EQ(val1, val2)
constexpr detail::Map< Move > move
—— Concurrent Priority Queue Implementation ——
constexpr auto size(C const &c) -> decltype(c.size())
static Options cacheChainLength()
void SimpleTest(std::shared_ptr< folly::Executor > const &parent)
std::size_t computeChainDataLength() const
TEST(SequencedExecutor, CPUThreadPoolExecutor)