Ver código fonte

Extended tests for Integer class

- added tests for increment / decrement operators
Patrick 4 anos atrás
pai
commit
4310b11de6
1 arquivos alterados com 24 adições e 0 exclusões
  1. 24 0
      test/cases/boxing/IntegerTest.cpp

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

@@ -310,6 +310,30 @@ namespace
     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
 
   TEST_F(IntegerTest, parse)