proxygen
fizz::test::ExtensionsTest Class Reference

#include <ExtensionTestsBase.h>

Inheritance diagram for fizz::test::ExtensionsTest:
testing::Test

Protected Member Functions

Buf getBuf (folly::StringPiece hex)
 
std::vector< ExtensiongetExtensions (folly::StringPiece hex)
 
template<class T >
void checkEncode (T &&ext, folly::StringPiece expectedHex)
 
- Protected Member Functions inherited from testing::Test
 Test ()
 
virtual void SetUp ()
 
virtual void TearDown ()
 
 Test ()
 
virtual void SetUp ()
 
virtual void TearDown ()
 
 Test ()
 
virtual void SetUp ()
 
virtual void TearDown ()
 

Additional Inherited Members

- Public Types inherited from testing::Test
typedef internal::SetUpTestCaseFunc SetUpTestCaseFunc
 
typedef internal::TearDownTestCaseFunc TearDownTestCaseFunc
 
typedef internal::SetUpTestCaseFunc SetUpTestCaseFunc
 
typedef internal::TearDownTestCaseFunc TearDownTestCaseFunc
 
typedef internal::SetUpTestCaseFunc SetUpTestCaseFunc
 
typedef internal::TearDownTestCaseFunc TearDownTestCaseFunc
 
- Public Member Functions inherited from testing::Test
virtual ~Test ()
 
virtual ~Test ()
 
virtual ~Test ()
 
- Static Public Member Functions inherited from testing::Test
static void SetUpTestCase ()
 
static void TearDownTestCase ()
 
static bool HasFatalFailure ()
 
static bool HasNonfatalFailure ()
 
static bool HasFailure ()
 
static void RecordProperty (const std::string &key, const std::string &value)
 
static void RecordProperty (const std::string &key, int value)
 
static void SetUpTestCase ()
 
static void TearDownTestCase ()
 
static bool HasFatalFailure ()
 
static bool HasNonfatalFailure ()
 
static bool HasFailure ()
 
static void RecordProperty (const std::string &key, const std::string &value)
 
static void RecordProperty (const std::string &key, int value)
 
static void SetUpTestCase ()
 
static void TearDownTestCase ()
 
static bool HasFatalFailure ()
 
static bool HasNonfatalFailure ()
 
static bool HasFailure ()
 
static void RecordProperty (const std::string &key, const std::string &value)
 
static void RecordProperty (const std::string &key, int value)
 

Detailed Description

Definition at line 20 of file ExtensionTestsBase.h.

Member Function Documentation

template<class T >
void fizz::test::ExtensionsTest::checkEncode ( T &&  ext,
folly::StringPiece  expectedHex 
)
inlineprotected

Definition at line 39 of file ExtensionTestsBase.h.

References folly::IOBuf::create(), fizz::encodeExtension(), EXPECT_TRUE, getBuf(), and fizz::detail::write().

39  {
40  auto encoded = encodeExtension(std::forward<T>(ext));
41  auto buf = folly::IOBuf::create(0);
42  folly::io::Appender appender(buf.get(), 10);
43  detail::write(encoded, appender);
44  EXPECT_TRUE(folly::IOBufEqualTo()(buf, getBuf(expectedHex)));
45  }
void write(const T &in, folly::io::Appender &appender)
Definition: Types-inl.h:112
static std::unique_ptr< IOBuf > create(std::size_t capacity)
Definition: IOBuf.cpp:229
Buf getBuf(folly::StringPiece hex)
#define EXPECT_TRUE(condition)
Definition: gtest.h:1859
Extension encodeExtension(const TokenBindingParameters &params)
Definition: Types.cpp:113
Buf fizz::test::ExtensionsTest::getBuf ( folly::StringPiece  hex)
inlineprotected

Definition at line 22 of file ExtensionTestsBase.h.

References folly::IOBuf::copyBuffer(), data, and folly::unhexlify().

Referenced by checkEncode(), and getExtensions().

22  {
23  auto data = unhexlify(hex);
24  return folly::IOBuf::copyBuffer(data.data(), data.size());
25  }
bool unhexlify(const InputString &input, OutputString &output)
Definition: String-inl.h:616
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
static constexpr uint64_t data[1]
Definition: Fingerprint.cpp:43
std::vector<Extension> fizz::test::ExtensionsTest::getExtensions ( folly::StringPiece  hex)
inlineprotected

Definition at line 27 of file ExtensionTestsBase.h.

References EXPECT_EQ, EXPECT_TRUE, getBuf(), folly::gen::move, and fizz::detail::read().

27  {
28  auto buf = ExtensionsTest::getBuf(hex);
29  folly::io::Cursor cursor(buf.get());
30  Extension ext;
31  EXPECT_EQ(detail::read(ext, cursor), buf->computeChainDataLength());
32  EXPECT_TRUE(cursor.isAtEnd());
33  std::vector<Extension> exts;
34  exts.push_back(std::move(ext));
35  return exts;
36  }
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
Buf getBuf(folly::StringPiece hex)
size_t read(T &out, folly::io::Cursor &cursor)
Definition: Types-inl.h:258
#define EXPECT_TRUE(condition)
Definition: gtest.h:1859

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