test_checked_right_shift.hpp 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #ifndef BOOST_SAFE_NUMERICS_TEST_CHECKED_RIGHT_SHIFT_HPP
  2. #define BOOST_SAFE_NUMERICS_TEST_CHECKED_RIGHT_SHIFT_HPP
  3. // Copyright (c) 2018 Robert Ramey
  4. //
  5. // Distributed under the Boost Software License, Version 1.0. (See
  6. // accompanying file LICENSE_1_0.txt or copy at
  7. // http://www.boost.org/LICENSE_1_0.txt)
  8. #include "test_checked_values.hpp"
  9. // test result matrices
  10. // key
  11. // . success
  12. // - negative_overflow_error
  13. // + positive_overflow_error
  14. // ? range_error
  15. // n negative_shift, // negative value in shift operator
  16. // s negative_value_shift, // shift a negative value
  17. // l shift_too_large, // l/r shift exceeds variable size
  18. constexpr char const * const signed_right_shift_results[] = {
  19. // 012345678
  20. /* 0*/ "!!!!!!!!!",
  21. /* 1*/ "!!!!!!!!!",
  22. /* 2*/ "!!!++++++",
  23. /* 3*/ "!!....+++",
  24. /* 4*/ "!!.....++",
  25. /* 5*/ ".........",
  26. /* 6*/ "!!.....--",
  27. /* 7*/ "!!....---",
  28. /* 8*/ "!!!------",
  29. };
  30. constexpr char const * const unsigned_right_shift_results[] = {
  31. // 0123456
  32. /* 0*/ "!!!!!!!",
  33. /* 1*/ "!!!!!!!",
  34. /* 2*/ "!!!++++",
  35. /* 3*/ "!!....+",
  36. /* 4*/ "!!....+",
  37. /* 5*/ ".......",
  38. /* 6*/ "!!!----",
  39. };
  40. #endif // BOOST_SAFE_NUMERICS_TEST_CHECKED_RIGHT_SHIFT_HPP