proxygen
|
#include <boost/lexical_cast.hpp>
#include <folly/Conv.h>
#include <folly/container/Foreach.h>
#include <folly/portability/GTest.h>
#include <algorithm>
#include <cinttypes>
#include <limits>
#include <sstream>
#include <stdexcept>
#include <tuple>
Go to the source code of this file.
Classes | |
struct | my::Dimensions |
Namespaces | |
my | |
Macros | |
#define | __STDC_FORMAT_MACROS 1 |
#define | EXPECT_CONV_ERROR_QUOTE(expr, code, value, quoted) |
#define | EXPECT_CONV_ERROR(expr, code, value) EXPECT_CONV_ERROR_QUOTE(expr, code, value, true) |
#define | EXPECT_CONV_ERROR_STR(type, str, code) EXPECT_CONV_ERROR(to<type>(str), code, str) |
#define | EXPECT_CONV_ERROR_STR_NOVAL(type, str, code) EXPECT_CONV_ERROR(to<type>(str), code, nullptr) |
#define | EXPECT_CONV_ERROR_PP_VAL(type, str, code, val) |
#define | EXPECT_CONV_ERROR_PP(type, str, code) EXPECT_CONV_ERROR_PP_VAL(type, str, code, str) |
#define | EXPECT_CONV_ERROR_ARITH(type, val, code) |
#define | THE_GREAT_EXPECTATIONS(n, len) |
Enumerations | |
enum | my::SmallEnum |
Functions | |
TEST (Conv, digits10) | |
TEST (Conv, Type2Type) | |
TEST (Conv, Integral2Integral) | |
TEST (Conv, Floating2Floating) | |
template<class String > | |
void | testIntegral2String () |
template<class String , class Int , class... Ints> | |
void | testIntegral2String () |
TEST (Conv, Integral2String) | |
template<class String > | |
void | testString2Integral () |
template<class String , class Int , class... Ints> | |
void | testString2Integral () |
TEST (Conv, String2Integral) | |
TEST (Conv, StringPiece2Integral) | |
TEST (Conv, StringPieceAppend) | |
TEST (Conv, BadStringToIntegral) | |
template<class String > | |
void | testIdenticalTo () |
template<class String > | |
void | testVariadicTo () |
template<class String > | |
void | testIdenticalToDelim () |
template<class String > | |
void | testVariadicToDelim () |
TEST (Conv, NullString) | |
TEST (Conv, VariadicTo) | |
TEST (Conv, VariadicToDelim) | |
template<class String > | |
void | testDoubleToString () |
TEST (Conv, DoubleToString) | |
TEST (Conv, FBStringToString) | |
TEST (Conv, StringPieceToDouble) | |
TEST (Conv, EmptyStringToInt) | |
TEST (Conv, CorruptedStringToInt) | |
TEST (Conv, EmptyStringToDouble) | |
TEST (Conv, IntToDouble) | |
TEST (Conv, DoubleToInt) | |
TEST (Conv, EnumToInt) | |
TEST (Conv, EnumToString) | |
TEST (Conv, IntToEnum) | |
TEST (Conv, UnsignedEnum) | |
TEST (Conv, UnsignedEnumClass) | |
TEST (Conv, EnumClassToString) | |
TEST (Conv, IntegralToBool) | |
template<typename Src > | |
void | testStr2Bool () |
TEST (Conv, StringToBool) | |
TEST (Conv, Transform) | |
TEST (Conv, FloatToInt) | |
TEST (Conv, IntToFloat) | |
TEST (Conv, BoolToFloat) | |
TEST (Conv, FloatToBool) | |
TEST (Conv, ConversionErrorStrToBool) | |
TEST (Conv, ConversionErrorStrToFloat) | |
TEST (Conv, ConversionErrorStrToInt) | |
TEST (Conv, ConversionErrorPtrPairToInt) | |
TEST (Conv, ConversionErrorIntToInt) | |
TEST (Conv, ConversionErrorFloatToFloat) | |
TEST (Conv, ConversionErrorIntToFloat) | |
TEST (Conv, ConversionErrorFloatToInt) | |
TEST (Conv, TryStringToBool) | |
TEST (Conv, TryStringToInt) | |
TEST (Conv, TryStringToEnum) | |
TEST (Conv, TryStringToFloat) | |
TEST (Conv, TryStringToDouble) | |
TEST (Conv, TryIntToInt) | |
TEST (Conv, TryFloatToFloat) | |
TEST (Conv, TryFloatToInt) | |
TEST (Conv, TryIntToFloat) | |
TEST (Conv, TryPtrPairToInt) | |
TEST (Conv, NewUint64ToString) | |
TEST (Conv, allocate_size) | |
Expected< StringPiece, ConversionCode > | my::parseTo (folly::StringPiece in, Dimensions &out) |
template<class String > | |
void | my::toAppend (const Dimensions &in, String *result) |
size_t | my::estimateSpaceNeeded (const Dimensions &in) |
Expected< StringPiece, ConversionCode > | my::parseTo (StringPiece in, SmallEnum &out) |
template<class String > | |
void | my::toAppend (SmallEnum, String *result) |
TEST (Conv, custom_kkproviders) | |
TEST (conv, custom_enumclass) | |
TEST (Conv, TryToThenWithVoid) | |
TEST (conv, TryIntToUnscopedEnumAndBack) | |
TEST (conv, TryIntToScopedEnumAndBack) | |
#define __STDC_FORMAT_MACROS 1 |
Definition at line 18 of file ConvTest.cpp.
#define EXPECT_CONV_ERROR | ( | expr, | |
code, | |||
value | |||
) | EXPECT_CONV_ERROR_QUOTE(expr, code, value, true) |
Definition at line 954 of file ConvTest.cpp.
Referenced by TEST().
Definition at line 1043 of file ConvTest.cpp.
Referenced by TEST().
#define EXPECT_CONV_ERROR_PP | ( | type, | |
str, | |||
code | |||
) | EXPECT_CONV_ERROR_PP_VAL(type, str, code, str) |
Definition at line 1009 of file ConvTest.cpp.
Referenced by TEST().
Definition at line 1003 of file ConvTest.cpp.
#define EXPECT_CONV_ERROR_QUOTE | ( | expr, | |
code, | |||
value, | |||
quoted | |||
) |
Definition at line 945 of file ConvTest.cpp.
#define EXPECT_CONV_ERROR_STR | ( | type, | |
str, | |||
code | |||
) | EXPECT_CONV_ERROR(to<type>(str), code, str) |
Definition at line 957 of file ConvTest.cpp.
Referenced by TEST().
#define EXPECT_CONV_ERROR_STR_NOVAL | ( | type, | |
str, | |||
code | |||
) | EXPECT_CONV_ERROR(to<type>(str), code, nullptr) |
Definition at line 960 of file ConvTest.cpp.
Referenced by TEST().
#define THE_GREAT_EXPECTATIONS | ( | n, | |
len | |||
) |
Referenced by TEST().
TEST | ( | Conv | , |
digits10 | |||
) |
Definition at line 37 of file ConvTest.cpp.
References buffer(), folly::digits10(), EXPECT_EQ, i, and uint64_t.
TEST | ( | Conv | , |
Type2Type | |||
) |
TEST | ( | Conv | , |
Integral2Integral | |||
) |
TEST | ( | Conv | , |
Floating2Floating | |||
) |
Definition at line 128 of file ConvTest.cpp.
References ADD_FAILURE, EXPECT_ANY_THROW, EXPECT_EQ, EXPECT_TRUE, f, max, and min.
TEST | ( | Conv | , |
Integral2String | |||
) |
Definition at line 234 of file ConvTest.cpp.
TEST | ( | Conv | , |
String2Integral | |||
) |
Definition at line 430 of file ConvTest.cpp.
References folly::Range< Iter >::begin(), EXPECT_EQ, and EXPECT_THROW.
TEST | ( | Conv | , |
StringPiece2Integral | |||
) |
Definition at line 451 of file ConvTest.cpp.
TEST | ( | Conv | , |
StringPieceAppend | |||
) |
Definition at line 458 of file ConvTest.cpp.
TEST | ( | Conv | , |
BadStringToIntegral | |||
) |
Definition at line 473 of file ConvTest.cpp.
References EXPECT_THROW, and s.
TEST | ( | Conv | , |
NullString | |||
) |
TEST | ( | Conv | , |
VariadicTo | |||
) |
Definition at line 537 of file ConvTest.cpp.
TEST | ( | Conv | , |
VariadicToDelim | |||
) |
Definition at line 544 of file ConvTest.cpp.
TEST | ( | Conv | , |
DoubleToString | |||
) |
Definition at line 559 of file ConvTest.cpp.
TEST | ( | Conv | , |
FBStringToString | |||
) |
Definition at line 564 of file ConvTest.cpp.
References EXPECT_EQ, and testing::gmock_matchers_test::foo.
TEST | ( | Conv | , |
StringPieceToDouble | |||
) |
Definition at line 572 of file ConvTest.cpp.
References ADD_FAILURE, folly::Range< Iter >::data(), EXPECT_EQ, EXPECT_THROW, EXPECT_TRUE, std::tr1::make_tuple(), and s.
TEST | ( | Conv | , |
EmptyStringToInt | |||
) |
TEST | ( | Conv | , |
CorruptedStringToInt | |||
) |
TEST | ( | Conv | , |
EmptyStringToDouble | |||
) |
TEST | ( | Conv | , |
IntToDouble | |||
) |
TEST | ( | Conv | , |
DoubleToInt | |||
) |
TEST | ( | Conv | , |
EnumToInt | |||
) |
Definition at line 700 of file ConvTest.cpp.
References ADD_FAILURE, EXPECT_EQ, i, and x.
TEST | ( | Conv | , |
EnumToString | |||
) |
Definition at line 716 of file ConvTest.cpp.
References EXPECT_EQ.
TEST | ( | Conv | , |
IntToEnum | |||
) |
Definition at line 724 of file ConvTest.cpp.
References ADD_FAILURE, EXPECT_EQ, and i.
TEST | ( | Conv | , |
UnsignedEnum | |||
) |
Definition at line 740 of file ConvTest.cpp.
References ADD_FAILURE, EXPECT_EQ, i, s, uint32_t, and x.
TEST | ( | Conv | , |
UnsignedEnumClass | |||
) |
Definition at line 756 of file ConvTest.cpp.
References EXPECT_EQ, EXPECT_GT, EXPECT_THROW, EXPECT_TRUE, my::parseTo(), uint32_t, and x.
TEST | ( | Conv | , |
EnumClassToString | |||
) |
Definition at line 772 of file ConvTest.cpp.
TEST | ( | Conv | , |
IntegralToBool | |||
) |
TEST | ( | Conv | , |
StringToBool | |||
) |
Definition at line 828 of file ConvTest.cpp.
References folly::Range< Iter >::begin(), EXPECT_EQ, EXPECT_FALSE, EXPECT_THROW, and EXPECT_TRUE.
TEST | ( | Conv | , |
Transform | |||
) |
Definition at line 854 of file ConvTest.cpp.
References EXPECT_EQ, and folly::pushmi::operators::transform.
TEST | ( | Conv | , |
FloatToInt | |||
) |
Definition at line 862 of file ConvTest.cpp.
References EXPECT_EQ, EXPECT_THROW, f, int8_t, and max.
TEST | ( | Conv | , |
IntToFloat | |||
) |
Definition at line 873 of file ConvTest.cpp.
References EXPECT_EQ, EXPECT_THROW, int8_t, max, and min.
TEST | ( | Conv | , |
BoolToFloat | |||
) |
TEST | ( | Conv | , |
FloatToBool | |||
) |
Definition at line 898 of file ConvTest.cpp.
References ADD_FAILURE, folly::ConversionError::errorCode(), EXPECT_EQ, EXPECT_FALSE, max, min, string, and value.
TEST | ( | Conv | , |
ConversionErrorStrToBool | |||
) |
Definition at line 963 of file ConvTest.cpp.
References folly::BOOL_INVALID_VALUE, folly::BOOL_OVERFLOW, folly::EMPTY_INPUT_STRING, EXPECT_CONV_ERROR, EXPECT_CONV_ERROR_STR, EXPECT_CONV_ERROR_STR_NOVAL, and folly::NON_WHITESPACE_AFTER_END.
TEST | ( | Conv | , |
ConversionErrorStrToFloat | |||
) |
Definition at line 973 of file ConvTest.cpp.
References folly::EMPTY_INPUT_STRING, EXPECT_CONV_ERROR, EXPECT_CONV_ERROR_STR, EXPECT_CONV_ERROR_STR_NOVAL, folly::NON_WHITESPACE_AFTER_END, and folly::STRING_TO_FLOAT_ERROR.
TEST | ( | Conv | , |
ConversionErrorStrToInt | |||
) |
Definition at line 981 of file ConvTest.cpp.
References folly::EMPTY_INPUT_STRING, EXPECT_CONV_ERROR, EXPECT_CONV_ERROR_STR, EXPECT_CONV_ERROR_STR_NOVAL, int8_t, folly::INVALID_LEADING_CHAR, folly::NEGATIVE_OVERFLOW, folly::NO_DIGITS, folly::NON_DIGIT_CHAR, folly::NON_WHITESPACE_AFTER_END, folly::POSITIVE_OVERFLOW, and uint8_t.
TEST | ( | Conv | , |
ConversionErrorPtrPairToInt | |||
) |
Definition at line 1012 of file ConvTest.cpp.
References folly::demangle(), EXPECT_CONV_ERROR_PP, int8_t, folly::INVALID_LEADING_CHAR, folly::NEGATIVE_OVERFLOW, folly::NO_DIGITS, folly::NON_DIGIT_CHAR, folly::POSITIVE_OVERFLOW, string, T, uint8_t, and value.
TEST | ( | Conv | , |
ConversionErrorIntToInt | |||
) |
Definition at line 1047 of file ConvTest.cpp.
References folly::ARITH_NEGATIVE_OVERFLOW, folly::ARITH_POSITIVE_OVERFLOW, and EXPECT_CONV_ERROR_ARITH.
TEST | ( | Conv | , |
ConversionErrorFloatToFloat | |||
) |
Definition at line 1052 of file ConvTest.cpp.
References folly::ARITH_NEGATIVE_OVERFLOW, folly::ARITH_POSITIVE_OVERFLOW, EXPECT_CONV_ERROR_ARITH, and max.
TEST | ( | Conv | , |
ConversionErrorIntToFloat | |||
) |
Definition at line 1059 of file ConvTest.cpp.
References folly::ARITH_LOSS_OF_PRECISION, EXPECT_CONV_ERROR_ARITH, and max.
TEST | ( | Conv | , |
ConversionErrorFloatToInt | |||
) |
Definition at line 1064 of file ConvTest.cpp.
References folly::ARITH_LOSS_OF_PRECISION, EXPECT_CONV_ERROR_ARITH, and int8_t.
TEST | ( | Conv | , |
TryStringToBool | |||
) |
TEST | ( | Conv | , |
TryStringToInt | |||
) |
TEST | ( | Conv | , |
TryStringToEnum | |||
) |
Definition at line 1087 of file ConvTest.cpp.
References EXPECT_EQ, EXPECT_FALSE, EXPECT_TRUE, and x.
TEST | ( | Conv | , |
TryStringToFloat | |||
) |
Definition at line 1099 of file ConvTest.cpp.
References EXPECT_FALSE, EXPECT_NEAR, and EXPECT_TRUE.
TEST | ( | Conv | , |
TryStringToDouble | |||
) |
Definition at line 1107 of file ConvTest.cpp.
References EXPECT_FALSE, EXPECT_NEAR, and EXPECT_TRUE.
TEST | ( | Conv | , |
TryIntToInt | |||
) |
TEST | ( | Conv | , |
TryFloatToFloat | |||
) |
Definition at line 1123 of file ConvTest.cpp.
References EXPECT_FALSE, EXPECT_NEAR, and EXPECT_TRUE.
TEST | ( | Conv | , |
TryFloatToInt | |||
) |
TEST | ( | Conv | , |
TryIntToFloat | |||
) |
Definition at line 1139 of file ConvTest.cpp.
References EXPECT_EQ, EXPECT_FALSE, EXPECT_TRUE, and max.
TEST | ( | Conv | , |
TryPtrPairToInt | |||
) |
Definition at line 1147 of file ConvTest.cpp.
References folly::Range< Iter >::begin(), folly::Range< Iter >::end(), EXPECT_EQ, EXPECT_FALSE, and EXPECT_TRUE.
TEST | ( | Conv | , |
NewUint64ToString | |||
) |
Definition at line 1165 of file ConvTest.cpp.
References THE_GREAT_EXPECTATIONS.
TEST | ( | Conv | , |
allocate_size | |||
) |
TEST | ( | Conv | , |
custom_kkproviders | |||
) |
Definition at line 1265 of file ConvTest.cpp.
References EXPECT_EQ, EXPECT_GT, EXPECT_LT, and my::toAppend().
TEST | ( | conv | , |
custom_enumclass | |||
) |
TEST | ( | Conv | , |
TryToThenWithVoid | |||
) |
Definition at line 1286 of file ConvTest.cpp.
References EXPECT_TRUE.
TEST | ( | conv | , |
TryIntToUnscopedEnumAndBack | |||
) |
TEST | ( | conv | , |
TryIntToScopedEnumAndBack | |||
) |
void testDoubleToString | ( | ) |
Definition at line 552 of file ConvTest.cpp.
References EXPECT_EQ.
void testIdenticalTo | ( | ) |
Definition at line 482 of file ConvTest.cpp.
void testIdenticalToDelim | ( | ) |
Definition at line 504 of file ConvTest.cpp.
void testIntegral2String | ( | ) |
void testIntegral2String | ( | ) |
Definition at line 157 of file ConvTest.cpp.
References EXPECT_EQ, max, min, testIntegral2String(), type, and value.
void testStr2Bool | ( | ) |
Definition at line 791 of file ConvTest.cpp.
References EXPECT_FALSE, EXPECT_THROW, and EXPECT_TRUE.
void testString2Integral | ( | ) |
void testString2Integral | ( | ) |
Definition at line 248 of file ConvTest.cpp.
References EXPECT_EQ, EXPECT_THROW, FOR_EACH_RANGE, i, strings, testString2Integral(), type, and values().
void testVariadicTo | ( | ) |
Definition at line 490 of file ConvTest.cpp.
References EXPECT_EQ, EXPECT_TRUE, s, and my::toAppend().
void testVariadicToDelim | ( | ) |