• Home
  • Raw
  • Download

Lines Matching refs:Dst

46 template <typename Dst, typename Src>
47 Dst GetMaxConvertibleToFloat() { in GetMaxConvertibleToFloat()
48 using DstLimits = numeric_limits<Dst>; in GetMaxConvertibleToFloat()
55 MaxExponent<Src>::value <= MaxExponent<Dst>::value) in GetMaxConvertibleToFloat()
58 while (max != static_cast<Src>(static_cast<Dst>(max))) { in GetMaxConvertibleToFloat()
61 return static_cast<Dst>(max); in GetMaxConvertibleToFloat()
170 EXPECT_EQ(expected, (actual).template Cast<Dst>().IsValid()) \
184 template <typename Dst>
186 Dst dummy_value = 0; in TestStrictPointerMath()
187 Dst* dummy_ptr = &dummy_value; in TestStrictPointerMath()
188 static const Dst kDummyOffset = 2; // Don't want to go too far. in TestStrictPointerMath()
190 dummy_ptr + StrictNumeric<Dst>(kDummyOffset)); in TestStrictPointerMath()
192 dummy_ptr - StrictNumeric<Dst>(kDummyOffset)); in TestStrictPointerMath()
193 EXPECT_NE(dummy_ptr, dummy_ptr + StrictNumeric<Dst>(kDummyOffset)); in TestStrictPointerMath()
194 EXPECT_NE(dummy_ptr, dummy_ptr - StrictNumeric<Dst>(kDummyOffset)); in TestStrictPointerMath()
201 template <typename Dst>
205 typename std::enable_if<numeric_limits<Dst>::is_integer && in TestSpecializedArithmetic()
206 numeric_limits<Dst>::is_signed, in TestSpecializedArithmetic()
208 using DstLimits = SaturationDefaultLimits<Dst>; in TestSpecializedArithmetic()
209 TEST_EXPECTED_FAILURE(-CheckedNumeric<Dst>(DstLimits::lowest())); in TestSpecializedArithmetic()
210 TEST_EXPECTED_FAILURE(CheckedNumeric<Dst>(DstLimits::lowest()).Abs()); in TestSpecializedArithmetic()
211 TEST_EXPECTED_VALUE(1, CheckedNumeric<Dst>(-1).Abs()); in TestSpecializedArithmetic()
216 -ClampedNumeric<Dst>(DstLimits::lowest())); in TestSpecializedArithmetic()
218 ClampedNumeric<Dst>(DstLimits::lowest()).Abs()); in TestSpecializedArithmetic()
219 TEST_EXPECTED_VALUE(1, ClampedNumeric<Dst>(-1).Abs()); in TestSpecializedArithmetic()
223 TEST_EXPECTED_SUCCESS(CheckedNumeric<Dst>(DstLimits::max()) + -1); in TestSpecializedArithmetic()
224 TEST_EXPECTED_FAILURE(CheckedNumeric<Dst>(DstLimits::lowest()) + -1); in TestSpecializedArithmetic()
225 TEST_EXPECTED_FAILURE(CheckedNumeric<Dst>(DstLimits::lowest()) + in TestSpecializedArithmetic()
229 ClampedNumeric<Dst>(DstLimits::max()) + -1); in TestSpecializedArithmetic()
231 ClampedNumeric<Dst>(DstLimits::lowest()) + -1); in TestSpecializedArithmetic()
234 ClampedNumeric<Dst>(DstLimits::lowest()) + DstLimits::lowest()); in TestSpecializedArithmetic()
236 TEST_EXPECTED_FAILURE(CheckedNumeric<Dst>(DstLimits::lowest()) - 1); in TestSpecializedArithmetic()
237 TEST_EXPECTED_SUCCESS(CheckedNumeric<Dst>(DstLimits::lowest()) - -1); in TestSpecializedArithmetic()
238 TEST_EXPECTED_FAILURE(CheckedNumeric<Dst>(DstLimits::max()) - in TestSpecializedArithmetic()
240 TEST_EXPECTED_FAILURE(CheckedNumeric<Dst>(DstLimits::lowest()) - in TestSpecializedArithmetic()
244 ClampedNumeric<Dst>(DstLimits::lowest()) - 1); in TestSpecializedArithmetic()
246 ClampedNumeric<Dst>(DstLimits::lowest()) - -1); in TestSpecializedArithmetic()
249 ClampedNumeric<Dst>(DstLimits::max()) - DstLimits::lowest()); in TestSpecializedArithmetic()
252 ClampedNumeric<Dst>(DstLimits::lowest()) - DstLimits::max()); in TestSpecializedArithmetic()
254 TEST_EXPECTED_FAILURE(CheckedNumeric<Dst>(DstLimits::lowest()) * 2); in TestSpecializedArithmetic()
256 ClampedNumeric<Dst>(DstLimits::lowest()) * 2); in TestSpecializedArithmetic()
258 TEST_EXPECTED_FAILURE(CheckedNumeric<Dst>(DstLimits::lowest()) / -1); in TestSpecializedArithmetic()
259 TEST_EXPECTED_VALUE(0, CheckedNumeric<Dst>(-1) / 2); in TestSpecializedArithmetic()
260 TEST_EXPECTED_FAILURE(CheckedNumeric<Dst>(DstLimits::lowest()) * -1); in TestSpecializedArithmetic()
262 CheckedNumeric<Dst>(DstLimits::lowest() + 1) * Dst(-1)); in TestSpecializedArithmetic()
264 CheckedNumeric<Dst>(-1) * Dst(DstLimits::lowest() + 1)); in TestSpecializedArithmetic()
266 CheckedNumeric<Dst>(DstLimits::lowest()) * Dst(1)); in TestSpecializedArithmetic()
268 CheckedNumeric<Dst>(1) * Dst(DstLimits::lowest())); in TestSpecializedArithmetic()
270 typename std::make_unsigned<Dst>::type(0) - DstLimits::lowest(), in TestSpecializedArithmetic()
274 TEST_EXPECTED_VALUE(0, CheckedNumeric<Dst>(0).UnsignedAbs()); in TestSpecializedArithmetic()
275 TEST_EXPECTED_VALUE(1, CheckedNumeric<Dst>(1).UnsignedAbs()); in TestSpecializedArithmetic()
276 TEST_EXPECTED_VALUE(1, CheckedNumeric<Dst>(-1).UnsignedAbs()); in TestSpecializedArithmetic()
279 ClampedNumeric<Dst>(DstLimits::lowest()) / -1); in TestSpecializedArithmetic()
280 TEST_EXPECTED_VALUE(0, ClampedNumeric<Dst>(-1) / 2); in TestSpecializedArithmetic()
282 ClampedNumeric<Dst>(DstLimits::lowest()) * -1); in TestSpecializedArithmetic()
284 ClampedNumeric<Dst>(DstLimits::lowest() + 1) * Dst(-1)); in TestSpecializedArithmetic()
286 ClampedNumeric<Dst>(-1) * Dst(DstLimits::lowest() + 1)); in TestSpecializedArithmetic()
288 ClampedNumeric<Dst>(DstLimits::lowest()) * Dst(1)); in TestSpecializedArithmetic()
290 ClampedNumeric<Dst>(1) * Dst(DstLimits::lowest())); in TestSpecializedArithmetic()
292 typename std::make_unsigned<Dst>::type(0) - DstLimits::lowest(), in TestSpecializedArithmetic()
296 TEST_EXPECTED_VALUE(0, ClampedNumeric<Dst>(0).UnsignedAbs()); in TestSpecializedArithmetic()
297 TEST_EXPECTED_VALUE(1, ClampedNumeric<Dst>(1).UnsignedAbs()); in TestSpecializedArithmetic()
298 TEST_EXPECTED_VALUE(1, ClampedNumeric<Dst>(-1).UnsignedAbs()); in TestSpecializedArithmetic()
301 TEST_EXPECTED_VALUE(0, CheckedNumeric<Dst>() % 1); in TestSpecializedArithmetic()
302 TEST_EXPECTED_VALUE(0, CheckedNumeric<Dst>(1) % 1); in TestSpecializedArithmetic()
303 TEST_EXPECTED_VALUE(-1, CheckedNumeric<Dst>(-1) % 2); in TestSpecializedArithmetic()
304 TEST_EXPECTED_VALUE(-1, CheckedNumeric<Dst>(-1) % -2); in TestSpecializedArithmetic()
305 TEST_EXPECTED_VALUE(0, CheckedNumeric<Dst>(DstLimits::lowest()) % 2); in TestSpecializedArithmetic()
306 TEST_EXPECTED_VALUE(1, CheckedNumeric<Dst>(DstLimits::max()) % 2); in TestSpecializedArithmetic()
308 TEST_EXPECTED_VALUE(0, CheckedNumeric<Dst>(1) % CheckedNumeric<Dst>(1)); in TestSpecializedArithmetic()
309 TEST_EXPECTED_VALUE(0, 1 % CheckedNumeric<Dst>(1)); in TestSpecializedArithmetic()
310 TEST_EXPECTED_VALUE(0, CheckedNumeric<Dst>(1) % 1); in TestSpecializedArithmetic()
311 CheckedNumeric<Dst> checked_dst = 1; in TestSpecializedArithmetic()
314 TEST_EXPECTED_FAILURE(CheckedNumeric<Dst>(1) % 0); in TestSpecializedArithmetic()
316 volatile Dst negative_one = -1; in TestSpecializedArithmetic()
317 TEST_EXPECTED_FAILURE(CheckedNumeric<Dst>(1) << negative_one); in TestSpecializedArithmetic()
318 TEST_EXPECTED_FAILURE(CheckedNumeric<Dst>(1) in TestSpecializedArithmetic()
319 << (IntegerBitsPlusSign<Dst>::value - 1)); in TestSpecializedArithmetic()
320 TEST_EXPECTED_FAILURE(CheckedNumeric<Dst>(0) in TestSpecializedArithmetic()
321 << IntegerBitsPlusSign<Dst>::value); in TestSpecializedArithmetic()
322 TEST_EXPECTED_FAILURE(CheckedNumeric<Dst>(DstLimits::max()) << 1); in TestSpecializedArithmetic()
324 static_cast<Dst>(1) << (IntegerBitsPlusSign<Dst>::value - 2), in TestSpecializedArithmetic()
325 CheckedNumeric<Dst>(1) << (IntegerBitsPlusSign<Dst>::value - 2)); in TestSpecializedArithmetic()
326 TEST_EXPECTED_VALUE(0, CheckedNumeric<Dst>(0) in TestSpecializedArithmetic()
327 << (IntegerBitsPlusSign<Dst>::value - 1)); in TestSpecializedArithmetic()
328 TEST_EXPECTED_VALUE(1, CheckedNumeric<Dst>(1) << 0); in TestSpecializedArithmetic()
329 TEST_EXPECTED_VALUE(2, CheckedNumeric<Dst>(1) << 1); in TestSpecializedArithmetic()
330 TEST_EXPECTED_FAILURE(CheckedNumeric<Dst>(1) >> in TestSpecializedArithmetic()
331 IntegerBitsPlusSign<Dst>::value); in TestSpecializedArithmetic()
333 0, CheckedNumeric<Dst>(1) >> (IntegerBitsPlusSign<Dst>::value - 1)); in TestSpecializedArithmetic()
334 TEST_EXPECTED_FAILURE(CheckedNumeric<Dst>(1) >> negative_one); in TestSpecializedArithmetic()
337 TEST_EXPECTED_VALUE(0, ClampedNumeric<Dst>() % 1); in TestSpecializedArithmetic()
338 TEST_EXPECTED_VALUE(0, ClampedNumeric<Dst>(1) % 1); in TestSpecializedArithmetic()
339 TEST_EXPECTED_VALUE(-1, ClampedNumeric<Dst>(-1) % 2); in TestSpecializedArithmetic()
340 TEST_EXPECTED_VALUE(-1, ClampedNumeric<Dst>(-1) % -2); in TestSpecializedArithmetic()
341 TEST_EXPECTED_VALUE(0, ClampedNumeric<Dst>(DstLimits::lowest()) % 2); in TestSpecializedArithmetic()
342 TEST_EXPECTED_VALUE(1, ClampedNumeric<Dst>(DstLimits::max()) % 2); in TestSpecializedArithmetic()
344 TEST_EXPECTED_VALUE(0, ClampedNumeric<Dst>(1) % ClampedNumeric<Dst>(1)); in TestSpecializedArithmetic()
345 TEST_EXPECTED_VALUE(0, 1 % ClampedNumeric<Dst>(1)); in TestSpecializedArithmetic()
346 TEST_EXPECTED_VALUE(0, ClampedNumeric<Dst>(1) % 1); in TestSpecializedArithmetic()
347 ClampedNumeric<Dst> clamped_dst = 1; in TestSpecializedArithmetic()
349 TEST_EXPECTED_VALUE(Dst(1), ClampedNumeric<Dst>(1) % 0); in TestSpecializedArithmetic()
352 ClampedNumeric<Dst>(1) in TestSpecializedArithmetic()
353 << (IntegerBitsPlusSign<Dst>::value - 1U)); in TestSpecializedArithmetic()
354 TEST_EXPECTED_VALUE(Dst(0), ClampedNumeric<Dst>(0) in TestSpecializedArithmetic()
355 << (IntegerBitsPlusSign<Dst>::value + 0U)); in TestSpecializedArithmetic()
357 ClampedNumeric<Dst>(DstLimits::max()) << 1U); in TestSpecializedArithmetic()
359 static_cast<Dst>(1) << (IntegerBitsPlusSign<Dst>::value - 2U), in TestSpecializedArithmetic()
360 ClampedNumeric<Dst>(1) << (IntegerBitsPlusSign<Dst>::value - 2U)); in TestSpecializedArithmetic()
361 TEST_EXPECTED_VALUE(0, ClampedNumeric<Dst>(0) in TestSpecializedArithmetic()
362 << (IntegerBitsPlusSign<Dst>::value - 1U)); in TestSpecializedArithmetic()
363 TEST_EXPECTED_VALUE(1, ClampedNumeric<Dst>(1) << 0U); in TestSpecializedArithmetic()
364 TEST_EXPECTED_VALUE(2, ClampedNumeric<Dst>(1) << 1U); in TestSpecializedArithmetic()
366 0, ClampedNumeric<Dst>(1) >> (IntegerBitsPlusSign<Dst>::value + 0U)); in TestSpecializedArithmetic()
368 0, ClampedNumeric<Dst>(1) >> (IntegerBitsPlusSign<Dst>::value - 1U)); in TestSpecializedArithmetic()
370 -1, ClampedNumeric<Dst>(-1) >> (IntegerBitsPlusSign<Dst>::value - 1U)); in TestSpecializedArithmetic()
371 TEST_EXPECTED_VALUE(-1, ClampedNumeric<Dst>(DstLimits::lowest()) >> in TestSpecializedArithmetic()
372 (IntegerBitsPlusSign<Dst>::value - 0U)); in TestSpecializedArithmetic()
374 TestStrictPointerMath<Dst>(); in TestSpecializedArithmetic()
378 template <typename Dst>
382 typename std::enable_if<numeric_limits<Dst>::is_integer && in TestSpecializedArithmetic()
383 !numeric_limits<Dst>::is_signed, in TestSpecializedArithmetic()
385 using DstLimits = SaturationDefaultLimits<Dst>; in TestSpecializedArithmetic()
386 TEST_EXPECTED_SUCCESS(-CheckedNumeric<Dst>(DstLimits::lowest())); in TestSpecializedArithmetic()
387 TEST_EXPECTED_SUCCESS(CheckedNumeric<Dst>(DstLimits::lowest()).Abs()); in TestSpecializedArithmetic()
388 TEST_EXPECTED_FAILURE(CheckedNumeric<Dst>(DstLimits::lowest()) + -1); in TestSpecializedArithmetic()
389 TEST_EXPECTED_FAILURE(CheckedNumeric<Dst>(DstLimits::lowest()) - 1); in TestSpecializedArithmetic()
390 TEST_EXPECTED_VALUE(0, CheckedNumeric<Dst>(DstLimits::lowest()) * 2); in TestSpecializedArithmetic()
391 TEST_EXPECTED_VALUE(0, CheckedNumeric<Dst>(1) / 2); in TestSpecializedArithmetic()
392 TEST_EXPECTED_SUCCESS(CheckedNumeric<Dst>(DstLimits::lowest()).UnsignedAbs()); in TestSpecializedArithmetic()
394 CheckedNumeric<typename std::make_signed<Dst>::type>( in TestSpecializedArithmetic()
395 std::numeric_limits<typename std::make_signed<Dst>::type>::lowest()) in TestSpecializedArithmetic()
401 TEST_EXPECTED_VALUE(0, CheckedNumeric<Dst>(0).UnsignedAbs()); in TestSpecializedArithmetic()
402 TEST_EXPECTED_VALUE(1, CheckedNumeric<Dst>(1).UnsignedAbs()); in TestSpecializedArithmetic()
404 TEST_EXPECTED_VALUE(0, -ClampedNumeric<Dst>(DstLimits::lowest())); in TestSpecializedArithmetic()
405 TEST_EXPECTED_VALUE(0, ClampedNumeric<Dst>(DstLimits::lowest()).Abs()); in TestSpecializedArithmetic()
407 ClampedNumeric<Dst>(DstLimits::lowest()) + -1); in TestSpecializedArithmetic()
409 ClampedNumeric<Dst>(DstLimits::lowest()) - 1); in TestSpecializedArithmetic()
410 TEST_EXPECTED_VALUE(0, ClampedNumeric<Dst>(DstLimits::lowest()) * 2); in TestSpecializedArithmetic()
411 TEST_EXPECTED_VALUE(0, ClampedNumeric<Dst>(1) / 2); in TestSpecializedArithmetic()
413 ClampedNumeric<Dst>(DstLimits::lowest()).UnsignedAbs()); in TestSpecializedArithmetic()
416 std::numeric_limits<typename std::make_signed<Dst>::type>::lowest()), in TestSpecializedArithmetic()
417 ClampedNumeric<typename std::make_signed<Dst>::type>( in TestSpecializedArithmetic()
418 std::numeric_limits<typename std::make_signed<Dst>::type>::lowest()) in TestSpecializedArithmetic()
424 TEST_EXPECTED_VALUE(0, ClampedNumeric<Dst>(0).UnsignedAbs()); in TestSpecializedArithmetic()
425 TEST_EXPECTED_VALUE(1, ClampedNumeric<Dst>(1).UnsignedAbs()); in TestSpecializedArithmetic()
428 TEST_EXPECTED_VALUE(0, CheckedNumeric<Dst>() % 1); in TestSpecializedArithmetic()
429 TEST_EXPECTED_VALUE(0, CheckedNumeric<Dst>(1) % 1); in TestSpecializedArithmetic()
430 TEST_EXPECTED_VALUE(1, CheckedNumeric<Dst>(1) % 2); in TestSpecializedArithmetic()
431 TEST_EXPECTED_VALUE(0, CheckedNumeric<Dst>(DstLimits::lowest()) % 2); in TestSpecializedArithmetic()
432 TEST_EXPECTED_VALUE(1, CheckedNumeric<Dst>(DstLimits::max()) % 2); in TestSpecializedArithmetic()
434 TEST_EXPECTED_VALUE(0, CheckedNumeric<Dst>(1) % CheckedNumeric<Dst>(1)); in TestSpecializedArithmetic()
435 TEST_EXPECTED_VALUE(0, 1 % CheckedNumeric<Dst>(1)); in TestSpecializedArithmetic()
436 TEST_EXPECTED_VALUE(0, CheckedNumeric<Dst>(1) % 1); in TestSpecializedArithmetic()
437 CheckedNumeric<Dst> checked_dst = 1; in TestSpecializedArithmetic()
440 TEST_EXPECTED_FAILURE(CheckedNumeric<Dst>(1) % 0); in TestSpecializedArithmetic()
441 TEST_EXPECTED_FAILURE(CheckedNumeric<Dst>(1) in TestSpecializedArithmetic()
442 << IntegerBitsPlusSign<Dst>::value); in TestSpecializedArithmetic()
445 TEST_EXPECTED_FAILURE(CheckedNumeric<Dst>(1) << negative_one); in TestSpecializedArithmetic()
446 TEST_EXPECTED_FAILURE(CheckedNumeric<Dst>(1) in TestSpecializedArithmetic()
447 << IntegerBitsPlusSign<Dst>::value); in TestSpecializedArithmetic()
448 TEST_EXPECTED_FAILURE(CheckedNumeric<Dst>(0) in TestSpecializedArithmetic()
449 << IntegerBitsPlusSign<Dst>::value); in TestSpecializedArithmetic()
450 TEST_EXPECTED_FAILURE(CheckedNumeric<Dst>(DstLimits::max()) << 1); in TestSpecializedArithmetic()
452 static_cast<Dst>(1) << (IntegerBitsPlusSign<Dst>::value - 1), in TestSpecializedArithmetic()
453 CheckedNumeric<Dst>(1) << (IntegerBitsPlusSign<Dst>::value - 1)); in TestSpecializedArithmetic()
454 TEST_EXPECTED_VALUE(1, CheckedNumeric<Dst>(1) << 0); in TestSpecializedArithmetic()
455 TEST_EXPECTED_VALUE(2, CheckedNumeric<Dst>(1) << 1); in TestSpecializedArithmetic()
456 TEST_EXPECTED_FAILURE(CheckedNumeric<Dst>(1) >> in TestSpecializedArithmetic()
457 IntegerBitsPlusSign<Dst>::value); in TestSpecializedArithmetic()
459 0, CheckedNumeric<Dst>(1) >> (IntegerBitsPlusSign<Dst>::value - 1)); in TestSpecializedArithmetic()
460 TEST_EXPECTED_FAILURE(CheckedNumeric<Dst>(1) >> negative_one); in TestSpecializedArithmetic()
461 TEST_EXPECTED_VALUE(1, CheckedNumeric<Dst>(1) & 1); in TestSpecializedArithmetic()
462 TEST_EXPECTED_VALUE(0, CheckedNumeric<Dst>(1) & 0); in TestSpecializedArithmetic()
463 TEST_EXPECTED_VALUE(0, CheckedNumeric<Dst>(0) & 1); in TestSpecializedArithmetic()
464 TEST_EXPECTED_VALUE(0, CheckedNumeric<Dst>(1) & 0); in TestSpecializedArithmetic()
465 TEST_EXPECTED_VALUE(std::numeric_limits<Dst>::max(), in TestSpecializedArithmetic()
467 TEST_EXPECTED_VALUE(1, CheckedNumeric<Dst>(1) | 1); in TestSpecializedArithmetic()
468 TEST_EXPECTED_VALUE(1, CheckedNumeric<Dst>(1) | 0); in TestSpecializedArithmetic()
469 TEST_EXPECTED_VALUE(1, CheckedNumeric<Dst>(0) | 1); in TestSpecializedArithmetic()
470 TEST_EXPECTED_VALUE(0, CheckedNumeric<Dst>(0) | 0); in TestSpecializedArithmetic()
471 TEST_EXPECTED_VALUE(std::numeric_limits<Dst>::max(), in TestSpecializedArithmetic()
472 CheckedNumeric<Dst>(0) | static_cast<Dst>(-1)); in TestSpecializedArithmetic()
473 TEST_EXPECTED_VALUE(0, CheckedNumeric<Dst>(1) ^ 1); in TestSpecializedArithmetic()
474 TEST_EXPECTED_VALUE(1, CheckedNumeric<Dst>(1) ^ 0); in TestSpecializedArithmetic()
475 TEST_EXPECTED_VALUE(1, CheckedNumeric<Dst>(0) ^ 1); in TestSpecializedArithmetic()
476 TEST_EXPECTED_VALUE(0, CheckedNumeric<Dst>(0) ^ 0); in TestSpecializedArithmetic()
477 TEST_EXPECTED_VALUE(std::numeric_limits<Dst>::max(), in TestSpecializedArithmetic()
478 CheckedNumeric<Dst>(0) ^ static_cast<Dst>(-1)); in TestSpecializedArithmetic()
479 TEST_EXPECTED_VALUE(DstLimits::max(), ~CheckedNumeric<Dst>(0)); in TestSpecializedArithmetic()
482 TEST_EXPECTED_VALUE(0, ClampedNumeric<Dst>() % 1); in TestSpecializedArithmetic()
483 TEST_EXPECTED_VALUE(0, ClampedNumeric<Dst>(1) % 1); in TestSpecializedArithmetic()
484 TEST_EXPECTED_VALUE(1, ClampedNumeric<Dst>(1) % 2); in TestSpecializedArithmetic()
485 TEST_EXPECTED_VALUE(0, ClampedNumeric<Dst>(DstLimits::lowest()) % 2); in TestSpecializedArithmetic()
486 TEST_EXPECTED_VALUE(1, ClampedNumeric<Dst>(DstLimits::max()) % 2); in TestSpecializedArithmetic()
488 TEST_EXPECTED_VALUE(0, ClampedNumeric<Dst>(1) % ClampedNumeric<Dst>(1)); in TestSpecializedArithmetic()
489 TEST_EXPECTED_VALUE(0, 1 % ClampedNumeric<Dst>(1)); in TestSpecializedArithmetic()
490 TEST_EXPECTED_VALUE(0, ClampedNumeric<Dst>(1) % 1); in TestSpecializedArithmetic()
491 ClampedNumeric<Dst> clamped_dst = 1; in TestSpecializedArithmetic()
494 TEST_EXPECTED_VALUE(Dst(1), ClampedNumeric<Dst>(1) % 0); in TestSpecializedArithmetic()
497 ClampedNumeric<Dst>(1) in TestSpecializedArithmetic()
498 << as_unsigned(IntegerBitsPlusSign<Dst>::value)); in TestSpecializedArithmetic()
499 TEST_EXPECTED_VALUE(Dst(0), ClampedNumeric<Dst>(0) << as_unsigned( in TestSpecializedArithmetic()
500 IntegerBitsPlusSign<Dst>::value)); in TestSpecializedArithmetic()
502 ClampedNumeric<Dst>(DstLimits::max()) << 1U); in TestSpecializedArithmetic()
504 static_cast<Dst>(1) << (IntegerBitsPlusSign<Dst>::value - 1U), in TestSpecializedArithmetic()
505 ClampedNumeric<Dst>(1) << (IntegerBitsPlusSign<Dst>::value - 1U)); in TestSpecializedArithmetic()
506 TEST_EXPECTED_VALUE(1, ClampedNumeric<Dst>(1) << 0U); in TestSpecializedArithmetic()
507 TEST_EXPECTED_VALUE(2, ClampedNumeric<Dst>(1) << 1U); in TestSpecializedArithmetic()
508 TEST_EXPECTED_VALUE(0, ClampedNumeric<Dst>(1) >> in TestSpecializedArithmetic()
509 as_unsigned(IntegerBitsPlusSign<Dst>::value)); in TestSpecializedArithmetic()
511 0, ClampedNumeric<Dst>(1) >> (IntegerBitsPlusSign<Dst>::value - 1U)); in TestSpecializedArithmetic()
512 TEST_EXPECTED_VALUE(1, ClampedNumeric<Dst>(1) & 1); in TestSpecializedArithmetic()
513 TEST_EXPECTED_VALUE(0, ClampedNumeric<Dst>(1) & 0); in TestSpecializedArithmetic()
514 TEST_EXPECTED_VALUE(0, ClampedNumeric<Dst>(0) & 1); in TestSpecializedArithmetic()
515 TEST_EXPECTED_VALUE(0, ClampedNumeric<Dst>(1) & 0); in TestSpecializedArithmetic()
516 TEST_EXPECTED_VALUE(std::numeric_limits<Dst>::max(), in TestSpecializedArithmetic()
518 TEST_EXPECTED_VALUE(1, ClampedNumeric<Dst>(1) | 1); in TestSpecializedArithmetic()
519 TEST_EXPECTED_VALUE(1, ClampedNumeric<Dst>(1) | 0); in TestSpecializedArithmetic()
520 TEST_EXPECTED_VALUE(1, ClampedNumeric<Dst>(0) | 1); in TestSpecializedArithmetic()
521 TEST_EXPECTED_VALUE(0, ClampedNumeric<Dst>(0) | 0); in TestSpecializedArithmetic()
522 TEST_EXPECTED_VALUE(std::numeric_limits<Dst>::max(), in TestSpecializedArithmetic()
523 ClampedNumeric<Dst>(0) | static_cast<Dst>(-1)); in TestSpecializedArithmetic()
524 TEST_EXPECTED_VALUE(0, ClampedNumeric<Dst>(1) ^ 1); in TestSpecializedArithmetic()
525 TEST_EXPECTED_VALUE(1, ClampedNumeric<Dst>(1) ^ 0); in TestSpecializedArithmetic()
526 TEST_EXPECTED_VALUE(1, ClampedNumeric<Dst>(0) ^ 1); in TestSpecializedArithmetic()
527 TEST_EXPECTED_VALUE(0, ClampedNumeric<Dst>(0) ^ 0); in TestSpecializedArithmetic()
528 TEST_EXPECTED_VALUE(std::numeric_limits<Dst>::max(), in TestSpecializedArithmetic()
529 ClampedNumeric<Dst>(0) ^ static_cast<Dst>(-1)); in TestSpecializedArithmetic()
530 TEST_EXPECTED_VALUE(DstLimits::max(), ~ClampedNumeric<Dst>(0)); in TestSpecializedArithmetic()
532 TestStrictPointerMath<Dst>(); in TestSpecializedArithmetic()
536 template <typename Dst>
540 typename std::enable_if<numeric_limits<Dst>::is_iec559, int>::type = 0) { in TestSpecializedArithmetic()
541 using DstLimits = SaturationDefaultLimits<Dst>; in TestSpecializedArithmetic()
542 TEST_EXPECTED_SUCCESS(-CheckedNumeric<Dst>(DstLimits::lowest())); in TestSpecializedArithmetic()
544 TEST_EXPECTED_SUCCESS(CheckedNumeric<Dst>(DstLimits::lowest()).Abs()); in TestSpecializedArithmetic()
545 TEST_EXPECTED_VALUE(1, CheckedNumeric<Dst>(-1).Abs()); in TestSpecializedArithmetic()
547 TEST_EXPECTED_SUCCESS(CheckedNumeric<Dst>(DstLimits::lowest()) + -1); in TestSpecializedArithmetic()
548 TEST_EXPECTED_SUCCESS(CheckedNumeric<Dst>(DstLimits::max()) + 1); in TestSpecializedArithmetic()
549 TEST_EXPECTED_FAILURE(CheckedNumeric<Dst>(DstLimits::lowest()) + in TestSpecializedArithmetic()
552 TEST_EXPECTED_FAILURE(CheckedNumeric<Dst>(DstLimits::max()) - in TestSpecializedArithmetic()
554 TEST_EXPECTED_FAILURE(CheckedNumeric<Dst>(DstLimits::lowest()) - in TestSpecializedArithmetic()
557 TEST_EXPECTED_FAILURE(CheckedNumeric<Dst>(DstLimits::lowest()) * 2); in TestSpecializedArithmetic()
559 TEST_EXPECTED_VALUE(-0.5, CheckedNumeric<Dst>(-1.0) / 2); in TestSpecializedArithmetic()
562 -ClampedNumeric<Dst>(DstLimits::lowest())); in TestSpecializedArithmetic()
565 ClampedNumeric<Dst>(DstLimits::lowest()).Abs()); in TestSpecializedArithmetic()
566 TEST_EXPECTED_VALUE(1, ClampedNumeric<Dst>(-1).Abs()); in TestSpecializedArithmetic()
569 ClampedNumeric<Dst>(DstLimits::lowest()) + -1); in TestSpecializedArithmetic()
571 ClampedNumeric<Dst>(DstLimits::max()) + 1); in TestSpecializedArithmetic()
574 ClampedNumeric<Dst>(DstLimits::lowest()) + DstLimits::lowest()); in TestSpecializedArithmetic()
578 ClampedNumeric<Dst>(DstLimits::max()) - DstLimits::lowest()); in TestSpecializedArithmetic()
581 ClampedNumeric<Dst>(DstLimits::lowest()) - DstLimits::max()); in TestSpecializedArithmetic()
584 ClampedNumeric<Dst>(DstLimits::lowest()) * 2); in TestSpecializedArithmetic()
586 TEST_EXPECTED_VALUE(-0.5, ClampedNumeric<Dst>(-1.0) / 2); in TestSpecializedArithmetic()
590 template <typename Dst>
592 using DstLimits = SaturationDefaultLimits<Dst>; in TestArithmetic()
594 EXPECT_EQ(true, CheckedNumeric<Dst>().IsValid()); in TestArithmetic()
595 EXPECT_EQ(false, CheckedNumeric<Dst>(CheckedNumeric<Dst>(DstLimits::max()) * in TestArithmetic()
598 EXPECT_EQ(static_cast<Dst>(0), CheckedNumeric<Dst>().ValueOrDie()); in TestArithmetic()
599 EXPECT_EQ(static_cast<Dst>(0), CheckedNumeric<Dst>().ValueOrDefault(1)); in TestArithmetic()
600 EXPECT_EQ(static_cast<Dst>(1), in TestArithmetic()
601 CheckedNumeric<Dst>(CheckedNumeric<Dst>(DstLimits::max()) * in TestArithmetic()
606 TEST_EXPECTED_VALUE(2, CheckedNumeric<Dst>(1) + CheckedNumeric<Dst>(1)); in TestArithmetic()
607 TEST_EXPECTED_VALUE(0, CheckedNumeric<Dst>(1) - CheckedNumeric<Dst>(1)); in TestArithmetic()
608 TEST_EXPECTED_VALUE(1, CheckedNumeric<Dst>(1) * CheckedNumeric<Dst>(1)); in TestArithmetic()
609 TEST_EXPECTED_VALUE(1, CheckedNumeric<Dst>(1) / CheckedNumeric<Dst>(1)); in TestArithmetic()
610 TEST_EXPECTED_VALUE(2, 1 + CheckedNumeric<Dst>(1)); in TestArithmetic()
611 TEST_EXPECTED_VALUE(0, 1 - CheckedNumeric<Dst>(1)); in TestArithmetic()
612 TEST_EXPECTED_VALUE(1, 1 * CheckedNumeric<Dst>(1)); in TestArithmetic()
613 TEST_EXPECTED_VALUE(1, 1 / CheckedNumeric<Dst>(1)); in TestArithmetic()
614 TEST_EXPECTED_VALUE(2, CheckedNumeric<Dst>(1) + 1); in TestArithmetic()
615 TEST_EXPECTED_VALUE(0, CheckedNumeric<Dst>(1) - 1); in TestArithmetic()
616 TEST_EXPECTED_VALUE(1, CheckedNumeric<Dst>(1) * 1); in TestArithmetic()
617 TEST_EXPECTED_VALUE(1, CheckedNumeric<Dst>(1) / 1); in TestArithmetic()
618 CheckedNumeric<Dst> checked_dst = 1; in TestArithmetic()
627 TEST_EXPECTED_VALUE(2, ClampedNumeric<Dst>(1) + ClampedNumeric<Dst>(1)); in TestArithmetic()
628 TEST_EXPECTED_VALUE(0, ClampedNumeric<Dst>(1) - ClampedNumeric<Dst>(1)); in TestArithmetic()
629 TEST_EXPECTED_VALUE(1, ClampedNumeric<Dst>(1) * ClampedNumeric<Dst>(1)); in TestArithmetic()
630 TEST_EXPECTED_VALUE(1, ClampedNumeric<Dst>(1) / ClampedNumeric<Dst>(1)); in TestArithmetic()
631 TEST_EXPECTED_VALUE(2, 1 + ClampedNumeric<Dst>(1)); in TestArithmetic()
632 TEST_EXPECTED_VALUE(0, 1 - ClampedNumeric<Dst>(1)); in TestArithmetic()
633 TEST_EXPECTED_VALUE(1, 1 * ClampedNumeric<Dst>(1)); in TestArithmetic()
634 TEST_EXPECTED_VALUE(1, 1 / ClampedNumeric<Dst>(1)); in TestArithmetic()
635 TEST_EXPECTED_VALUE(2, ClampedNumeric<Dst>(1) + 1); in TestArithmetic()
636 TEST_EXPECTED_VALUE(0, ClampedNumeric<Dst>(1) - 1); in TestArithmetic()
637 TEST_EXPECTED_VALUE(1, ClampedNumeric<Dst>(1) * 1); in TestArithmetic()
638 TEST_EXPECTED_VALUE(1, ClampedNumeric<Dst>(1) / 1); in TestArithmetic()
639 ClampedNumeric<Dst> clamped_dst = 1; in TestArithmetic()
650 TEST_EXPECTED_VALUE(0, -CheckedNumeric<Dst>()); in TestArithmetic()
651 TEST_EXPECTED_VALUE(-1, -CheckedNumeric<Dst>(1)); in TestArithmetic()
652 TEST_EXPECTED_VALUE(1, -CheckedNumeric<Dst>(-1)); in TestArithmetic()
653 TEST_EXPECTED_VALUE(static_cast<Dst>(DstLimits::max() * -1), in TestArithmetic()
654 -CheckedNumeric<Dst>(DstLimits::max())); in TestArithmetic()
656 TEST_EXPECTED_VALUE(0, -ClampedNumeric<Dst>()); in TestArithmetic()
657 TEST_EXPECTED_VALUE(-1, -ClampedNumeric<Dst>(1)); in TestArithmetic()
658 TEST_EXPECTED_VALUE(1, -ClampedNumeric<Dst>(-1)); in TestArithmetic()
659 TEST_EXPECTED_VALUE(static_cast<Dst>(DstLimits::max() * -1), in TestArithmetic()
660 -ClampedNumeric<Dst>(DstLimits::max())); in TestArithmetic()
665 volatile Dst value = Dst(0); in TestArithmetic()
667 value = Dst(1); in TestArithmetic()
669 value = Dst(2); in TestArithmetic()
671 value = Dst(-1); in TestArithmetic()
673 value = Dst(-2); in TestArithmetic()
676 TEST_EXPECTED_VALUE(Dst(DstLimits::max() * -1), -MakeClampedNum(value)); in TestArithmetic()
677 value = Dst(-1 * DstLimits::max()); in TestArithmetic()
684 TEST_EXPECTED_VALUE(0, CheckedNumeric<Dst>().Abs()); in TestArithmetic()
685 TEST_EXPECTED_VALUE(1, CheckedNumeric<Dst>(1).Abs()); in TestArithmetic()
687 CheckedNumeric<Dst>(DstLimits::max()).Abs()); in TestArithmetic()
689 TEST_EXPECTED_VALUE(0, ClampedNumeric<Dst>().Abs()); in TestArithmetic()
690 TEST_EXPECTED_VALUE(1, ClampedNumeric<Dst>(1).Abs()); in TestArithmetic()
692 ClampedNumeric<Dst>(DstLimits::max()).Abs()); in TestArithmetic()
695 TEST_EXPECTED_VALUE(1, (CheckedNumeric<Dst>() + 1)); in TestArithmetic()
696 TEST_EXPECTED_VALUE(2, (CheckedNumeric<Dst>(1) + 1)); in TestArithmetic()
697 if (numeric_limits<Dst>::is_signed) in TestArithmetic()
698 TEST_EXPECTED_VALUE(0, (CheckedNumeric<Dst>(-1) + 1)); in TestArithmetic()
699 TEST_EXPECTED_SUCCESS(CheckedNumeric<Dst>(DstLimits::lowest()) + 1); in TestArithmetic()
700 TEST_EXPECTED_FAILURE(CheckedNumeric<Dst>(DstLimits::max()) + in TestArithmetic()
703 TEST_EXPECTED_VALUE(1, (ClampedNumeric<Dst>() + 1)); in TestArithmetic()
704 TEST_EXPECTED_VALUE(2, (ClampedNumeric<Dst>(1) + 1)); in TestArithmetic()
705 if (numeric_limits<Dst>::is_signed) in TestArithmetic()
706 TEST_EXPECTED_VALUE(0, (ClampedNumeric<Dst>(-1) + 1)); in TestArithmetic()
708 ClampedNumeric<Dst>(DstLimits::lowest()) + 1); in TestArithmetic()
710 ClampedNumeric<Dst>(DstLimits::max()) + DstLimits::max()); in TestArithmetic()
713 TEST_EXPECTED_VALUE(0, (CheckedNumeric<Dst>(1) - 1)); in TestArithmetic()
714 TEST_EXPECTED_SUCCESS(CheckedNumeric<Dst>(DstLimits::max()) - 1); in TestArithmetic()
715 if (numeric_limits<Dst>::is_signed) { in TestArithmetic()
716 TEST_EXPECTED_VALUE(-1, (CheckedNumeric<Dst>() - 1)); in TestArithmetic()
717 TEST_EXPECTED_VALUE(-2, (CheckedNumeric<Dst>(-1) - 1)); in TestArithmetic()
719 TEST_EXPECTED_FAILURE(CheckedNumeric<Dst>(DstLimits::max()) - -1); in TestArithmetic()
722 TEST_EXPECTED_VALUE(0, (ClampedNumeric<Dst>(1) - 1)); in TestArithmetic()
724 ClampedNumeric<Dst>(DstLimits::max()) - 1); in TestArithmetic()
725 if (numeric_limits<Dst>::is_signed) { in TestArithmetic()
726 TEST_EXPECTED_VALUE(-1, (ClampedNumeric<Dst>() - 1)); in TestArithmetic()
727 TEST_EXPECTED_VALUE(-2, (ClampedNumeric<Dst>(-1) - 1)); in TestArithmetic()
730 ClampedNumeric<Dst>(DstLimits::max()) - -1); in TestArithmetic()
734 TEST_EXPECTED_VALUE(0, (CheckedNumeric<Dst>() * 1)); in TestArithmetic()
735 TEST_EXPECTED_VALUE(1, (CheckedNumeric<Dst>(1) * 1)); in TestArithmetic()
736 TEST_EXPECTED_VALUE(0, (CheckedNumeric<Dst>(0) * 0)); in TestArithmetic()
737 if (numeric_limits<Dst>::is_signed) { in TestArithmetic()
738 TEST_EXPECTED_VALUE(0, (CheckedNumeric<Dst>(-1) * 0)); in TestArithmetic()
739 TEST_EXPECTED_VALUE(0, (CheckedNumeric<Dst>(0) * -1)); in TestArithmetic()
740 TEST_EXPECTED_VALUE(-2, (CheckedNumeric<Dst>(-1) * 2)); 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()
749 TEST_EXPECTED_VALUE(0, (ClampedNumeric<Dst>() * 1)); in TestArithmetic()
750 TEST_EXPECTED_VALUE(1, (ClampedNumeric<Dst>(1) * 1)); in TestArithmetic()
751 TEST_EXPECTED_VALUE(0, (ClampedNumeric<Dst>(0) * 0)); in TestArithmetic()
752 if (numeric_limits<Dst>::is_signed) { in TestArithmetic()
753 TEST_EXPECTED_VALUE(0, (ClampedNumeric<Dst>(-1) * 0)); in TestArithmetic()
754 TEST_EXPECTED_VALUE(0, (ClampedNumeric<Dst>(0) * -1)); in TestArithmetic()
755 TEST_EXPECTED_VALUE(-2, (ClampedNumeric<Dst>(-1) * 2)); 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()
766 TEST_EXPECTED_VALUE(0, CheckedNumeric<Dst>() / 1); in TestArithmetic()
767 TEST_EXPECTED_VALUE(1, CheckedNumeric<Dst>(1) / 1); in TestArithmetic()
769 CheckedNumeric<Dst>(DstLimits::lowest()) / 2); in TestArithmetic()
771 CheckedNumeric<Dst>(DstLimits::max()) / 2); in TestArithmetic()
772 TEST_EXPECTED_FAILURE(CheckedNumeric<Dst>(1) / 0); in TestArithmetic()
774 TEST_EXPECTED_VALUE(0, ClampedNumeric<Dst>() / 1); in TestArithmetic()
775 TEST_EXPECTED_VALUE(1, ClampedNumeric<Dst>(1) / 1); in TestArithmetic()
777 ClampedNumeric<Dst>(DstLimits::lowest()) / 2); in TestArithmetic()
779 ClampedNumeric<Dst>(DstLimits::max()) / 2); in TestArithmetic()
780 TEST_EXPECTED_VALUE(DstLimits::Overflow(), ClampedNumeric<Dst>(1) / 0); in TestArithmetic()
781 TEST_EXPECTED_VALUE(DstLimits::Underflow(), ClampedNumeric<Dst>(-1) / 0); in TestArithmetic()
782 TEST_EXPECTED_VALUE(0, ClampedNumeric<Dst>(0) / 0); in TestArithmetic()
784 TestSpecializedArithmetic<Dst>(dst, line); in TestArithmetic()
788 #define TEST_ARITHMETIC(Dst) TestArithmetic<Dst>(#Dst, __LINE__) argument
821 template <typename Dst, typename Src, NumericConversionType conversion>
841 RangeCheckToEnum(DstRangeRelationToSrcRange<Dst>(actual))) \
845 template <typename Dst, typename Src>
847 using DstLimits = numeric_limits<Dst>; in TestStrictComparison()
877 static_assert(StrictNumeric<Src>(static_cast<Src>(1)) == static_cast<Dst>(1), in TestStrictComparison()
879 static_assert(StrictNumeric<Src>(static_cast<Src>(1)) != static_cast<Dst>(0), in TestStrictComparison()
881 static_assert(StrictNumeric<Src>(SrcLimits::max()) != static_cast<Dst>(0), in TestStrictComparison()
886 !(StrictNumeric<Src>(static_cast<Src>(1)) != static_cast<Dst>(1)), ""); in TestStrictComparison()
888 !(StrictNumeric<Src>(static_cast<Src>(1)) == static_cast<Dst>(0)), ""); 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()
928 (CommonMaxOrMin<Dst, Src>(false))); 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()
934 if (IsValueInRangeForNumericType<Dst>(SrcLimits::lowest())) { in TestStrictComparison()
935 TEST_EXPECTED_VALUE(Dst(SrcLimits::lowest()), (CommonMin<Dst, Src>())); in TestStrictComparison()
936 TEST_EXPECTED_VALUE(Dst(SrcLimits::lowest()), in TestStrictComparison()
937 (CommonMaxOrMin<Dst, Src>(true))); in TestStrictComparison()
939 TEST_EXPECTED_VALUE(DstLimits::lowest(), (CommonMin<Dst, Src>())); in TestStrictComparison()
940 TEST_EXPECTED_VALUE(DstLimits::lowest(), (CommonMaxOrMin<Dst, Src>(true))); in TestStrictComparison()
944 template <typename Dst, typename Src>
945 struct TestNumericConversion<Dst, Src, SIGN_PRESERVING_VALUE_PRESERVING> {
948 using DstLimits = SaturationDefaultLimits<Dst>; in Test()
955 MaxExponent<Dst>::value >= MaxExponent<Src>::value) || in Test()
958 MaxExponent<Dst>::value >= MaxExponent<Src>::value))), in Test()
961 TestStrictComparison<Dst, Src>(dst, src, line); in Test()
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()
967 if (MaxExponent<Dst>::value > MaxExponent<Src>::value) { in Test()
968 if (MaxExponent<Dst>::value >= MaxExponent<Src>::value * 2 - 1) { in Test()
972 Dst(SrcLimits::max()) * SrcLimits::max()); in Test()
978 TEST_EXPECTED_VALUE(Dst(SrcLimits::max()) + Dst(1), in Test()
979 clamped_dst + Dst(1)); in Test()
983 TEST_EXPECTED_VALUE(DstLimits::Overflow(), clamped_dst + Dst(1)); in Test()
996 if (!std::is_same<Src, Dst>::value) { in Test()
997 TEST_EXPECTED_SUCCESS(CheckDiv(SrcLimits::lowest(), Dst(-1))); in Test()
1005 template <typename Dst, typename Src>
1006 struct TestNumericConversion<Dst, Src, SIGN_PRESERVING_NARROW> {
1009 using DstLimits = SaturationDefaultLimits<Dst>; in Test()
1012 static_assert(MaxExponent<Dst>::value <= MaxExponent<Src>::value, in Test()
1015 TestStrictComparison<Dst, Src>(dst, src, line); in Test()
1017 const CheckedNumeric<Dst> checked_dst; in Test()
1022 ClampedNumeric<Dst> clamped_dst; in Test()
1053 static_cast<Src>(GetMaxConvertibleToFloat<Src, Dst>())); in Test()
1065 TEST_EXPECTED_VALUE(Dst(0), clamped_dst - static_cast<Src>(1)); in Test()
1071 template <typename Dst, typename Src>
1072 struct TestNumericConversion<Dst, Src, SIGN_TO_UNSIGN_WIDEN_OR_EQUAL> {
1075 using DstLimits = SaturationDefaultLimits<Dst>; in Test()
1076 static_assert(MaxExponent<Dst>::value >= MaxExponent<Src>::value, in Test()
1081 TestStrictComparison<Dst, Src>(dst, src, line); in Test()
1083 const CheckedNumeric<Dst> checked_dst; in Test()
1088 TEST_EXPECTED_VALUE(Dst(0), CheckDiv(Dst(0), Src(-1))); in Test()
1090 const ClampedNumeric<Dst> clamped_dst; in Test()
1105 template <typename Dst, typename Src>
1106 struct TestNumericConversion<Dst, Src, SIGN_TO_UNSIGN_NARROW> {
1109 using DstLimits = SaturationDefaultLimits<Dst>; in Test()
1110 static_assert(MaxExponent<Dst>::value < MaxExponent<Src>::value, in Test()
1115 TestStrictComparison<Dst, Src>(dst, src, line); in Test()
1117 const CheckedNumeric<Dst> checked_dst; in Test()
1123 ClampedNumeric<Dst> clamped_dst; in Test()
1145 EXPECT_EQ(DstLimits::max(), saturated_cast<Dst>(SrcLimits::max())); in Test()
1146 EXPECT_EQ(DstLimits::lowest(), saturated_cast<Dst>(SrcLimits::lowest())); in Test()
1149 EXPECT_EQ(Dst(0), saturated_cast<Dst>(SrcLimits::quiet_NaN())); in Test()
1164 static_cast<Src>(GetMaxConvertibleToFloat<Src, Dst>())); in Test()
1173 template <typename Dst, typename Src>
1174 struct TestNumericConversion<Dst, Src, UNSIGN_TO_SIGN_NARROW_OR_EQUAL> {
1177 using DstLimits = SaturationDefaultLimits<Dst>; in Test()
1178 static_assert(MaxExponent<Dst>::value <= MaxExponent<Src>::value, in Test()
1183 TestStrictComparison<Dst, Src>(dst, src, line); in Test()
1185 const CheckedNumeric<Dst> checked_dst; in Test()
1190 const ClampedNumeric<Dst> clamped_dst; in Test()
1200 EXPECT_EQ(DstLimits::max(), saturated_cast<Dst>(SrcLimits::max())); in Test()
1201 EXPECT_EQ(Dst(0), saturated_cast<Dst>(SrcLimits::lowest())); in Test()