Lines Matching refs:T

525 template <typename T>
526 using WcsToIntFn = T (*)(const wchar_t*, wchar_t**, int);
528 template <typename T>
529 void TestSingleWcsToInt(WcsToIntFn<T> fn, const wchar_t* str, int base, in TestSingleWcsToInt()
530 T expected_value, ptrdiff_t expected_len) { in TestSingleWcsToInt()
536 template <typename T>
537 void TestWcsToInt(WcsToIntFn<T> fn) { in TestWcsToInt()
538 TestSingleWcsToInt(fn, L"123", 10, static_cast<T>(123), 3); in TestWcsToInt()
539 TestSingleWcsToInt(fn, L"123", 0, static_cast<T>(123), 3); in TestWcsToInt()
540 TestSingleWcsToInt(fn, L"123#", 10, static_cast<T>(123), 3); in TestWcsToInt()
541 TestSingleWcsToInt(fn, L"01000", 8, static_cast<T>(512), 5); in TestWcsToInt()
542 TestSingleWcsToInt(fn, L"01000", 0, static_cast<T>(512), 5); in TestWcsToInt()
543 TestSingleWcsToInt(fn, L" 123 45", 0, static_cast<T>(123), 6); in TestWcsToInt()
544 TestSingleWcsToInt(fn, L" -123", 0, static_cast<T>(-123), 6); in TestWcsToInt()
545 TestSingleWcsToInt(fn, L"0x10000", 0, static_cast<T>(65536), 7); in TestWcsToInt()
547 TestSingleWcsToInt(fn, L"0b1011", 0, static_cast<T>(0b1011), 6); in TestWcsToInt()
551 template <typename T>
552 void TestWcsToIntLimits(WcsToIntFn<T> fn, const wchar_t* min_str, in TestWcsToIntLimits()
554 if (std::is_signed<T>::value) { in TestWcsToIntLimits()
555 ASSERT_EQ(std::numeric_limits<T>::min(), fn(min_str, nullptr, 0)) << min_str; in TestWcsToIntLimits()
560 ASSERT_EQ(std::numeric_limits<T>::max(), fn(min_str, nullptr, 0)) << min_str; in TestWcsToIntLimits()
562 ASSERT_EQ(std::numeric_limits<T>::max(), fn(max_str, nullptr, 0)) << max_str; in TestWcsToIntLimits()
900 template <typename T>
901 using WcsToFloatFn = T (*)(const wchar_t*, wchar_t**);
903 template <typename T>
904 void TestSingleWcsToFloat(WcsToFloatFn<T> fn, const wchar_t* str, in TestSingleWcsToFloat()
905 T expected_value, ptrdiff_t expected_len) { in TestSingleWcsToFloat()
911 template <typename T>
912 void TestWcsToFloat(WcsToFloatFn<T> fn) { in TestWcsToFloat()
913 TestSingleWcsToFloat(fn, L"123", static_cast<T>(123.0L), 3); in TestWcsToFloat()
914 TestSingleWcsToFloat(fn, L"123#", static_cast<T>(123.0L), 3); in TestWcsToFloat()
915 TestSingleWcsToFloat(fn, L" 123 45", static_cast<T>(123.0L), 6); in TestWcsToFloat()
916 TestSingleWcsToFloat(fn, L"9.0", static_cast<T>(9.0L), 3); in TestWcsToFloat()
917 TestSingleWcsToFloat(fn, L"-9.0", static_cast<T>(-9.0L), 4); in TestWcsToFloat()
918 TestSingleWcsToFloat(fn, L" \t\v\f\r\n9.0", static_cast<T>(9.0L), 9); in TestWcsToFloat()
921 template <typename T>
922 void TestWcsToFloatHexFloats(WcsToFloatFn<T> fn) { in TestWcsToFloatHexFloats()
923 TestSingleWcsToFloat(fn, L"0.9e1", static_cast<T>(9.0L), 5); in TestWcsToFloatHexFloats()
924 TestSingleWcsToFloat(fn, L"0x1.2p3", static_cast<T>(9.0L), 7); in TestWcsToFloatHexFloats()
925 TestSingleWcsToFloat(fn, L"+1e+100", static_cast<T>(1e100L), 7); in TestWcsToFloatHexFloats()
926 TestSingleWcsToFloat(fn, L"0x10000.80", static_cast<T>(65536.50L), 10); in TestWcsToFloatHexFloats()
929 template <typename T>
930 void TestWcsToFloatInfNan(WcsToFloatFn<T> fn) { in TestWcsToFloatInfNan()
952 ASSERT_EQ(std::numeric_limits<T>::infinity(), fn(L"+inf", nullptr)); in TestWcsToFloatInfNan()
953 ASSERT_EQ(std::numeric_limits<T>::infinity(), fn(L"inf", nullptr)); in TestWcsToFloatInfNan()
954 ASSERT_EQ(-std::numeric_limits<T>::infinity(), fn(L"-inf", nullptr)); in TestWcsToFloatInfNan()
956 ASSERT_EQ(std::numeric_limits<T>::infinity(), fn(L"+infinity", nullptr)); in TestWcsToFloatInfNan()
957 ASSERT_EQ(std::numeric_limits<T>::infinity(), fn(L"infinity", nullptr)); in TestWcsToFloatInfNan()
958 ASSERT_EQ(-std::numeric_limits<T>::infinity(), fn(L"-infinity", nullptr)); in TestWcsToFloatInfNan()
960 ASSERT_EQ(std::numeric_limits<T>::infinity(), fn(L"+infinitude", &p)); in TestWcsToFloatInfNan()
962 ASSERT_EQ(std::numeric_limits<T>::infinity(), fn(L"infinitude", &p)); in TestWcsToFloatInfNan()
964 ASSERT_EQ(-std::numeric_limits<T>::infinity(), fn(L"-infinitude", &p)); in TestWcsToFloatInfNan()
968 ASSERT_EQ(std::numeric_limits<T>::infinity(), fn(L"InFiNiTy", nullptr)); in TestWcsToFloatInfNan()