proxygen
|
#include <folly/memory/UninitializedMemoryHacks.h>
#include <algorithm>
#include <string>
#include <vector>
#include <folly/Memory.h>
#include <folly/Random.h>
#include <folly/portability/GTest.h>
#include <glog/logging.h>
Go to the source code of this file.
Functions | |
void | describePlatform () |
template<typename T > | |
T | validData (T const &target, std::vector< bool > const &valid) |
template<typename T > | |
void | doResizeWithoutInit (T &target, std::vector< bool > &valid, std::size_t newSize) |
template<typename T > | |
void | doOverwrite (T &target, std::vector< bool > &valid, std::size_t b, std::size_t e) |
template<typename T > | |
void | doResize (T &target, std::vector< bool > &valid, std::size_t newSize) |
template<typename T > | |
void | doClear (T &target, std::vector< bool > &valid) |
template<typename T > | |
void | doInsert (T &target, std::vector< bool > &valid, std::size_t i) |
template<typename T > | |
void | doErase (T &target, std::vector< bool > &valid, std::size_t i) |
template<typename T > | |
void | doPushBack (T &target, std::vector< bool > &valid) |
template<typename T > | |
void | genericCheck (T &target) |
template<typename T > | |
void | check (T &target) |
template<> | |
void | check< std::string > (std::string &target) |
template<typename T > | |
void | testSimple () |
template<typename T > | |
void | testRandom (size_t numSteps=10000) |
TEST (UninitializedMemoryHacks, simpleString) | |
TEST (UninitializedMemoryHacks, simpleVectorChar) | |
TEST (UninitializedMemoryHacks, simpleVectorByte) | |
TEST (UninitializedMemoryHacks, simpleVectorInt) | |
TEST (UninitializedMemoryHacks, randomString) | |
TEST (UninitializedMemoryHacks, randomVectorChar) | |
TEST (UninitializedMemoryHacks, randomVectorByte) | |
TEST (UninitializedMemoryHacks, randomVectorInt) | |
void check | ( | T & | target | ) |
Definition at line 164 of file UninitializedMemoryHacksTest.cpp.
References genericCheck().
Referenced by testRandom(), and testSimple().
void check< std::string > | ( | std::string & | target | ) |
Definition at line 169 of file UninitializedMemoryHacksTest.cpp.
References EXPECT_EQ, and genericCheck().
void describePlatform | ( | ) |
Definition at line 28 of file UninitializedMemoryHacksTest.cpp.
References string.
Referenced by testRandom(), and testSimple().
void doClear | ( | T & | target, |
std::vector< bool > & | valid | ||
) |
Definition at line 127 of file UninitializedMemoryHacksTest.cpp.
Referenced by testRandom().
void doErase | ( | T & | target, |
std::vector< bool > & | valid, | ||
std::size_t | i | ||
) |
Definition at line 139 of file UninitializedMemoryHacksTest.cpp.
References i.
Referenced by testRandom().
void doInsert | ( | T & | target, |
std::vector< bool > & | valid, | ||
std::size_t | i | ||
) |
Definition at line 133 of file UninitializedMemoryHacksTest.cpp.
References i.
Referenced by testRandom().
void doOverwrite | ( | T & | target, |
std::vector< bool > & | valid, | ||
std::size_t | b, | ||
std::size_t | e | ||
) |
Definition at line 94 of file UninitializedMemoryHacksTest.cpp.
References i.
Referenced by testRandom(), and testSimple().
void doPushBack | ( | T & | target, |
std::vector< bool > & | valid | ||
) |
Definition at line 145 of file UninitializedMemoryHacksTest.cpp.
Referenced by testRandom().
void doResize | ( | T & | target, |
std::vector< bool > & | valid, | ||
std::size_t | newSize | ||
) |
Definition at line 106 of file UninitializedMemoryHacksTest.cpp.
References EXPECT_EQ, EXPECT_GE, EXPECT_LT, EXPECT_TRUE, i, and validData().
Referenced by testRandom(), and testSimple().
void doResizeWithoutInit | ( | T & | target, |
std::vector< bool > & | valid, | ||
std::size_t | newSize | ||
) |
Definition at line 76 of file UninitializedMemoryHacksTest.cpp.
References EXPECT_EQ, EXPECT_GE, EXPECT_TRUE, folly::resizeWithoutInitialization(), and validData().
Referenced by testRandom(), and testSimple().
void genericCheck | ( | T & | target | ) |
Definition at line 151 of file UninitializedMemoryHacksTest.cpp.
References EXPECT_EQ, and EXPECT_LE.
Referenced by check(), and check< std::string >().
TEST | ( | UninitializedMemoryHacks | , |
simpleString | |||
) |
Definition at line 283 of file UninitializedMemoryHacksTest.cpp.
TEST | ( | UninitializedMemoryHacks | , |
simpleVectorChar | |||
) |
Definition at line 287 of file UninitializedMemoryHacksTest.cpp.
TEST | ( | UninitializedMemoryHacks | , |
simpleVectorByte | |||
) |
Definition at line 291 of file UninitializedMemoryHacksTest.cpp.
TEST | ( | UninitializedMemoryHacks | , |
simpleVectorInt | |||
) |
Definition at line 295 of file UninitializedMemoryHacksTest.cpp.
TEST | ( | UninitializedMemoryHacks | , |
randomString | |||
) |
Definition at line 299 of file UninitializedMemoryHacksTest.cpp.
TEST | ( | UninitializedMemoryHacks | , |
randomVectorChar | |||
) |
Definition at line 303 of file UninitializedMemoryHacksTest.cpp.
TEST | ( | UninitializedMemoryHacks | , |
randomVectorByte | |||
) |
Definition at line 307 of file UninitializedMemoryHacksTest.cpp.
TEST | ( | UninitializedMemoryHacks | , |
randomVectorInt | |||
) |
Definition at line 311 of file UninitializedMemoryHacksTest.cpp.
void testRandom | ( | size_t | numSteps = 10000 | ) |
Definition at line 221 of file UninitializedMemoryHacksTest.cpp.
References check(), folly::copy(), describePlatform(), doClear(), doErase(), doInsert(), doOverwrite(), doPushBack(), doResize(), doResizeWithoutInit(), i, max, min, folly::gen::move, folly::Random::rand32(), folly::resizeWithoutInitialization(), folly::f14::swap(), T, and uint32_t.
void testSimple | ( | ) |
Definition at line 176 of file UninitializedMemoryHacksTest.cpp.
References check(), describePlatform(), doOverwrite(), doResize(), doResizeWithoutInit(), i, sizes, and T.
Referenced by proxygen::RFC1867Base::parse(), proxygen::TEST_F(), and proxygen::TEST_P().
Definition at line 64 of file UninitializedMemoryHacksTest.cpp.
References EXPECT_EQ, i, and T.
Referenced by doResize(), and doResizeWithoutInit().