• Home
  • Raw
  • Download

Lines Matching refs:max

56     return SrcLimits::max();  in GetMaxConvertibleToFloat()
57 Src max = SrcLimits::max() / 2 + (SrcLimits::is_integer ? 1 : 0); in GetMaxConvertibleToFloat() local
58 while (max != static_cast<Src>(static_cast<Dst>(max))) { in GetMaxConvertibleToFloat()
59 max /= 2; in GetMaxConvertibleToFloat()
61 return static_cast<Dst>(max); in GetMaxConvertibleToFloat()
196 dummy_ptr + StrictNumeric<size_t>(std::numeric_limits<size_t>::max()), in TestStrictPointerMath()
212 TEST_EXPECTED_VALUE(DstLimits::max(), in TestSpecializedArithmetic()
213 MakeCheckedNum(-DstLimits::max()).Abs()); in TestSpecializedArithmetic()
220 TEST_EXPECTED_VALUE(DstLimits::max(), in TestSpecializedArithmetic()
221 MakeClampedNum(-DstLimits::max()).Abs()); in TestSpecializedArithmetic()
223 TEST_EXPECTED_SUCCESS(CheckedNumeric<Dst>(DstLimits::max()) + -1); in TestSpecializedArithmetic()
228 TEST_EXPECTED_VALUE(DstLimits::max() - 1, in TestSpecializedArithmetic()
229 ClampedNumeric<Dst>(DstLimits::max()) + -1); in TestSpecializedArithmetic()
238 TEST_EXPECTED_FAILURE(CheckedNumeric<Dst>(DstLimits::max()) - in TestSpecializedArithmetic()
241 DstLimits::max()); in TestSpecializedArithmetic()
249 ClampedNumeric<Dst>(DstLimits::max()) - DstLimits::lowest()); in TestSpecializedArithmetic()
252 ClampedNumeric<Dst>(DstLimits::lowest()) - DstLimits::max()); in TestSpecializedArithmetic()
261 TEST_EXPECTED_VALUE(DstLimits::max(), in TestSpecializedArithmetic()
263 TEST_EXPECTED_VALUE(DstLimits::max(), in TestSpecializedArithmetic()
272 TEST_EXPECTED_VALUE(DstLimits::max(), in TestSpecializedArithmetic()
273 MakeCheckedNum(DstLimits::max()).UnsignedAbs()); in TestSpecializedArithmetic()
283 TEST_EXPECTED_VALUE(DstLimits::max(), in TestSpecializedArithmetic()
285 TEST_EXPECTED_VALUE(DstLimits::max(), in TestSpecializedArithmetic()
294 TEST_EXPECTED_VALUE(DstLimits::max(), in TestSpecializedArithmetic()
295 MakeClampedNum(DstLimits::max()).UnsignedAbs()); in TestSpecializedArithmetic()
306 TEST_EXPECTED_VALUE(1, CheckedNumeric<Dst>(DstLimits::max()) % 2); in TestSpecializedArithmetic()
322 TEST_EXPECTED_FAILURE(CheckedNumeric<Dst>(DstLimits::max()) << 1); in TestSpecializedArithmetic()
342 TEST_EXPECTED_VALUE(1, ClampedNumeric<Dst>(DstLimits::max()) % 2); in TestSpecializedArithmetic()
357 ClampedNumeric<Dst>(DstLimits::max()) << 1U); in TestSpecializedArithmetic()
399 TEST_EXPECTED_VALUE(DstLimits::max(), in TestSpecializedArithmetic()
400 MakeCheckedNum(DstLimits::max()).UnsignedAbs()); in TestSpecializedArithmetic()
422 TEST_EXPECTED_VALUE(DstLimits::max(), in TestSpecializedArithmetic()
423 MakeClampedNum(DstLimits::max()).UnsignedAbs()); in TestSpecializedArithmetic()
432 TEST_EXPECTED_VALUE(1, CheckedNumeric<Dst>(DstLimits::max()) % 2); in TestSpecializedArithmetic()
450 TEST_EXPECTED_FAILURE(CheckedNumeric<Dst>(DstLimits::max()) << 1); in TestSpecializedArithmetic()
465 TEST_EXPECTED_VALUE(std::numeric_limits<Dst>::max(), in TestSpecializedArithmetic()
466 MakeCheckedNum(DstLimits::max()) & -1); in TestSpecializedArithmetic()
471 TEST_EXPECTED_VALUE(std::numeric_limits<Dst>::max(), in TestSpecializedArithmetic()
477 TEST_EXPECTED_VALUE(std::numeric_limits<Dst>::max(), in TestSpecializedArithmetic()
479 TEST_EXPECTED_VALUE(DstLimits::max(), ~CheckedNumeric<Dst>(0)); in TestSpecializedArithmetic()
486 TEST_EXPECTED_VALUE(1, ClampedNumeric<Dst>(DstLimits::max()) % 2); in TestSpecializedArithmetic()
502 ClampedNumeric<Dst>(DstLimits::max()) << 1U); in TestSpecializedArithmetic()
516 TEST_EXPECTED_VALUE(std::numeric_limits<Dst>::max(), in TestSpecializedArithmetic()
517 MakeClampedNum(DstLimits::max()) & -1); in TestSpecializedArithmetic()
522 TEST_EXPECTED_VALUE(std::numeric_limits<Dst>::max(), in TestSpecializedArithmetic()
528 TEST_EXPECTED_VALUE(std::numeric_limits<Dst>::max(), in TestSpecializedArithmetic()
530 TEST_EXPECTED_VALUE(DstLimits::max(), ~ClampedNumeric<Dst>(0)); in TestSpecializedArithmetic()
548 TEST_EXPECTED_SUCCESS(CheckedNumeric<Dst>(DstLimits::max()) + 1); in TestSpecializedArithmetic()
552 TEST_EXPECTED_FAILURE(CheckedNumeric<Dst>(DstLimits::max()) - in TestSpecializedArithmetic()
555 DstLimits::max()); in TestSpecializedArithmetic()
561 TEST_EXPECTED_VALUE(DstLimits::max(), in TestSpecializedArithmetic()
564 TEST_EXPECTED_VALUE(DstLimits::max(), in TestSpecializedArithmetic()
570 TEST_EXPECTED_VALUE(DstLimits::max() + 1, in TestSpecializedArithmetic()
571 ClampedNumeric<Dst>(DstLimits::max()) + 1); in TestSpecializedArithmetic()
578 ClampedNumeric<Dst>(DstLimits::max()) - DstLimits::lowest()); in TestSpecializedArithmetic()
581 ClampedNumeric<Dst>(DstLimits::lowest()) - DstLimits::max()); in TestSpecializedArithmetic()
595 EXPECT_EQ(false, CheckedNumeric<Dst>(CheckedNumeric<Dst>(DstLimits::max()) * in TestArithmetic()
596 DstLimits::max()) in TestArithmetic()
601 CheckedNumeric<Dst>(CheckedNumeric<Dst>(DstLimits::max()) * in TestArithmetic()
602 DstLimits::max()) in TestArithmetic()
653 TEST_EXPECTED_VALUE(static_cast<Dst>(DstLimits::max() * -1), in TestArithmetic()
654 -CheckedNumeric<Dst>(DstLimits::max())); in TestArithmetic()
659 TEST_EXPECTED_VALUE(static_cast<Dst>(DstLimits::max() * -1), in TestArithmetic()
660 -ClampedNumeric<Dst>(DstLimits::max())); in TestArithmetic()
675 value = DstLimits::max(); in TestArithmetic()
676 TEST_EXPECTED_VALUE(Dst(DstLimits::max() * -1), -MakeClampedNum(value)); in TestArithmetic()
677 value = Dst(-1 * DstLimits::max()); in TestArithmetic()
678 TEST_EXPECTED_VALUE(DstLimits::max(), -MakeClampedNum(value)); in TestArithmetic()
680 TEST_EXPECTED_VALUE(DstLimits::max(), -MakeClampedNum(value)); in TestArithmetic()
686 TEST_EXPECTED_VALUE(DstLimits::max(), in TestArithmetic()
687 CheckedNumeric<Dst>(DstLimits::max()).Abs()); in TestArithmetic()
691 TEST_EXPECTED_VALUE(DstLimits::max(), in TestArithmetic()
692 ClampedNumeric<Dst>(DstLimits::max()).Abs()); in TestArithmetic()
700 TEST_EXPECTED_FAILURE(CheckedNumeric<Dst>(DstLimits::max()) + in TestArithmetic()
701 DstLimits::max()); in TestArithmetic()
710 ClampedNumeric<Dst>(DstLimits::max()) + DstLimits::max()); in TestArithmetic()
714 TEST_EXPECTED_SUCCESS(CheckedNumeric<Dst>(DstLimits::max()) - 1); in TestArithmetic()
719 TEST_EXPECTED_FAILURE(CheckedNumeric<Dst>(DstLimits::max()) - -1); in TestArithmetic()
723 TEST_EXPECTED_VALUE(DstLimits::max() - 1, in TestArithmetic()
724 ClampedNumeric<Dst>(DstLimits::max()) - 1); in TestArithmetic()
729 TEST_EXPECTED_VALUE(DstLimits::max(), in TestArithmetic()
730 ClampedNumeric<Dst>(DstLimits::max()) - -1); in TestArithmetic()
742 TEST_EXPECTED_FAILURE(CheckedNumeric<Dst>(DstLimits::max()) * -2); in TestArithmetic()
743 TEST_EXPECTED_FAILURE(CheckedNumeric<Dst>(DstLimits::max()) * in TestArithmetic()
746 TEST_EXPECTED_FAILURE(CheckedNumeric<Dst>(DstLimits::max()) * in TestArithmetic()
747 DstLimits::max()); in TestArithmetic()
758 ClampedNumeric<Dst>(DstLimits::max()) * -2); in TestArithmetic()
759 TEST_EXPECTED_VALUE(0, ClampedNumeric<Dst>(DstLimits::max()) * in TestArithmetic()
763 ClampedNumeric<Dst>(DstLimits::max()) * DstLimits::max()); in TestArithmetic()
770 TEST_EXPECTED_VALUE(DstLimits::max() / 2, in TestArithmetic()
771 CheckedNumeric<Dst>(DstLimits::max()) / 2); in TestArithmetic()
778 TEST_EXPECTED_VALUE(DstLimits::max() / 2, in TestArithmetic()
779 ClampedNumeric<Dst>(DstLimits::max()) / 2); in TestArithmetic()
849 static_assert(StrictNumeric<Src>(SrcLimits::lowest()) < DstLimits::max(), ""); in TestStrictComparison()
850 static_assert(StrictNumeric<Src>(SrcLimits::lowest()) < SrcLimits::max(), ""); in TestStrictComparison()
851 static_assert(!(StrictNumeric<Src>(SrcLimits::lowest()) >= DstLimits::max()), in TestStrictComparison()
853 static_assert(!(StrictNumeric<Src>(SrcLimits::lowest()) >= SrcLimits::max()), in TestStrictComparison()
855 static_assert(StrictNumeric<Src>(SrcLimits::lowest()) <= DstLimits::max(), in TestStrictComparison()
857 static_assert(StrictNumeric<Src>(SrcLimits::lowest()) <= SrcLimits::max(), in TestStrictComparison()
859 static_assert(!(StrictNumeric<Src>(SrcLimits::lowest()) > DstLimits::max()), in TestStrictComparison()
861 static_assert(!(StrictNumeric<Src>(SrcLimits::lowest()) > SrcLimits::max()), in TestStrictComparison()
863 static_assert(StrictNumeric<Src>(SrcLimits::max()) > DstLimits::lowest(), ""); in TestStrictComparison()
864 static_assert(StrictNumeric<Src>(SrcLimits::max()) > SrcLimits::lowest(), ""); in TestStrictComparison()
865 static_assert(!(StrictNumeric<Src>(SrcLimits::max()) <= DstLimits::lowest()), in TestStrictComparison()
867 static_assert(!(StrictNumeric<Src>(SrcLimits::max()) <= SrcLimits::lowest()), in TestStrictComparison()
869 static_assert(StrictNumeric<Src>(SrcLimits::max()) >= DstLimits::lowest(), in TestStrictComparison()
871 static_assert(StrictNumeric<Src>(SrcLimits::max()) >= SrcLimits::lowest(), in TestStrictComparison()
873 static_assert(!(StrictNumeric<Src>(SrcLimits::max()) < DstLimits::lowest()), in TestStrictComparison()
875 static_assert(!(StrictNumeric<Src>(SrcLimits::max()) < SrcLimits::lowest()), in TestStrictComparison()
881 static_assert(StrictNumeric<Src>(SrcLimits::max()) != static_cast<Dst>(0), in TestStrictComparison()
883 static_assert(StrictNumeric<Src>(SrcLimits::max()) != DstLimits::lowest(), in TestStrictComparison()
893 SrcLimits::max(), in TestStrictComparison()
894 MakeCheckedNum(SrcLimits::max()).Max(DstLimits::lowest()).ValueOrDie()); in TestStrictComparison()
896 DstLimits::max(), in TestStrictComparison()
897 MakeCheckedNum(SrcLimits::lowest()).Max(DstLimits::max()).ValueOrDie()); in TestStrictComparison()
900 MakeCheckedNum(SrcLimits::max()).Min(DstLimits::lowest()).ValueOrDie()); in TestStrictComparison()
903 MakeCheckedNum(SrcLimits::lowest()).Min(DstLimits::max()).ValueOrDie()); in TestStrictComparison()
905 DstLimits::max(), SrcLimits::lowest()) in TestStrictComparison()
907 EXPECT_EQ(DstLimits::max(), CheckMax(MakeStrictNum(1), MakeCheckedNum(0), in TestStrictComparison()
908 DstLimits::max(), SrcLimits::lowest()) in TestStrictComparison()
911 EXPECT_EQ(SrcLimits::max(), in TestStrictComparison()
912 MakeClampedNum(SrcLimits::max()).Max(DstLimits::lowest())); in TestStrictComparison()
913 EXPECT_EQ(DstLimits::max(), in TestStrictComparison()
914 MakeClampedNum(SrcLimits::lowest()).Max(DstLimits::max())); in TestStrictComparison()
916 MakeClampedNum(SrcLimits::max()).Min(DstLimits::lowest())); in TestStrictComparison()
918 MakeClampedNum(SrcLimits::lowest()).Min(DstLimits::max())); in TestStrictComparison()
920 ClampMin(MakeStrictNum(1), MakeClampedNum(0), DstLimits::max(), in TestStrictComparison()
922 EXPECT_EQ(DstLimits::max(), ClampMax(MakeStrictNum(1), MakeClampedNum(0), in TestStrictComparison()
923 DstLimits::max(), SrcLimits::lowest())); in TestStrictComparison()
925 if (IsValueInRangeForNumericType<Dst>(SrcLimits::max())) { in TestStrictComparison()
926 TEST_EXPECTED_VALUE(Dst(SrcLimits::max()), (CommonMax<Dst, Src>())); in TestStrictComparison()
927 TEST_EXPECTED_VALUE(Dst(SrcLimits::max()), in TestStrictComparison()
930 TEST_EXPECTED_VALUE(DstLimits::max(), (CommonMax<Dst, Src>())); in TestStrictComparison()
931 TEST_EXPECTED_VALUE(DstLimits::max(), (CommonMaxOrMin<Dst, Src>(false))); in TestStrictComparison()
963 const CheckedNumeric<Dst> checked_dst = SrcLimits::max(); in Test()
964 const ClampedNumeric<Dst> clamped_dst = SrcLimits::max(); in Test()
966 TEST_EXPECTED_VALUE(Dst(SrcLimits::max()), clamped_dst); in Test()
970 TEST_EXPECTED_SUCCESS(SrcLimits::max() * checked_dst); in Test()
971 TEST_EXPECTED_VALUE(SrcLimits::max() * clamped_dst, in Test()
972 Dst(SrcLimits::max()) * SrcLimits::max()); in Test()
974 TEST_EXPECTED_FAILURE(SrcLimits::max() * checked_dst); in Test()
977 SrcLimits::max() * clamped_dst); in Test()
978 TEST_EXPECTED_VALUE(Dst(SrcLimits::max()) + Dst(1), in Test()
986 TEST_EXPECTED_RANGE(RANGE_VALID, SrcLimits::max()); in Test()
989 TEST_EXPECTED_RANGE(RANGE_VALID, SrcLimits::max() * static_cast<Src>(-1)); in Test()
1018 TEST_EXPECTED_FAILURE(checked_dst + SrcLimits::max()); in Test()
1020 TEST_EXPECTED_FAILURE(checked_dst - SrcLimits::max()); in Test()
1023 TEST_EXPECTED_VALUE(DstLimits::Overflow(), clamped_dst + SrcLimits::max()); in Test()
1025 TEST_EXPECTED_VALUE(DstLimits::Underflow(), clamped_dst - SrcLimits::max()); in Test()
1026 clamped_dst += SrcLimits::max(); in Test()
1028 clamped_dst = DstLimits::max(); in Test()
1029 clamped_dst += SrcLimits::max(); in Test()
1031 clamped_dst = DstLimits::max(); in Test()
1032 clamped_dst -= SrcLimits::max(); in Test()
1036 TEST_EXPECTED_RANGE(RANGE_OVERFLOW, SrcLimits::max()); in Test()
1039 TEST_EXPECTED_RANGE(RANGE_UNDERFLOW, SrcLimits::max() * -1); in Test()
1047 static_cast<Src>(DstLimits::max())); in Test()
1049 TEST_EXPECTED_RANGE(RANGE_VALID, static_cast<Src>(DstLimits::max())); in Test()
1084 TEST_EXPECTED_VALUE(SrcLimits::max(), checked_dst + SrcLimits::max()); in Test()
1091 TEST_EXPECTED_VALUE(SrcLimits::max(), clamped_dst + SrcLimits::max()); in Test()
1099 TEST_EXPECTED_RANGE(RANGE_VALID, SrcLimits::max()); in Test()
1119 TEST_EXPECTED_FAILURE(checked_dst + SrcLimits::max()); in Test()
1125 TEST_EXPECTED_VALUE(DstLimits::Overflow(), clamped_dst + SrcLimits::max()); in Test()
1130 clamped_dst += SrcLimits::max(); in Test()
1132 clamped_dst = DstLimits::max(); in Test()
1133 clamped_dst += SrcLimits::max(); in Test()
1135 clamped_dst = DstLimits::max(); in Test()
1136 clamped_dst -= SrcLimits::max(); in Test()
1140 TEST_EXPECTED_RANGE(RANGE_OVERFLOW, SrcLimits::max()); in Test()
1145 EXPECT_EQ(DstLimits::max(), saturated_cast<Dst>(SrcLimits::max())); in Test()
1151 TEST_EXPECTED_RANGE(RANGE_UNDERFLOW, SrcLimits::max() * -1); in Test()
1158 static_cast<Src>(DstLimits::max())); in Test()
1160 TEST_EXPECTED_RANGE(RANGE_VALID, static_cast<Src>(DstLimits::max())); in Test()
1187 TEST_EXPECTED_FAILURE(checked_dst + SrcLimits::max()); in Test()
1192 TEST_EXPECTED_VALUE(DstLimits::Overflow(), clamped_dst + SrcLimits::max()); in Test()
1196 TEST_EXPECTED_RANGE(RANGE_OVERFLOW, SrcLimits::max()); in Test()
1200 EXPECT_EQ(DstLimits::max(), saturated_cast<Dst>(SrcLimits::max())); in Test()
1343 static constexpr T max() { return numeric_limits<T>::max() - 1; } in max() function
1344 static constexpr T Overflow() { return max(); } in Overflow()
1352 static constexpr T max() { return 10; } in max() function
1353 static constexpr T Overflow() { return max(); } in Overflow()
1368 double double_large = numeric_limits<double>::max(); in TEST()
1370 double double_large_int = numeric_limits<int>::max(); in TEST()
1394 EXPECT_FALSE(IsValueNegative(numeric_limits<int>::max())); in TEST()
1395 EXPECT_FALSE(IsValueNegative(numeric_limits<unsigned>::max())); in TEST()
1396 EXPECT_FALSE(IsValueNegative(numeric_limits<double>::max())); in TEST()
1411 EXPECT_EQ(saturated_cast<int>(double_large), numeric_limits<int>::max()); in TEST()
1416 EXPECT_EQ(numeric_limits<int>::max(), saturated_cast<int>(double_large_int)); in TEST()
1422 EXPECT_EQ(CastTest1<int>::max(), in TEST()
1424 EXPECT_EQ(CastTest1<int>::max(), in TEST()
1425 (saturated_cast<int, CastTest1>(FloatLimits::max()))); in TEST()
1426 EXPECT_EQ(CastTest1<int>::max(), in TEST()
1427 (saturated_cast<int, CastTest1>(float(IntLimits::max())))); in TEST()
1442 EXPECT_EQ(10, (saturated_cast<int, CastTest2>(FloatLimits::max()))); in TEST()
1454 auto int8_max = MakeCheckedNum(numeric_limits<int8_t>::max()); in TEST()
1455 auto double_max = MakeCheckedNum(numeric_limits<double>::max()); in TEST()
1469 EXPECT_EQ(static_cast<int>(numeric_limits<int8_t>::max()), in TEST()
1476 EXPECT_EQ(static_cast<uint8_t>(numeric_limits<int8_t>::max()), uint8_dest); in TEST()
1479 EXPECT_EQ(static_cast<int16_t>(numeric_limits<int8_t>::max()), int16_dest); in TEST()
1485 EXPECT_EQ(numeric_limits<double>::max(), double_dest); in TEST()
1585 CheckedNumeric<int> too_large = std::numeric_limits<int>::max(); in TEST()