proxygen
TestUtil.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2018-present, Facebook, Inc.
3  * All rights reserved.
4  *
5  * This source code is licensed under the BSD-style license found in the
6  * LICENSE file in the root directory of this source tree.
7  */
8 
9 #pragma once
10 
11 #include <folly/Memory.h>
12 #include <folly/String.h>
13 #include <folly/io/IOBuf.h>
14 #include <functional>
15 
16 namespace fizz {
17 namespace test {
18 
19 using BufCreator =
20  std::function<std::unique_ptr<folly::IOBuf>(size_t len, size_t bufNum)>;
21 
22 // Converts the hex encoded string to an IOBuf.
23 std::unique_ptr<folly::IOBuf>
24 toIOBuf(std::string hexData, size_t headroom = 0, size_t tailroom = 0);
25 
26 std::unique_ptr<folly::IOBuf> chunkIOBuf(
27  std::unique_ptr<folly::IOBuf> input,
28  size_t chunks,
29  BufCreator creator = nullptr);
30 } // namespace test
31 } // namespace fizz
auto chunks
std::function< std::unique_ptr< folly::IOBuf >(size_t len, size_t bufNum)> BufCreator
Definition: TestUtil.h:20
std::unique_ptr< folly::IOBuf > toIOBuf(std::string hexData, size_t headroom, size_t tailroom)
Definition: TestUtil.cpp:24
Definition: Actions.h:16
const char * string
Definition: Conv.cpp:212
std::unique_ptr< IOBuf > chunkIOBuf(std::unique_ptr< IOBuf > input, size_t chunks, BufCreator creator)
Definition: TestUtil.cpp:31