summaryrefslogtreecommitdiffstats
path: root/src/boost/libs/safe_numerics/test/test_float.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/boost/libs/safe_numerics/test/test_float.cpp')
-rw-r--r--src/boost/libs/safe_numerics/test/test_float.cpp36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/boost/libs/safe_numerics/test/test_float.cpp b/src/boost/libs/safe_numerics/test/test_float.cpp
new file mode 100644
index 00000000..c0e192db
--- /dev/null
+++ b/src/boost/libs/safe_numerics/test/test_float.cpp
@@ -0,0 +1,36 @@
+// Copyright (c) 2012 Robert Ramey
+//
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// testing floating point
+
+// this is a compile only test - but since many build systems
+// can't handle a compile-only test - make sure it passes trivially.
+#include <cassert>
+#include <boost/safe_numerics/safe_integer.hpp>
+
+template<typename T, typename U>
+void test(){
+ T t;
+ U u;
+ float x = t;
+ t = x;
+ t + u;
+ t - u;
+ t * u;
+ t / u;
+/**/
+ // the operators below are restricted to integral types
+}
+int main(){
+ using namespace boost::safe_numerics;
+ /*
+ test<safe<std::int8_t>, float>();
+ test<safe<std::int16_t>,float>();
+ test<safe<std::int32_t>, float>();
+ test<safe<std::int64_t>, float>();
+ */
+ return 0;
+}