|
@@ -3,7 +3,7 @@
|
|
|
* Company: Lynar Studios
|
|
|
* E-Mail: webmaster@lynarstudios.com
|
|
|
* Created: 2020-08-17
|
|
|
- * Changed: 2023-05-17
|
|
|
+ * Changed: 2024-05-31
|
|
|
*
|
|
|
* */
|
|
|
|
|
@@ -31,7 +31,7 @@ namespace
|
|
|
TEST_F(LongTest, operator_assignment_with_reference)
|
|
|
{
|
|
|
Long x{13};
|
|
|
- Long y{3};
|
|
|
+ const Long y{3};
|
|
|
x = y;
|
|
|
|
|
|
ASSERT_EQ(3, x.getValue());
|
|
@@ -40,7 +40,7 @@ namespace
|
|
|
TEST_F(LongTest, operator_assignment_with_value)
|
|
|
{
|
|
|
Long x{13};
|
|
|
- x = (long_type) 3;
|
|
|
+ x = 3;
|
|
|
|
|
|
ASSERT_EQ(3, x.getValue());
|
|
|
}
|
|
@@ -49,8 +49,8 @@ namespace
|
|
|
|
|
|
TEST_F(LongTest, operator_negative)
|
|
|
{
|
|
|
- Long x{13};
|
|
|
- Long y{-13};
|
|
|
+ const Long x{13};
|
|
|
+ const Long y{-13};
|
|
|
|
|
|
ASSERT_EQ(-13, -x);
|
|
|
ASSERT_EQ(13, -y);
|
|
@@ -58,57 +58,57 @@ namespace
|
|
|
|
|
|
TEST_F(LongTest, operator_add_with_reference)
|
|
|
{
|
|
|
- Long x{13};
|
|
|
- Long y{7};
|
|
|
+ const Long x{13};
|
|
|
+ const Long y{7};
|
|
|
|
|
|
ASSERT_EQ(20, x + y);
|
|
|
}
|
|
|
|
|
|
TEST_F(LongTest, operator_add_with_value)
|
|
|
{
|
|
|
- Long x{13};
|
|
|
- ASSERT_EQ(20, x + (long_type) 7);
|
|
|
+ const Long x{13};
|
|
|
+ ASSERT_EQ(20, x + 7);
|
|
|
}
|
|
|
|
|
|
TEST_F(LongTest, operator_mul_with_reference)
|
|
|
{
|
|
|
- Long x{3};
|
|
|
- Long y{7};
|
|
|
+ const Long x{3};
|
|
|
+ const Long y{7};
|
|
|
|
|
|
ASSERT_EQ(21, x * y);
|
|
|
}
|
|
|
|
|
|
TEST_F(LongTest, operator_mul_with_value)
|
|
|
{
|
|
|
- Long x{3};
|
|
|
+ const Long x{3};
|
|
|
ASSERT_EQ(21, x * (long_type) 7);
|
|
|
}
|
|
|
|
|
|
TEST_F(LongTest, operator_sub_with_reference)
|
|
|
{
|
|
|
- Long x{51};
|
|
|
- Long y{17};
|
|
|
+ const Long x{51};
|
|
|
+ const Long y{17};
|
|
|
|
|
|
ASSERT_EQ(34, x - y);
|
|
|
}
|
|
|
|
|
|
TEST_F(LongTest, operator_sub_with_value)
|
|
|
{
|
|
|
- Long x{51};
|
|
|
- ASSERT_EQ(34, x - (long_type) 17);
|
|
|
+ const Long x{51};
|
|
|
+ ASSERT_EQ(34, x - 17);
|
|
|
}
|
|
|
|
|
|
TEST_F(LongTest, operator_div_with_reference)
|
|
|
{
|
|
|
- Long x{81};
|
|
|
- Long y{9};
|
|
|
+ const Long x{81};
|
|
|
+ const Long y{9};
|
|
|
|
|
|
ASSERT_EQ(9, x / y);
|
|
|
}
|
|
|
|
|
|
TEST_F(LongTest, operator_div_with_value)
|
|
|
{
|
|
|
- Long x{81};
|
|
|
+ const Long x{81};
|
|
|
ASSERT_EQ(9, x / (long_type) 9);
|
|
|
}
|
|
|
|
|
@@ -123,7 +123,7 @@ namespace
|
|
|
|
|
|
x = x / y;
|
|
|
}
|
|
|
- catch (const IllegalArithmeticOperationException &_exception)
|
|
|
+ catch ([[maybe_unused]] const IllegalArithmeticOperationException &_exception)
|
|
|
{
|
|
|
throw;
|
|
|
}
|
|
@@ -138,9 +138,9 @@ namespace
|
|
|
try
|
|
|
{
|
|
|
Long x{9};
|
|
|
- x = x / (long_type) 0;
|
|
|
+ x = x / 0;
|
|
|
}
|
|
|
- catch (const IllegalArithmeticOperationException &_exception)
|
|
|
+ catch ([[maybe_unused]] const IllegalArithmeticOperationException &_exception)
|
|
|
{
|
|
|
throw;
|
|
|
}
|
|
@@ -150,16 +150,16 @@ namespace
|
|
|
|
|
|
TEST_F(LongTest, operator_mod_with_reference)
|
|
|
{
|
|
|
- Long x{85};
|
|
|
- Long y{9};
|
|
|
+ const Long x{85};
|
|
|
+ const Long y{9};
|
|
|
|
|
|
ASSERT_EQ(4, x % y);
|
|
|
}
|
|
|
|
|
|
TEST_F(LongTest, operator_mod_with_value)
|
|
|
{
|
|
|
- Long x{85};
|
|
|
- ASSERT_EQ(4, x % (long_type) 9);
|
|
|
+ const Long x{85};
|
|
|
+ ASSERT_EQ(4, x % 9);
|
|
|
}
|
|
|
|
|
|
// compound operators
|
|
@@ -167,7 +167,7 @@ namespace
|
|
|
TEST_F(LongTest, operator_add_equals_with_reference)
|
|
|
{
|
|
|
Long x{4};
|
|
|
- Long y{2};
|
|
|
+ const Long y{2};
|
|
|
x += y;
|
|
|
|
|
|
ASSERT_EQ(6, x.getValue());
|
|
@@ -176,7 +176,7 @@ namespace
|
|
|
TEST_F(LongTest, operator_add_equals_with_value)
|
|
|
{
|
|
|
Long x{4};
|
|
|
- x += (long_type) 2;
|
|
|
+ x += 2;
|
|
|
|
|
|
ASSERT_EQ(6, x.getValue());
|
|
|
}
|
|
@@ -184,7 +184,7 @@ namespace
|
|
|
TEST_F(LongTest, operator_sub_equals_with_reference)
|
|
|
{
|
|
|
Long x{14};
|
|
|
- Long y{2};
|
|
|
+ const Long y{2};
|
|
|
x -= y;
|
|
|
|
|
|
ASSERT_EQ(12, x.getValue());
|
|
@@ -193,7 +193,7 @@ namespace
|
|
|
TEST_F(LongTest, operator_sub_equals_with_value)
|
|
|
{
|
|
|
Long x{14};
|
|
|
- x -= (long_type) 2;
|
|
|
+ x -= 2;
|
|
|
|
|
|
ASSERT_EQ(12, x.getValue());
|
|
|
}
|
|
@@ -201,7 +201,7 @@ namespace
|
|
|
TEST_F(LongTest, operator_mul_equals_with_reference)
|
|
|
{
|
|
|
Long x{6};
|
|
|
- Long y{3};
|
|
|
+ const Long y{3};
|
|
|
x *= y;
|
|
|
|
|
|
ASSERT_EQ(18, x.getValue());
|
|
@@ -210,7 +210,7 @@ namespace
|
|
|
TEST_F(LongTest, operator_mul_equals_with_value)
|
|
|
{
|
|
|
Long x{6};
|
|
|
- x *= (long_type) 3;
|
|
|
+ x *= 3;
|
|
|
|
|
|
ASSERT_EQ(18, x.getValue());
|
|
|
}
|
|
@@ -218,7 +218,7 @@ namespace
|
|
|
TEST_F(LongTest, operator_div_equals_with_reference)
|
|
|
{
|
|
|
Long x{12};
|
|
|
- Long y{3};
|
|
|
+ const Long y{3};
|
|
|
x /= y;
|
|
|
|
|
|
ASSERT_EQ(4, x.getValue());
|
|
@@ -227,7 +227,7 @@ namespace
|
|
|
TEST_F(LongTest, operator_div_equals_with_value)
|
|
|
{
|
|
|
Long x{12};
|
|
|
- x /= (long_type) 3;
|
|
|
+ x /= 3;
|
|
|
|
|
|
ASSERT_EQ(4, x.getValue());
|
|
|
}
|
|
@@ -243,7 +243,7 @@ namespace
|
|
|
|
|
|
x = x /= y;
|
|
|
}
|
|
|
- catch (const IllegalArithmeticOperationException &_exception)
|
|
|
+ catch ([[maybe_unused]] const IllegalArithmeticOperationException &_exception)
|
|
|
{
|
|
|
throw;
|
|
|
}
|
|
@@ -258,9 +258,9 @@ namespace
|
|
|
try
|
|
|
{
|
|
|
Long x{9};
|
|
|
- x = x /= (long_type) 0;
|
|
|
+ x = x /= 0;
|
|
|
}
|
|
|
- catch (const IllegalArithmeticOperationException &_exception)
|
|
|
+ catch ([[maybe_unused]] const IllegalArithmeticOperationException &_exception)
|
|
|
{
|
|
|
throw;
|
|
|
}
|
|
@@ -272,95 +272,95 @@ namespace
|
|
|
|
|
|
TEST_F(LongTest, operator_equals_with_reference)
|
|
|
{
|
|
|
- Long x{12};
|
|
|
- Long y{12};
|
|
|
+ const Long x{12};
|
|
|
+ const Long y{12};
|
|
|
|
|
|
ASSERT_TRUE(x == y);
|
|
|
}
|
|
|
|
|
|
TEST_F(LongTest, operator_equals_with_value)
|
|
|
{
|
|
|
- Long x{12};
|
|
|
- ASSERT_TRUE(x == (long_type) 12);
|
|
|
+ const Long x{12};
|
|
|
+ ASSERT_TRUE(x == 12);
|
|
|
}
|
|
|
|
|
|
TEST_F(LongTest, operator_not_equals_with_reference)
|
|
|
{
|
|
|
- Long x{12};
|
|
|
- Long y{3};
|
|
|
+ const Long x{12};
|
|
|
+ const Long y{3};
|
|
|
|
|
|
ASSERT_TRUE(x != y);
|
|
|
}
|
|
|
|
|
|
TEST_F(LongTest, operator_not_equals_with_value)
|
|
|
{
|
|
|
- Long x{12};
|
|
|
- ASSERT_TRUE(x != (long_type) 3);
|
|
|
+ const Long x{12};
|
|
|
+ ASSERT_TRUE(x != 3);
|
|
|
}
|
|
|
|
|
|
TEST_F(LongTest, operator_greater_than_with_reference)
|
|
|
{
|
|
|
- Long x{12};
|
|
|
- Long y{3};
|
|
|
+ const Long x{12};
|
|
|
+ const Long y{3};
|
|
|
|
|
|
ASSERT_TRUE(x > y);
|
|
|
}
|
|
|
|
|
|
TEST_F(LongTest, operator_greater_than_with_value)
|
|
|
{
|
|
|
- Long x{12};
|
|
|
- ASSERT_TRUE(x > (long_type) 3);
|
|
|
+ const Long x{12};
|
|
|
+ ASSERT_TRUE(x > 3);
|
|
|
}
|
|
|
|
|
|
TEST_F(LongTest, operator_greater_than_equals_with_reference)
|
|
|
{
|
|
|
- Long x{12};
|
|
|
- Long y{12};
|
|
|
+ const Long x{12};
|
|
|
+ const Long y{12};
|
|
|
|
|
|
ASSERT_TRUE(x >= y);
|
|
|
}
|
|
|
|
|
|
TEST_F(LongTest, operator_greater_than_equals_with_value)
|
|
|
{
|
|
|
- Long x{12};
|
|
|
- ASSERT_TRUE(x >= (long_type) 12);
|
|
|
+ const Long x{12};
|
|
|
+ ASSERT_TRUE(x >= 12);
|
|
|
}
|
|
|
|
|
|
TEST_F(LongTest, operator_less_than_with_reference)
|
|
|
{
|
|
|
- Long x{10};
|
|
|
- Long y{12};
|
|
|
+ const Long x{10};
|
|
|
+ const Long y{12};
|
|
|
|
|
|
ASSERT_TRUE(x < y);
|
|
|
}
|
|
|
|
|
|
TEST_F(LongTest, operator_less_than_with_value)
|
|
|
{
|
|
|
- Long x{10};
|
|
|
+ const Long x{10};
|
|
|
Long y{12};
|
|
|
|
|
|
- ASSERT_TRUE(x < (long_type) 12);
|
|
|
+ ASSERT_TRUE(x < 12);
|
|
|
}
|
|
|
|
|
|
TEST_F(LongTest, operator_less_than_equals_with_reference)
|
|
|
{
|
|
|
- Long x{10};
|
|
|
- Long y{10};
|
|
|
+ const Long x{10};
|
|
|
+ const Long y{10};
|
|
|
|
|
|
ASSERT_TRUE(x <= y);
|
|
|
}
|
|
|
|
|
|
TEST_F(LongTest, operator_less_than_equals_with_value)
|
|
|
{
|
|
|
- Long x{10};
|
|
|
- ASSERT_TRUE(x <= (long_type) 10);
|
|
|
+ const Long x{10};
|
|
|
+ ASSERT_TRUE(x <= 10);
|
|
|
}
|
|
|
|
|
|
// logical operators
|
|
|
|
|
|
TEST_F(LongTest, operator_negation)
|
|
|
{
|
|
|
- Long x{};
|
|
|
+ const Long x{};
|
|
|
ASSERT_TRUE(!x);
|
|
|
}
|
|
|
|
|
@@ -410,7 +410,7 @@ namespace
|
|
|
|
|
|
TEST_F(LongTest, getValue)
|
|
|
{
|
|
|
- Long x{3};
|
|
|
+ const Long x{3};
|
|
|
ASSERT_EQ(3, x.getValue());
|
|
|
}
|
|
|
|