proxygen
|
#include <folly/Range.h>
#include <array>
#include <deque>
#include <iterator>
#include <limits>
#include <random>
#include <string>
#include <type_traits>
#include <vector>
#include <boost/algorithm/string/trim.hpp>
#include <boost/range/concepts.hpp>
#include <folly/Memory.h>
#include <folly/portability/GMock.h>
#include <folly/portability/GTest.h>
#include <folly/portability/SysMman.h>
Go to the source code of this file.
Classes | |
class | NeedleFinderTest< NeedleFinder > |
struct | SseNeedleFinder |
struct | NoSseNeedleFinder |
struct | ByteSetNeedleFinder |
class | tag |
class | fake_string_view |
Namespaces | |
folly | |
—— Concurrent Priority Queue Implementation —— | |
Typedefs | |
using | NeedleFinders = ::testing::Types< SseNeedleFinder, NoSseNeedleFinder, ByteSetNeedleFinder > |
Functions | |
BOOST_CONCEPT_ASSERT ((boost::RandomAccessRangeConcept< StringPiece >)) | |
TEST (StringPiece, All) | |
template<class T > | |
void | expectLT (const T &a, const T &b) |
template<class T > | |
void | expectEQ (const T &a, const T &b) |
TEST (StringPiece, EightBitComparisons) | |
TEST (StringPiece, ToByteRange) | |
TEST (StringPiece, InvalidRange) | |
TEST (StringPiece, Constexpr) | |
TEST (StringPiece, Prefix) | |
TEST (StringPiece, Suffix) | |
TEST (StringPiece, Equals) | |
TEST (StringPiece, PrefixEmpty) | |
TEST (StringPiece, SuffixEmpty) | |
TEST (StringPiece, erase) | |
TEST (StringPiece, split_step_char_delimiter) | |
TEST (StringPiece, split_step_range_delimiter) | |
void | split_step_with_process_noop (folly::StringPiece) |
TEST (StringPiece, split_step_with_process_char_delimiter) | |
TEST (StringPiece, split_step_with_process_range_delimiter) | |
TEST (StringPiece, split_step_with_process_char_delimiter_additional_args) | |
TEST (StringPiece, split_step_with_process_range_delimiter_additional_args) | |
TEST (StringPiece, NoInvalidImplicitConversions) | |
TEST (qfind, UInt32_Ranges) | |
TYPED_TEST_CASE (NeedleFinderTest, NeedleFinders) | |
TYPED_TEST (NeedleFinderTest, Null) | |
TYPED_TEST (NeedleFinderTest, DelimDuplicates) | |
TYPED_TEST (NeedleFinderTest, Empty) | |
TYPED_TEST (NeedleFinderTest, Unaligned) | |
TYPED_TEST (NeedleFinderTest, Needles256) | |
TYPED_TEST (NeedleFinderTest, Base) | |
void | createProtectedBuf (StringPiece &contents, char **buf) |
void | freeProtectedBuf (char *buf) |
TYPED_TEST (NeedleFinderTest, NoSegFault) | |
TEST (NonConstTest, StringPiece) | |
template<class Container > | |
Container::value_type * | dataPtr (Container &cont) |
template<class T , size_t N> | |
constexpr T * | dataPtr (T(&arr)[N]) noexcept |
template<class C > | |
void | testRangeFunc (C &&x, size_t n) |
TEST (RangeFunc, Vector) | |
TEST (RangeFunc, Array) | |
TEST (RangeFunc, CArray) | |
TEST (RangeFunc, ConstexprCArray) | |
TEST (RangeFunc, ConstexprStdArray) | |
TEST (RangeFunc, ConstexprStdArrayZero) | |
TEST (RangeFunc, ConstexprIteratorPair) | |
TEST (RangeFunc, ConstexprCollection) | |
TEST (CRangeFunc, CArray) | |
TEST (CRangeFunc, StdArray) | |
TEST (CRangeFunc, StdArrayZero) | |
TEST (CRangeFunc, Collection) | |
std::string | get_rand_str (size_t size, std::uniform_int_distribution<> &dist, std::mt19937 &gen) |
bool | folly::operator== (MutableStringPiece mp, StringPiece sp) |
bool | folly::operator== (StringPiece sp, MutableStringPiece mp) |
TEST (ReplaceAt, exhaustiveTest) | |
TEST (ReplaceAll, basicTest) | |
TEST (ReplaceAll, randomTest) | |
TEST (ReplaceAll, BadArg) | |
TEST (Range, Constructors) | |
TEST (Range, ArrayConstructors) | |
TEST (Range, ConstexprAccessors) | |
TEST (Range, LiteralSuffix) | |
TEST (Range, LiteralSuffixContainsNulBytes) | |
TEST (Range, StringPieceExplicitConversionOperator) | |
TEST (Range, MutableStringPieceExplicitConversionOperator) | |
Variables | |
const size_t | kPageSize = 4096 |
using NeedleFinders = ::testing::Types<SseNeedleFinder, NoSseNeedleFinder, ByteSetNeedleFinder> |
Definition at line 916 of file RangeTest.cpp.
BOOST_CONCEPT_ASSERT | ( | (boost::RandomAccessRangeConcept< StringPiece >) | ) |
void createProtectedBuf | ( | StringPiece & | contents, |
char ** | buf | ||
) |
Definition at line 1006 of file RangeTest.cpp.
References folly::aligned_malloc(), ASSERT_LE, folly::Range< Iter >::data(), FAIL, kPageSize, folly::Range< Iter >::reset(), and folly::Range< Iter >::size().
Referenced by TYPED_TEST().
Container::value_type* dataPtr | ( | Container & | cont | ) |
Definition at line 1082 of file RangeTest.cpp.
Referenced by folly::ssl::OpenSSLCertUtils::derEncode(), wangle::SSLUtil::exDataStdStringDup(), fizz::CertUtils::getCertMessage(), and testRangeFunc().
Definition at line 1088 of file RangeTest.cpp.
Definition at line 241 of file RangeTest.cpp.
References EXPECT_FALSE, and EXPECT_TRUE.
Referenced by TEST().
Definition at line 227 of file RangeTest.cpp.
References EXPECT_FALSE, and EXPECT_TRUE.
Referenced by TEST().
void freeProtectedBuf | ( | char * | buf | ) |
Definition at line 1021 of file RangeTest.cpp.
References folly::aligned_free().
Referenced by TYPED_TEST().
std::string get_rand_str | ( | size_t | size, |
std::uniform_int_distribution<> & | dist, | ||
std::mt19937 & | gen | ||
) |
Definition at line 1232 of file RangeTest.cpp.
References dist, i, folly::size(), and string.
Referenced by TEST().
void split_step_with_process_noop | ( | folly::StringPiece | ) |
TEST | ( | StringPiece | , |
All | |||
) |
Definition at line 47 of file RangeTest.cpp.
References EXPECT_EQ, EXPECT_FALSE, EXPECT_GE, EXPECT_GT, EXPECT_LE, EXPECT_LT, EXPECT_NE, EXPECT_TRUE, folly::foo, foo2(), folly::Range< const char * >::npos, folly::rfind(), s, and string.
TEST | ( | StringPiece | , |
EightBitComparisons | |||
) |
Definition at line 249 of file RangeTest.cpp.
References a, b, count, expectEQ(), expectLT(), i, string, and values().
TEST | ( | StringPiece | , |
ToByteRange | |||
) |
Definition at line 267 of file RangeTest.cpp.
References a, b, folly::Range< Iter >::begin(), c, folly::Range< Iter >::end(), and EXPECT_EQ.
TEST | ( | StringPiece | , |
InvalidRange | |||
) |
Definition at line 281 of file RangeTest.cpp.
References a, b, EXPECT_EQ, EXPECT_THROW, string, and folly::Range< Iter >::subpiece().
TEST | ( | StringPiece | , |
Constexpr | |||
) |
TEST | ( | StringPiece | , |
Prefix | |||
) |
Definition at line 311 of file RangeTest.cpp.
References a, b, EXPECT_EQ, EXPECT_FALSE, EXPECT_TRUE, and folly::Range< Iter >::startsWith().
TEST | ( | StringPiece | , |
Suffix | |||
) |
Definition at line 367 of file RangeTest.cpp.
References a, b, folly::Range< Iter >::endsWith(), EXPECT_EQ, EXPECT_FALSE, and EXPECT_TRUE.
TEST | ( | StringPiece | , |
Equals | |||
) |
Definition at line 424 of file RangeTest.cpp.
References a, folly::Range< Iter >::equals(), EXPECT_FALSE, and EXPECT_TRUE.
TEST | ( | StringPiece | , |
PrefixEmpty | |||
) |
Definition at line 431 of file RangeTest.cpp.
References a, EXPECT_EQ, EXPECT_FALSE, EXPECT_TRUE, folly::Range< Iter >::removePrefix(), and folly::Range< Iter >::startsWith().
TEST | ( | StringPiece | , |
SuffixEmpty | |||
) |
Definition at line 444 of file RangeTest.cpp.
References a, folly::Range< Iter >::endsWith(), EXPECT_EQ, EXPECT_FALSE, EXPECT_TRUE, and folly::Range< Iter >::removeSuffix().
TEST | ( | StringPiece | , |
erase | |||
) |
Definition at line 457 of file RangeTest.cpp.
References a, b, folly::Range< Iter >::begin(), folly::Range< Iter >::end(), folly::Range< Iter >::erase(), EXPECT_EQ, and EXPECT_THROW.
TEST | ( | StringPiece | , |
split_step_char_delimiter | |||
) |
Definition at line 494 of file RangeTest.cpp.
References folly::Range< Iter >::begin(), folly::Range< Iter >::end(), EXPECT_EQ, cpp.ast::next(), s, and folly::Range< Iter >::split_step().
TEST | ( | StringPiece | , |
split_step_range_delimiter | |||
) |
Definition at line 552 of file RangeTest.cpp.
References folly::Range< Iter >::begin(), folly::Range< Iter >::end(), EXPECT_EQ, cpp.ast::next(), s, and folly::Range< Iter >::split_step().
TEST | ( | StringPiece | , |
split_step_with_process_char_delimiter | |||
) |
Definition at line 617 of file RangeTest.cpp.
References folly::Range< Iter >::begin(), folly::Range< Iter >::end(), EXPECT_EQ, EXPECT_NO_THROW, EXPECT_TRUE, cpp.ast::next(), s, folly::Range< Iter >::split_step(), split_step_with_process_noop(), and folly::value().
TEST | ( | StringPiece | , |
split_step_with_process_range_delimiter | |||
) |
Definition at line 700 of file RangeTest.cpp.
References folly::Range< Iter >::begin(), folly::Range< Iter >::end(), EXPECT_EQ, EXPECT_NO_THROW, EXPECT_TRUE, cpp.ast::next(), s, folly::Range< Iter >::split_step(), split_step_with_process_noop(), and folly::value().
TEST | ( | StringPiece | , |
split_step_with_process_char_delimiter_additional_args | |||
) |
Definition at line 790 of file RangeTest.cpp.
References folly::Range< Iter >::begin(), folly::Range< Iter >::empty(), folly::Range< Iter >::end(), EXPECT_EQ, EXPECT_TRUE, cpp.ast::next(), s, s_, and folly::Range< Iter >::split_step().
TEST | ( | StringPiece | , |
split_step_with_process_range_delimiter_additional_args | |||
) |
Definition at line 825 of file RangeTest.cpp.
References folly::Range< Iter >::begin(), folly::Range< Iter >::empty(), folly::Range< Iter >::end(), EXPECT_EQ, EXPECT_TRUE, cpp.ast::next(), s, s_, and folly::Range< Iter >::split_step().
TEST | ( | StringPiece | , |
NoInvalidImplicitConversions | |||
) |
Definition at line 860 of file RangeTest.cpp.
References EXPECT_TRUE, s, and string.
TEST | ( | qfind | , |
UInt32_Ranges | |||
) |
Definition at line 874 of file RangeTest.cpp.
References a, b, EXPECT_EQ, folly::qfind(), and folly::Range< Iter >::size().
TEST | ( | NonConstTest | , |
StringPiece | |||
) |
Definition at line 1064 of file RangeTest.cpp.
References EXPECT_EQ, s, and string.
TEST | ( | RangeFunc | , |
Vector | |||
) |
TEST | ( | RangeFunc | , |
Array | |||
) |
TEST | ( | RangeFunc | , |
CArray | |||
) |
Definition at line 1123 of file RangeTest.cpp.
References testRangeFunc().
TEST | ( | RangeFunc | , |
ConstexprCArray | |||
) |
TEST | ( | RangeFunc | , |
ConstexprStdArray | |||
) |
TEST | ( | RangeFunc | , |
ConstexprStdArrayZero | |||
) |
TEST | ( | RangeFunc | , |
ConstexprIteratorPair | |||
) |
TEST | ( | RangeFunc | , |
ConstexprCollection | |||
) |
Definition at line 1160 of file RangeTest.cpp.
References folly::data(), data_, EXPECT_EQ, folly::range(), s, and folly::size().
TEST | ( | CRangeFunc | , |
CArray | |||
) |
Definition at line 1184 of file RangeTest.cpp.
References folly::crange(), testing::ElementsAreArray(), EXPECT_THAT, EXPECT_TRUE, and folly::value().
TEST | ( | CRangeFunc | , |
StdArray | |||
) |
Definition at line 1192 of file RangeTest.cpp.
References folly::crange(), testing::ElementsAreArray(), EXPECT_THAT, EXPECT_TRUE, and folly::value().
TEST | ( | CRangeFunc | , |
StdArrayZero | |||
) |
Definition at line 1200 of file RangeTest.cpp.
References folly::crange(), EXPECT_THAT, EXPECT_TRUE, and folly::value().
TEST | ( | CRangeFunc | , |
Collection | |||
) |
Definition at line 1208 of file RangeTest.cpp.
References folly::crange(), folly::data(), data_, testing::ElementsAreArray(), EXPECT_THAT, EXPECT_TRUE, s, folly::size(), and folly::value().
TEST | ( | ReplaceAt | , |
exhaustiveTest | |||
) |
Definition at line 1254 of file RangeTest.cpp.
References dist, EXPECT_EQ, get_rand_str(), i, rd, and string.
TEST | ( | ReplaceAll | , |
basicTest | |||
) |
TEST | ( | ReplaceAll | , |
randomTest | |||
) |
Definition at line 1309 of file RangeTest.cpp.
References dist, EXPECT_EQ, get_rand_str(), i, rd, and string.
TEST | ( | ReplaceAll | , |
BadArg | |||
) |
TEST | ( | Range | , |
Constructors | |||
) |
Definition at line 1354 of file RangeTest.cpp.
TEST | ( | Range | , |
ArrayConstructors | |||
) |
TEST | ( | Range | , |
ConstexprAccessors | |||
) |
TEST | ( | Range | , |
LiteralSuffix | |||
) |
TEST | ( | Range | , |
LiteralSuffixContainsNulBytes | |||
) |
TEST | ( | Range | , |
StringPieceExplicitConversionOperator | |||
) |
Definition at line 1452 of file RangeTest.cpp.
References testing::ElementsAreArray(), EXPECT_EQ, EXPECT_FALSE, EXPECT_THAT, EXPECT_TRUE, string, value, and folly::value().
TEST | ( | Range | , |
MutableStringPieceExplicitConversionOperator | |||
) |
Definition at line 1508 of file RangeTest.cpp.
References testing::ElementsAreArray(), EXPECT_EQ, EXPECT_FALSE, EXPECT_THAT, EXPECT_TRUE, s, folly::Range< Iter >::size(), string, folly::TEST(), value, and folly::value().
void testRangeFunc | ( | C && | x, |
size_t | n | ||
) |
Definition at line 1093 of file RangeTest.cpp.
References folly::Range< Iter >::begin(), dataPtr(), folly::Range< Iter >::end(), EXPECT_EQ, folly::gen::move, folly::range(), folly::Range< Iter >::size(), folly::value(), and x.
Referenced by TEST().
TYPED_TEST | ( | NeedleFinderTest | , |
Null | |||
) |
Definition at line 919 of file RangeTest.cpp.
TYPED_TEST | ( | NeedleFinderTest | , |
DelimDuplicates | |||
) |
TYPED_TEST | ( | NeedleFinderTest | , |
Empty | |||
) |
TYPED_TEST | ( | NeedleFinderTest | , |
Unaligned | |||
) |
TYPED_TEST | ( | NeedleFinderTest | , |
Needles256 | |||
) |
Definition at line 969 of file RangeTest.cpp.
References EXPECT_EQ, i, max, min, and folly::Range< const char * >::npos.
TYPED_TEST | ( | NeedleFinderTest | , |
Base | |||
) |
TYPED_TEST | ( | NeedleFinderTest | , |
NoSegFault | |||
) |
Definition at line 1026 of file RangeTest.cpp.
References folly::Range< Iter >::advance(), ASSERT_TRUE, folly::Range< Iter >::begin(), createProtectedBuf(), folly::Range< Iter >::empty(), folly::Range< Iter >::end(), EXPECT_EQ, freeProtectedBuf(), i, folly::Range< const char * >::npos, folly::Range< Iter >::pop_back(), and string.
TYPED_TEST_CASE | ( | NeedleFinderTest | , |
NeedleFinders | |||
) |
const size_t kPageSize = 4096 |
Definition at line 1000 of file RangeTest.cpp.
Referenced by createProtectedBuf(), and folly::TEST().