proxygen
|
#include <folly/io/IOBuf.h>
#include <folly/io/TypedIOBuf.h>
#include <cstddef>
#include <boost/random.hpp>
#include <folly/Range.h>
#include <folly/memory/Malloc.h>
#include <folly/portability/GTest.h>
Go to the source code of this file.
Classes | |
class | MoveToFbStringTest |
Enumerations | |
enum | BufType { CREATE, TAKE_OWNERSHIP_MALLOC, TAKE_OWNERSHIP_CUSTOM, USER_OWNED } |
Functions | |
void | append (std::unique_ptr< IOBuf > &buf, StringPiece str) |
void | prepend (std::unique_ptr< IOBuf > &buf, StringPiece str) |
TEST (IOBuf, Simple) | |
void | testAllocSize (uint32_t requestedCapacity) |
TEST (IOBuf, AllocSizes) | |
void | deleteArrayBuffer (void *buf, void *arg) |
TEST (IOBuf, TakeOwnership) | |
TEST (IOBuf, WrapBuffer) | |
TEST (IOBuf, CreateCombined) | |
void | fillBuf (uint8_t *buf, uint32_t length, boost::mt19937 &gen) |
void | fillBuf (IOBuf *buf, boost::mt19937 &gen) |
void | checkBuf (const uint8_t *buf, uint32_t length, boost::mt19937 &gen) |
void | checkBuf (IOBuf *buf, boost::mt19937 &gen) |
void | checkBuf (ByteRange buf, boost::mt19937 &gen) |
void | checkChain (IOBuf *buf, boost::mt19937 &gen) |
TEST (IOBuf, Chaining) | |
void | testFreeFn (void *buffer, void *ptr) |
TEST (IOBuf, Reserve) | |
TEST (IOBuf, copyBuffer) | |
TEST (IOBuf, maybeCopyBuffer) | |
TEST (IOBuf, copyEmptyBuffer) | |
TEST (IOBuf, takeOwnershipUniquePtr) | |
TEST (IOBuf, Alignment) | |
TEST (TypedIOBuf, Simple) | |
TEST_P (MoveToFbStringTest, Simple) | |
INSTANTIATE_TEST_CASE_P (MoveToFbString, MoveToFbStringTest,::testing::Combine(::testing::Values(0, 1, 24, 256, 1<< 10, 1<< 20),::testing::Values(1, 2, 10),::testing::Bool(),::testing::Values(CREATE, TAKE_OWNERSHIP_MALLOC, TAKE_OWNERSHIP_CUSTOM, USER_OWNED))) | |
TEST (IOBuf, getIov) | |
TEST (IOBuf, wrapIov) | |
TEST (IOBuf, takeOwnershipIov) | |
TEST (IOBuf, wrapZeroLenIov) | |
TEST (IOBuf, move) | |
TEST (IOBuf, HashAndEqual) | |
TEST (IOBuf, IOBufCompare) | |
TEST (IOBuf, ReserveWithHeadroom) | |
TEST (IOBuf, CopyConstructorAndAssignmentOperator) | |
TEST (IOBuf, CloneAsValue) | |
TEST (IOBuf, ExternallyShared) | |
TEST (IOBuf, Managed) | |
TEST (IOBuf, CoalesceEmptyBuffers) | |
TEST (IOBuf, CloneCoalescedChain) | |
TEST (IOBuf, CloneCoalescedSingle) | |
enum BufType |
Enumerator | |
---|---|
CREATE | |
TAKE_OWNERSHIP_MALLOC | |
TAKE_OWNERSHIP_CUSTOM | |
USER_OWNED |
Definition at line 844 of file IOBufTest.cpp.
void append | ( | std::unique_ptr< IOBuf > & | buf, |
StringPiece | str | ||
) |
Definition at line 37 of file IOBufTest.cpp.
References folly::IOBuf::append(), EXPECT_LE, folly::IOBuf::tailroom(), and folly::IOBuf::writableData().
Referenced by proxygen::FilterChain< HTTPCodec, HTTPCodec::Callback, PassThroughHTTPCodecFilter,&HTTPCodec::setCallback, true >::add(), proxygen::FilterChain< HTTPCodec, HTTPCodec::Callback, PassThroughHTTPCodecFilter,&HTTPCodec::setCallback, true >::addFilters(), folly::BasicFixedString< Char, N >::append(), folly::basic_fbstring< E, T, A, Storage >::append(), folly::basic_fbstring< char >::append(), folly::humanify(), deadlock.DiGraph::node_link_data(), folly::basic_fbstring< char >::operator+=(), folly::BasicFixedString< Char, N >::operator+=(), folly::io::Appender::pushAtMost(), TEST(), and folly::symbolizer::Dwarf::Path::toBuffer().
Definition at line 268 of file IOBufTest.cpp.
References EXPECT_EQ, uint32_t, and uint8_t.
Referenced by checkBuf(), checkChain(), and TEST().
void checkBuf | ( | IOBuf * | buf, |
boost::mt19937 & | gen | ||
) |
Definition at line 299 of file IOBufTest.cpp.
References checkBuf(), folly::IOBuf::data(), and folly::IOBuf::length().
void checkBuf | ( | ByteRange | buf, |
boost::mt19937 & | gen | ||
) |
Definition at line 303 of file IOBufTest.cpp.
References checkBuf().
void checkChain | ( | IOBuf * | buf, |
boost::mt19937 & | gen | ||
) |
Definition at line 307 of file IOBufTest.cpp.
References checkBuf(), current, folly::IOBuf::data(), folly::IOBuf::length(), and folly::IOBuf::next().
Referenced by TEST().
void deleteArrayBuffer | ( | void * | buf, |
void * | arg | ||
) |
Definition at line 98 of file IOBufTest.cpp.
References uint32_t, and uint8_t.
Referenced by TEST().
void fillBuf | ( | IOBuf * | buf, |
boost::mt19937 & | gen | ||
) |
Definition at line 263 of file IOBufTest.cpp.
References fillBuf(), folly::IOBuf::length(), folly::IOBuf::unshare(), and folly::IOBuf::writableData().
INSTANTIATE_TEST_CASE_P | ( | MoveToFbString | , |
MoveToFbStringTest | , | ||
::testing::Combine(::testing::Values(0, 1, 24, 256, 1<< 10, 1<< 20),::testing::Values(1, 2, 10),::testing::Bool(),::testing::Values(CREATE, TAKE_OWNERSHIP_MALLOC, TAKE_OWNERSHIP_CUSTOM, USER_OWNED)) | |||
) |
Referenced by TEST_P().
void prepend | ( | std::unique_ptr< IOBuf > & | buf, |
StringPiece | str | ||
) |
Definition at line 43 of file IOBufTest.cpp.
References EXPECT_LE, folly::IOBuf::headroom(), folly::IOBuf::prepend(), and folly::IOBuf::writableData().
Referenced by TEST().
TEST | ( | IOBuf | , |
Simple | |||
) |
Definition at line 49 of file IOBufTest.cpp.
References folly::IOBuf::advance(), append(), folly::IOBuf::capacity(), folly::IOBuf::clear(), folly::IOBuf::data(), EXPECT_EQ, EXPECT_LE, folly::IOBuf::headroom(), folly::IOBuf::length(), prepend(), string, folly::IOBuf::tailroom(), and uint32_t.
TEST | ( | IOBuf | , |
AllocSizes | |||
) |
TEST | ( | IOBuf | , |
TakeOwnership | |||
) |
Definition at line 105 of file IOBufTest.cpp.
References folly::IOBuf::buffer(), folly::IOBuf::capacity(), folly::IOBuf::data(), deleteArrayBuffer(), EXPECT_EQ, folly::IOBuf::length(), folly::gen::move, uint32_t, and uint8_t.
TEST | ( | IOBuf | , |
WrapBuffer | |||
) |
Definition at line 168 of file IOBufTest.cpp.
References folly::IOBuf::buffer(), folly::IOBuf::capacity(), folly::IOBuf::data(), EXPECT_EQ, folly::IOBuf::length(), uint32_t, and uint8_t.
TEST | ( | IOBuf | , |
CreateCombined | |||
) |
TEST | ( | IOBuf | , |
Chaining | |||
) |
Definition at line 315 of file IOBufTest.cpp.
References folly::IOBuf::advance(), folly::IOBuf::append(), folly::IOBuf::appendChain(), checkBuf(), checkChain(), folly::IOBuf::cloneOne(), folly::IOBuf::computeChainDataLength(), count, folly::IOBuf::countChainElements(), deleteArrayBuffer(), EXPECT_EQ, EXPECT_FALSE, EXPECT_THROW, EXPECT_TRUE, fillBuf(), folly::IOBuf::isChained(), folly::IOBuf::isShared(), folly::IOBuf::isSharedOne(), folly::IOBuf::length(), folly::gen::move, folly::IOBuf::next(), folly::IOBuf::prependChain(), folly::IOBuf::prev(), uint32_t, uint8_t, folly::IOBuf::unlink(), folly::IOBuf::unshare(), and folly::IOBuf::unshareOne().
TEST | ( | IOBuf | , |
Reserve | |||
) |
Definition at line 604 of file IOBufTest.cpp.
References folly::IOBuf::append(), folly::IOBuf::buffer(), checkBuf(), folly::IOBuf::data(), EXPECT_EQ, EXPECT_LE, EXPECT_NE, fillBuf(), folly::IOBuf::headroom(), folly::IOBuf::length(), folly::IOBuf::reserve(), folly::IOBuf::tailroom(), testFreeFn(), uint32_t, uint8_t, and folly::usingJEMalloc().
TEST | ( | IOBuf | , |
copyBuffer | |||
) |
Definition at line 686 of file IOBufTest.cpp.
References fizz::test::copyBuffer(), folly::empty(), EXPECT_EQ, EXPECT_LE, s, and string.
TEST | ( | IOBuf | , |
maybeCopyBuffer | |||
) |
Definition at line 718 of file IOBufTest.cpp.
References folly::empty(), EXPECT_EQ, EXPECT_LE, s, and string.
TEST | ( | IOBuf | , |
copyEmptyBuffer | |||
) |
Definition at line 735 of file IOBufTest.cpp.
References fizz::test::copyBuffer(), EXPECT_EQ, and val.
TEST | ( | IOBuf | , |
takeOwnershipUniquePtr | |||
) |
Definition at line 766 of file IOBufTest.cpp.
References EXPECT_EQ, folly::IOBuf::length(), and folly::gen::move.
TEST | ( | IOBuf | , |
Alignment | |||
) |
TEST | ( | TypedIOBuf | , |
Simple | |||
) |
Definition at line 829 of file IOBufTest.cpp.
References folly::TypedIOBuf< T >::capacity(), EXPECT_EQ, EXPECT_LE, i, and folly::TypedIOBuf< T >::reserve().
TEST | ( | IOBuf | , |
getIov | |||
) |
Definition at line 946 of file IOBufTest.cpp.
References count, EXPECT_EQ, fillBuf(), i, folly::gen::move, and uint32_t.
TEST | ( | IOBuf | , |
wrapIov | |||
) |
Definition at line 1004 of file IOBufTest.cpp.
References folly::fbvector< T, Allocator >::data(), EXPECT_EQ, i, folly::fbvector< T, Allocator >::push_back(), and folly::fbvector< T, Allocator >::size().
TEST | ( | IOBuf | , |
takeOwnershipIov | |||
) |
Definition at line 1023 of file IOBufTest.cpp.
References b, data, folly::fbvector< T, Allocator >::data(), EXPECT_EQ, i, folly::fbvector< T, Allocator >::push_back(), and folly::fbvector< T, Allocator >::size().
TEST | ( | IOBuf | , |
wrapZeroLenIov | |||
) |
Definition at line 1042 of file IOBufTest.cpp.
References folly::fbvector< T, Allocator >::data(), EXPECT_EQ, EXPECT_NE, folly::fbvector< T, Allocator >::push_back(), and folly::fbvector< T, Allocator >::size().
TEST | ( | IOBuf | , |
move | |||
) |
Definition at line 1057 of file IOBufTest.cpp.
References folly::IOBuf::append(), ASSERT_TRUE, folly::IOBuf::capacity(), fizz::test::copyBuffer(), CREATE, data, folly::IOBuf::data(), EXPECT_EQ, EXPECT_FALSE, EXPECT_GE, folly::IOBuf::isShared(), folly::IOBuf::length(), folly::gen::move, ptr, folly::gen::seq(), uint32_t, and folly::IOBuf::writableTail().
TEST | ( | IOBuf | , |
HashAndEqual | |||
) |
Definition at line 1112 of file IOBufTest.cpp.
References a, b, c, folly::empty(), EXPECT_EQ, EXPECT_FALSE, EXPECT_NE, EXPECT_TRUE, and f.
TEST | ( | IOBuf | , |
IOBufCompare | |||
) |
Definition at line 1183 of file IOBufTest.cpp.
References EXPECT_EQ, and folly::gen::seq().
TEST | ( | IOBuf | , |
ReserveWithHeadroom | |||
) |
Definition at line 1211 of file IOBufTest.cpp.
References folly::IOBuf::advance(), folly::IOBuf::append(), CREATE, data, folly::IOBuf::data(), EXPECT_EQ, EXPECT_LE, folly::IOBuf::length(), folly::IOBuf::reserve(), folly::IOBuf::tailroom(), and folly::IOBuf::writableData().
TEST | ( | IOBuf | , |
CopyConstructorAndAssignmentOperator | |||
) |
Definition at line 1234 of file IOBufTest.cpp.
References append(), folly::copy(), folly::IOBuf::CREATE, EXPECT_EQ, EXPECT_FALSE, EXPECT_NE, EXPECT_TRUE, folly::IOBuf::isShared(), folly::gen::move, and string.
TEST | ( | IOBuf | , |
CloneAsValue | |||
) |
Definition at line 1278 of file IOBufTest.cpp.
References append(), b, folly::IOBuf::computeChainDataLength(), folly::copy(), fizz::test::copyBuffer(), EXPECT_EQ, EXPECT_FALSE, EXPECT_NE, EXPECT_TRUE, folly::gen::move, string, fizz::toString(), and folly::IOBuf::writableData().
TEST | ( | IOBuf | , |
ExternallyShared | |||
) |
Definition at line 1351 of file IOBufTest.cpp.
References buffer(), EXPECT_EQ, EXPECT_FALSE, EXPECT_TRUE, folly::size(), uint32_t, and uint8_t.
TEST | ( | IOBuf | , |
Managed | |||
) |
Definition at line 1390 of file IOBufTest.cpp.
References folly::copy(), EXPECT_EQ, EXPECT_FALSE, EXPECT_NE, EXPECT_TRUE, folly::gen::move, and fizz::toString().
TEST | ( | IOBuf | , |
CoalesceEmptyBuffers | |||
) |
TEST | ( | IOBuf | , |
CloneCoalescedChain | |||
) |
Definition at line 1462 of file IOBufTest.cpp.
References b, c, checkBuf(), EXPECT_EQ, EXPECT_FALSE, EXPECT_LE, fillBuf(), min, and uint32_t.
TEST | ( | IOBuf | , |
CloneCoalescedSingle | |||
) |
Definition at line 1487 of file IOBufTest.cpp.
References b, c, EXPECT_EQ, EXPECT_FALSE, EXPECT_TRUE, fillBuf(), and uint32_t.
TEST_P | ( | MoveToFbStringTest | , |
Simple | |||
) |
Definition at line 926 of file IOBufTest.cpp.
References check(), CREATE, INSTANTIATE_TEST_CASE_P(), TAKE_OWNERSHIP_CUSTOM, TAKE_OWNERSHIP_MALLOC, and USER_OWNED.
void testAllocSize | ( | uint32_t | requestedCapacity | ) |
Definition at line 77 of file IOBufTest.cpp.
References folly::IOBuf::capacity(), and EXPECT_GE.
Referenced by TEST().
void testFreeFn | ( | void * | buffer, |
void * | ptr | ||
) |
Definition at line 595 of file IOBufTest.cpp.
References buffer(), ptr, uint32_t, and uint8_t.
Referenced by MoveToFbStringTest::makeBuf(), and TEST().