summaryrefslogtreecommitdiffstats
path: root/src/boost/libs/safe_numerics/test/test_checked_add.hpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/boost/libs/safe_numerics/test/test_checked_add.hpp44
1 files changed, 44 insertions, 0 deletions
diff --git a/src/boost/libs/safe_numerics/test/test_checked_add.hpp b/src/boost/libs/safe_numerics/test/test_checked_add.hpp
new file mode 100644
index 000000000..24411cb04
--- /dev/null
+++ b/src/boost/libs/safe_numerics/test/test_checked_add.hpp
@@ -0,0 +1,44 @@
+#ifndef BOOST_SAFE_NUMERICS_TEST_CHECKED_ADD_HPP
+#define BOOST_SAFE_NUMERICS_TEST_CHECKED_ADD_HPP
+
+// Copyright (c) 2018 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)
+
+#include "test_checked_values.hpp"
+
+// test result matrices
+
+// key
+// . success
+// - negative_overflow_error
+// + positive_overflow_error
+// ! range_error
+
+constexpr const char * signed_addition_results[] = {
+// 012345678
+/* 0*/ "!!!!!!!!!",
+/* 1*/ "!!!!!!!!!",
+/* 2*/ "!!++++++!",
+/* 3*/ "!!+++...-",
+/* 4*/ "!!++....-",
+/* 5*/ "!!+.....-",
+/* 6*/ "!!+....--",
+/* 7*/ "!!+...---",
+/* 8*/ "!!!------",
+};
+
+constexpr const char * unsigned_addition_results[] = {
+// 0123456
+/* 0*/ "!!!!!!!",
+/* 1*/ "!!!!!!!",
+/* 2*/ "!!++++!",
+/* 3*/ "!!+++.-",
+/* 4*/ "!!++..-",
+/* 5*/ "!!+...-",
+/* 6*/ "!!!----",
+};
+
+#endif // BOOST_SAFE_NUMERICS_TEST_CHECKED_ADD_HPP