test_float.cpp 863 B

123456789101112131415161718192021222324252627282930313233343536
  1. // Copyright (c) 2012 Robert Ramey
  2. //
  3. // Distributed under the Boost Software License, Version 1.0. (See
  4. // accompanying file LICENSE_1_0.txt or copy at
  5. // http://www.boost.org/LICENSE_1_0.txt)
  6. // testing floating point
  7. // this is a compile only test - but since many build systems
  8. // can't handle a compile-only test - make sure it passes trivially.
  9. #include <cassert>
  10. #include <boost/safe_numerics/safe_integer.hpp>
  11. template<typename T, typename U>
  12. void test(){
  13. T t;
  14. U u;
  15. float x = t;
  16. t = x;
  17. t + u;
  18. t - u;
  19. t * u;
  20. t / u;
  21. /**/
  22. // the operators below are restricted to integral types
  23. }
  24. int main(){
  25. using namespace boost::safe_numerics;
  26. /*
  27. test<safe<std::int8_t>, float>();
  28. test<safe<std::int16_t>,float>();
  29. test<safe<std::int32_t>, float>();
  30. test<safe<std::int64_t>, float>();
  31. */
  32. return 0;
  33. }