proxygen
TestData Class Reference
Inheritance diagram for TestData:
folly::RequestData folly::RequestData folly::RequestData

Public Member Functions

 TestData (int data)
 
 ~TestData () override
 
bool hasCallback () override
 
 TestData (int data)
 
 ~TestData () override
 
bool hasCallback () override
 
 TestData (int gso, bool useSocketGSO, int *in, size_t inLen, int *expected, size_t expectedLen)
 
bool checkIn () const
 
bool checkOut () const
 
bool appendOut (int num)
 
std::unique_ptr< folly::IOBufgetInBuf ()
 
 TestData (int data)
 
 ~TestData () override
 
bool hasCallback () override
 
void onSet () override
 
void onUnset () override
 
- Public Member Functions inherited from folly::RequestData
virtual ~RequestData ()=default
 

Public Attributes

int data_
 
int gso_ {0}
 
bool useSocketGSO_ {false}
 
std::vector< int > in_
 
std::vector< int > expected_
 
int expectedSize_
 
std::vector< int > out_
 
int outSize_ {0}
 
int set_ = 0
 
int unset_ = 0
 

Detailed Description

Definition at line 547 of file ThreadPoolExecutorTest.cpp.

Constructor & Destructor Documentation

TestData::TestData ( int  data)
inlineexplicit

Definition at line 549 of file ThreadPoolExecutorTest.cpp.

549 : data_(data) {}
static constexpr uint64_t data[1]
Definition: Fingerprint.cpp:43
TestData::~TestData ( )
inlineoverride

Definition at line 550 of file ThreadPoolExecutorTest.cpp.

550 {}
TestData::TestData ( int  data)
inlineexplicit

Definition at line 26 of file ContextTest.cpp.

26 : data_(data) {}
static constexpr uint64_t data[1]
Definition: Fingerprint.cpp:43
TestData::~TestData ( )
inlineoverride

Definition at line 27 of file ContextTest.cpp.

27 {}
TestData::TestData ( int  gso,
bool  useSocketGSO,
int *  in,
size_t  inLen,
int *  expected,
size_t  expectedLen 
)
inline

Definition at line 39 of file AsyncUDPSocketGSOTest.cpp.

References folly::f14::accumulate(), and in_.

46  : gso_(gso), useSocketGSO_(useSocketGSO) {
47  in_.assign(in, in + inLen);
48  expected_.assign(expected, expected + expectedLen);
49 
50  expectedSize_ = std::accumulate(expected_.begin(), expected_.end(), 0);
51  }
void accumulate(std::vector< std::size_t > &a, std::vector< std::size_t > const &d)
Definition: F14TestUtil.h:58
std::vector< int > in_
std::vector< int > expected_
TestData::TestData ( int  data)
inlineexplicit

Definition at line 30 of file RequestContextTest.cpp.

30 : data_(data) {}
static constexpr uint64_t data[1]
Definition: Fingerprint.cpp:43
TestData::~TestData ( )
inlineoverride

Definition at line 31 of file RequestContextTest.cpp.

31 {}

Member Function Documentation

bool TestData::appendOut ( int  num)
inline

Definition at line 61 of file AsyncUDPSocketGSOTest.cpp.

References out_.

61  {
62  out_.push_back(num);
63  outSize_ += num;
64 
65  return (outSize_ >= expectedSize_);
66  }
std::vector< int > out_
bool TestData::checkIn ( ) const
inline

Definition at line 53 of file AsyncUDPSocketGSOTest.cpp.

References folly::f14::accumulate(), and in_.

53  {
54  return (expectedSize_ == std::accumulate(in_.begin(), in_.end(), 0));
55  }
void accumulate(std::vector< std::size_t > &a, std::vector< std::size_t > const &d)
Definition: F14TestUtil.h:58
std::vector< int > in_
bool TestData::checkOut ( ) const
inline

Definition at line 57 of file AsyncUDPSocketGSOTest.cpp.

References folly::f14::accumulate(), and out_.

57  {
58  return (expectedSize_ == std::accumulate(out_.begin(), out_.end(), 0));
59  }
void accumulate(std::vector< std::size_t > &a, std::vector< std::size_t > const &d)
Definition: F14TestUtil.h:58
std::vector< int > out_
std::unique_ptr<folly::IOBuf> TestData::getInBuf ( )
inline

Definition at line 68 of file AsyncUDPSocketGSOTest.cpp.

References folly::IOBuf::copyBuffer(), i, in_, folly::IOBuf::prependChain(), and string.

68  {
69  if (!in_.size()) {
70  return nullptr;
71  }
72 
73  std::string str(in_[0], 'A');
74  std::unique_ptr<folly::IOBuf> ret =
75  folly::IOBuf::copyBuffer(str.data(), str.size());
76 
77  for (size_t i = 1; i < in_.size(); i++) {
78  str = std::string(in_[i], 'A');
79  ret->prependChain(folly::IOBuf::copyBuffer(str.data(), str.size()));
80  }
81 
82  return ret;
83  }
std::vector< int > in_
void prependChain(std::unique_ptr< IOBuf > &&iobuf)
Definition: IOBuf.cpp:509
const char * string
Definition: Conv.cpp:212
static std::unique_ptr< IOBuf > copyBuffer(const void *buf, std::size_t size, std::size_t headroom=0, std::size_t minTailroom=0)
Definition: IOBuf.h:1587
bool TestData::hasCallback ( )
inlineoverridevirtual

Implements folly::RequestData.

Definition at line 29 of file ContextTest.cpp.

References data_.

29  {
30  return false;
31  }
bool TestData::hasCallback ( )
inlineoverridevirtual

Implements folly::RequestData.

Definition at line 33 of file RequestContextTest.cpp.

33  {
34  return true;
35  }
bool TestData::hasCallback ( )
inlineoverridevirtual

Implements folly::RequestData.

Definition at line 552 of file ThreadPoolExecutorTest.cpp.

552  {
553  return false;
554  }
void TestData::onSet ( )
inlineoverridevirtual

Reimplemented from folly::RequestData.

Definition at line 37 of file RequestContextTest.cpp.

37  {
38  set_++;
39  }
void TestData::onUnset ( )
inlineoverridevirtual

Reimplemented from folly::RequestData.

Definition at line 41 of file RequestContextTest.cpp.

41  {
42  unset_++;
43  }

Member Data Documentation

int TestData::data_

Definition at line 556 of file ThreadPoolExecutorTest.cpp.

std::vector<int> TestData::expected_

Definition at line 88 of file AsyncUDPSocketGSOTest.cpp.

int TestData::expectedSize_

Definition at line 89 of file AsyncUDPSocketGSOTest.cpp.

int TestData::gso_ {0}

Definition at line 85 of file AsyncUDPSocketGSOTest.cpp.

std::vector<int> TestData::in_

Definition at line 87 of file AsyncUDPSocketGSOTest.cpp.

std::vector<int> TestData::out_

Definition at line 90 of file AsyncUDPSocketGSOTest.cpp.

int TestData::outSize_ {0}

Definition at line 91 of file AsyncUDPSocketGSOTest.cpp.

int TestData::set_ = 0

Definition at line 45 of file RequestContextTest.cpp.

int TestData::unset_ = 0

Definition at line 45 of file RequestContextTest.cpp.

bool TestData::useSocketGSO_ {false}

Definition at line 86 of file AsyncUDPSocketGSOTest.cpp.


The documentation for this class was generated from the following files: