From 601eba9db1ed61569f7843efde7fc46d835d979e Mon Sep 17 00:00:00 2001
From: Steven Murray <Steven.Murray@cern.ch>
Date: Tue, 21 May 2019 10:43:00 +0200
Subject: [PATCH] Renamed utils::isValidDouble() to utils::isValidDecimal()

---
 common/utils/UtilsTest.cpp     | 20 ++++++++++----------
 common/utils/utils.cpp         |  6 +++---
 common/utils/utils.hpp         |  6 +++---
 rdbms/wrapper/PostgresRset.cpp |  4 ++--
 4 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/common/utils/UtilsTest.cpp b/common/utils/UtilsTest.cpp
index e913b00bb4..e3f1f0b0c2 100644
--- a/common/utils/UtilsTest.cpp
+++ b/common/utils/UtilsTest.cpp
@@ -484,34 +484,34 @@ TEST_F(cta_UtilsTest, toUint64_not_a_number) {
   ASSERT_THROW(utils::toUint64("one"), exception::Exception);
 }
 
-TEST_F(cta_UtilsTest, isValidDouble) {
+TEST_F(cta_UtilsTest, isValidDecimal) {
   using namespace cta;
 
-  ASSERT_TRUE(utils::isValidDouble("1.234"));
+  ASSERT_TRUE(utils::isValidDecimal("1.234"));
 }
 
-TEST_F(cta_UtilsTest, isValidDouble_empty_string) {
+TEST_F(cta_UtilsTest, isValidDecimal_empty_string) {
   using namespace cta;
 
-  ASSERT_FALSE(utils::isValidDouble(""));
+  ASSERT_FALSE(utils::isValidDecimal(""));
 }
 
-TEST_F(cta_UtilsTest, isValidDouble_negative_double) {
+TEST_F(cta_UtilsTest, isValidDecimal_negative_double) {
   using namespace cta;
 
-  ASSERT_TRUE(utils::isValidDouble("-1.234"));
+  ASSERT_TRUE(utils::isValidDecimal("-1.234"));
 }
 
-TEST_F(cta_UtilsTest, isValidDouble_not_a_number) {
+TEST_F(cta_UtilsTest, isValidDecimal_not_a_number) {
   using namespace cta;
 
-  ASSERT_FALSE(utils::isValidDouble("one"));
+  ASSERT_FALSE(utils::isValidDecimal("one"));
 }
 
-TEST_F(cta_UtilsTest, isValidDouble_two_decimal_points) {
+TEST_F(cta_UtilsTest, isValidDecimal_two_decimal_points) {
   using namespace cta;
 
-  ASSERT_FALSE(utils::isValidDouble("1.2.34"));
+  ASSERT_FALSE(utils::isValidDecimal("1.2.34"));
 }
 
 TEST_F(cta_UtilsTest, toDouble_double) {
diff --git a/common/utils/utils.cpp b/common/utils/utils.cpp
index 6d3bb155a4..ac4d0221b5 100644
--- a/common/utils/utils.cpp
+++ b/common/utils/utils.cpp
@@ -639,10 +639,10 @@ uint64_t toUint64(const std::string &str) {
 }
 
 //------------------------------------------------------------------------------
-// isValidDouble
+// isValidDecimal
 //------------------------------------------------------------------------------
-bool isValidDouble(const std::string &str) {
-  // An empty string is not a valid double
+bool isValidDecimal(const std::string &str) {
+  // An empty string is not a valid decimal
   if(str.empty()) {
     return false;
   }
diff --git a/common/utils/utils.hpp b/common/utils/utils.hpp
index 3ac5b6275e..d56e933011 100644
--- a/common/utils/utils.hpp
+++ b/common/utils/utils.hpp
@@ -281,12 +281,12 @@ namespace utils {
   uint64_t toUint64(const std::string &str);
 
   /**
-   * Checks if the specified string is a double unsigned integer.
+   * Checks if the specified string is a valid decimal.
    *
    * @param str The string to be checked.
-   * @returns true if the string is a valid double, else false.
+   * @returns true if the string is a valid decimal, else false.
    */
-  bool isValidDouble(const std::string &str);
+  bool isValidDecimal(const std::string &str);
 
   /**
    * Parses the specified string representation of a double.
diff --git a/rdbms/wrapper/PostgresRset.cpp b/rdbms/wrapper/PostgresRset.cpp
index 146db00249..8ade84da21 100644
--- a/rdbms/wrapper/PostgresRset.cpp
+++ b/rdbms/wrapper/PostgresRset.cpp
@@ -144,9 +144,9 @@ optional<double> PostgresRset::columnOptionalDouble(const std::string &colName)
 
   const std::string stringValue(PQgetvalue(m_resItr->get(), 0, ifield));
 
-  if(!utils::isValidDouble(stringValue)) {
+  if(!utils::isValidDecimal(stringValue)) {
     throw exception::Exception(std::string("Column ") + colName + " contains the value " + stringValue +
-      " which is not a valid double");
+      " which is not a valid decimal");
   }
 
   return utils::toDouble(stringValue);
-- 
GitLab