Browse Source

Extended tests for Integer class

- added tests for increment / decrement operators
Patrick 4 years ago
parent
commit
4310b11de6
1 changed files with 24 additions and 0 deletions
  1. 24 0
      test/cases/boxing/IntegerTest.cpp

+ 24 - 0
test/cases/boxing/IntegerTest.cpp

@@ -310,6 +310,30 @@ namespace
     ASSERT_FALSE(x || y);
     ASSERT_FALSE(x || y);
   }
   }
 
 
+  // increment / decrement operator
+
+  TEST_F(IntegerTest, operatorIncrement)
+  {
+    ls_std::Integer x {};
+
+    ++x;
+    ASSERT_EQ(1, x);
+
+    ++x;
+    ASSERT_EQ(2, x);
+  }
+
+  TEST_F(IntegerTest, operatorDecrement)
+  {
+    ls_std::Integer x {};
+
+    --x;
+    ASSERT_EQ(-1, x);
+
+    --x;
+    ASSERT_EQ(-2, x);
+  }
+
   // implementation
   // implementation
 
 
   TEST_F(IntegerTest, parse)
   TEST_F(IntegerTest, parse)