Lines Matching refs:T
44 template <typename T = int (*)(char*)>
47 explicit GenericTemporaryFile(T mk_fn = mkstemp) : mk_fn_(mk_fn) { in GenericTemporaryFile()
67 T mk_fn_;
531 template <typename T>
532 static void CheckStrToFloat(T fn(const char* s, char** end)) { in CheckStrToFloat()
533 FpUlpEq<0, T> pred; in CheckStrToFloat()
564 EXPECT_EQ(std::numeric_limits<T>::infinity(), fn("+inf", nullptr)); in CheckStrToFloat()
565 EXPECT_EQ(std::numeric_limits<T>::infinity(), fn("inf", nullptr)); in CheckStrToFloat()
566 EXPECT_EQ(-std::numeric_limits<T>::infinity(), fn("-inf", nullptr)); in CheckStrToFloat()
568 EXPECT_EQ(std::numeric_limits<T>::infinity(), fn("+infinity", nullptr)); in CheckStrToFloat()
569 EXPECT_EQ(std::numeric_limits<T>::infinity(), fn("infinity", nullptr)); in CheckStrToFloat()
570 EXPECT_EQ(-std::numeric_limits<T>::infinity(), fn("-infinity", nullptr)); in CheckStrToFloat()
572 EXPECT_EQ(std::numeric_limits<T>::infinity(), fn("+infinitude", &p)); in CheckStrToFloat()
574 EXPECT_EQ(std::numeric_limits<T>::infinity(), fn("infinitude", &p)); in CheckStrToFloat()
576 EXPECT_EQ(-std::numeric_limits<T>::infinity(), fn("-infinitude", &p)); in CheckStrToFloat()
580 EXPECT_EQ(std::numeric_limits<T>::infinity(), fn("InFiNiTy", nullptr)); in CheckStrToFloat()
826 template <typename T>
827 static void CheckStrToInt(T fn(const char* s, char** end, int base)) { in CheckStrToInt()
832 ASSERT_EQ(T(0), fn("123", &end_p, -1)); in CheckStrToInt()
837 ASSERT_EQ(T(0), fn("123", &end_p, 1)); in CheckStrToInt()
842 ASSERT_EQ(T(0), fn("123", &end_p, 37)); in CheckStrToInt()
846 ASSERT_EQ(T(-123), fn("-123", &end_p, 10)); in CheckStrToInt()
847 ASSERT_EQ(T(123), fn("+123", &end_p, 10)); in CheckStrToInt()
850 ASSERT_EQ(T(0), fn("0b", &end_p, 2)); in CheckStrToInt()
854 ASSERT_EQ(T(0b101), fn("0b101", &end_p, 0)); in CheckStrToInt()
855 ASSERT_EQ(T(0b101), fn("0B101", &end_p, 0)); in CheckStrToInt()
858 ASSERT_EQ(T(0), fn("0xy", &end_p, 16)); in CheckStrToInt()
862 ASSERT_EQ(T(0xab), fn("0xab", &end_p, 0)); in CheckStrToInt()
863 ASSERT_EQ(T(0xab), fn("0Xab", &end_p, 0)); in CheckStrToInt()
864 ASSERT_EQ(T(0xab), fn("0xAB", &end_p, 0)); in CheckStrToInt()
865 ASSERT_EQ(T(0xab), fn("0XAB", &end_p, 0)); in CheckStrToInt()
866 ASSERT_EQ(T(0xab), fn("0xAb", &end_p, 0)); in CheckStrToInt()
867 ASSERT_EQ(T(0xab), fn("0XAb", &end_p, 0)); in CheckStrToInt()
870 ASSERT_EQ(T(0666), fn("0666", &end_p, 0)); in CheckStrToInt()
872 if (std::numeric_limits<T>::is_signed) { in CheckStrToInt()
874 std::string min{std::to_string(std::numeric_limits<T>::min())}; in CheckStrToInt()
877 ASSERT_EQ(std::numeric_limits<T>::min(), fn(min.c_str(), &end_p, 0)); in CheckStrToInt()
884 ASSERT_EQ(std::numeric_limits<T>::min(), fn(min.c_str(), &end_p, 0)); in CheckStrToInt()
890 std::string max{std::to_string(std::numeric_limits<T>::max())}; in CheckStrToInt()
893 ASSERT_EQ(std::numeric_limits<T>::max(), fn(max.c_str(), &end_p, 0)); in CheckStrToInt()
900 ASSERT_EQ(std::numeric_limits<T>::max(), fn(max.c_str(), &end_p, 0)); in CheckStrToInt()
906 ASSERT_EQ(static_cast<T>(123), fn("123abc", &end_p, 0)); in CheckStrToInt()
914 ASSERT_EQ(std::numeric_limits<T>::max(), in CheckStrToInt()
918 if (std::numeric_limits<T>::is_signed) { in CheckStrToInt()
921 ASSERT_EQ(std::numeric_limits<T>::min(), in CheckStrToInt()