lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [lmi] master 5a2361a 2/4: Laconize a diagnostic


From: Greg Chicares
Subject: [lmi-commits] [lmi] master 5a2361a 2/4: Laconize a diagnostic
Date: Fri, 31 Mar 2017 10:05:38 -0400 (EDT)

branch: master
commit 5a2361aeb7e5b93a4478ff3358837b0929fa09c9
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>

    Laconize a diagnostic
---
 bourn_cast.hpp      |  2 +-
 bourn_cast_test.cpp | 10 +++++-----
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/bourn_cast.hpp b/bourn_cast.hpp
index eca91cc..919de4c 100644
--- a/bourn_cast.hpp
+++ b/bourn_cast.hpp
@@ -88,7 +88,7 @@ inline To bourn_cast(From from)
 #   endif // 5 <= __GNUC__
 #endif // defined __GNUC__
     if(! to_traits::is_signed && from < 0)
-        throw std::runtime_error("Cast would convert negative to unsigned.");
+        throw std::runtime_error("Cannot cast negative to unsigned.");
     if(from_traits::is_signed && from < to_traits::lowest())
         throw std::runtime_error("Cast would transgress lower limit.");
     if(to_traits::max() < from)
diff --git a/bourn_cast_test.cpp b/bourn_cast_test.cpp
index 1732e98..78e11a5 100644
--- a/bourn_cast_test.cpp
+++ b/bourn_cast_test.cpp
@@ -253,7 +253,7 @@ int test_main(int, char*[])
     BOOST_TEST_THROW
         (bourn_cast<bool>((signed char)(-1))
         ,std::runtime_error
-        ,"Cast would convert negative to unsigned."
+        ,"Cannot cast negative to unsigned."
         );
 
     // Cast from signed to unsigned.
@@ -277,27 +277,27 @@ int test_main(int, char*[])
     BOOST_TEST_THROW
         (bourn_cast<unsigned char>(std::numeric_limits<signed char>::lowest())
         ,std::runtime_error
-        ,"Cast would convert negative to unsigned."
+        ,"Cannot cast negative to unsigned."
         );
 
     BOOST_TEST_THROW
         (bourn_cast<unsigned int >(std::numeric_limits<signed int >::lowest())
         ,std::runtime_error
-        ,"Cast would convert negative to unsigned."
+        ,"Cannot cast negative to unsigned."
         );
 
     // Still forbidden even if unsigned type is wider.
     BOOST_TEST_THROW
         (bourn_cast<unsigned long>(std::numeric_limits<signed char>::lowest())
         ,std::runtime_error
-        ,"Cast would convert negative to unsigned."
+        ,"Cannot cast negative to unsigned."
         );
 
     // Still forbidden even if value is only "slightly" negative.
     BOOST_TEST_THROW
         (bourn_cast<unsigned long>(-1)
         ,std::runtime_error
-        ,"Cast would convert negative to unsigned."
+        ,"Cannot cast negative to unsigned."
         );
 
     // Transgress lower limit. It is not possible to write a unit test



reply via email to

[Prev in Thread] Current Thread [Next in Thread]