Browse Source

Remove logical operators from Integer class

This addresses C++ rule S919.
Patrick-Christopher Mattulat 1 year ago
parent
commit
8cf648e606

+ 1 - 8
include/ls-std/boxing/Integer.hpp

@@ -3,7 +3,7 @@
  * Company:         Lynar Studios
  * E-Mail:          webmaster@lynarstudios.com
  * Created:         2020-08-07
- * Changed:         2023-02-22
+ * Changed:         2023-05-17
  *
  * */
 
@@ -76,13 +76,6 @@ namespace ls::std::boxing
         return !_integer.value;
       }
 
-      bool operator&&(const ls::std::boxing::Integer &_integer) const;
-      bool operator&&(int _value) const;
-      bool operator&&(bool _expression) const;
-      bool operator||(const ls::std::boxing::Integer &_integer) const;
-      bool operator||(int _value) const;
-      bool operator||(bool _expression) const;
-
       // increment / decrement operator
 
       void operator++();

+ 1 - 31
source/ls-std/boxing/Integer.cpp

@@ -3,7 +3,7 @@
  * Company:         Lynar Studios
  * E-Mail:          webmaster@lynarstudios.com
  * Created:         2020-08-07
- * Changed:         2023-02-23
+ * Changed:         2023-05-17
  *
  * */
 
@@ -216,36 +216,6 @@ bool Integer::operator<=(int _value) const
   return this->value <= _value;
 }
 
-bool Integer::operator&&(const Integer &_integer) const
-{
-  return this->value && _integer.getValue();
-}
-
-bool Integer::operator&&(int _value) const
-{
-  return this->value && _value;
-}
-
-bool Integer::operator&&(bool _expression) const
-{
-  return this->value && _expression;
-}
-
-bool Integer::operator||(const Integer &_integer) const
-{
-  return this->value || _integer.getValue();
-}
-
-bool Integer::operator||(int _value) const
-{
-  return this->value || _value;
-}
-
-bool Integer::operator||(bool _expression) const
-{
-  return this->value || _expression;
-}
-
 void Integer::operator++()
 {
   this->value += 1;

+ 1 - 45
test/cases/boxing/IntegerTest.cpp

@@ -3,7 +3,7 @@
  * Company:         Lynar Studios
  * E-Mail:          webmaster@lynarstudios.com
  * Created:         2020-08-09
- * Changed:         2023-03-25
+ * Changed:         2023-05-17
  *
  * */
 
@@ -362,50 +362,6 @@ namespace
     ASSERT_TRUE(!x);
   }
 
-  TEST_F(IntegerTest, operator_and_with_reference)
-  {
-    Integer x{1};
-    Integer y{1};
-
-    ASSERT_TRUE(x && y);
-  }
-
-  TEST_F(IntegerTest, operator_and_with_value)
-  {
-    Integer x{1};
-    ASSERT_TRUE(x && 1);
-  }
-
-  TEST_F(IntegerTest, operator_and_with_boolean)
-  {
-    Integer x{1};
-    ASSERT_TRUE(x && true);
-  }
-
-  TEST_F(IntegerTest, operator_or_with_reference)
-  {
-    Integer x{};
-    Integer y{1};
-
-    ASSERT_TRUE(x || y);
-  }
-
-  TEST_F(IntegerTest, operator_or_with_value)
-  {
-    Integer x{};
-    bool orWithValue = x || 1;
-
-    ASSERT_TRUE(orWithValue);
-  }
-
-  TEST_F(IntegerTest, operator_or_with_boolean)
-  {
-    Integer x{};
-    bool orWithBoolean = x || true;
-
-    ASSERT_TRUE(orWithBoolean);
-  }
-
   // increment / decrement operator
 
   TEST_F(IntegerTest, operator_increment)