#FEATURE by sr
authorsr
Thu, 12 Oct 2017 17:16:05 +0200
changeset 1832 672ae0ade75c
parent 1831 0d50d4ece031
child 1833 5c67361eefeb
#FEATURE by sr class: RegressionTests::IntegerTest added: #doNegate: #testNegation
RegressionTests__IntegerTest.st
--- a/RegressionTests__IntegerTest.st	Thu Oct 12 16:25:29 2017 +0200
+++ b/RegressionTests__IntegerTest.st	Thu Oct 12 17:16:05 2017 +0200
@@ -697,6 +697,10 @@
     "
 !
 
+doNegate:aNumber
+    ^ aNumber negated
+!
+
 doTestAll
     "general conversion & arithmetic tests.
      Notice, the arithmetic tests are both performed via regular sends
@@ -4147,6 +4151,11 @@
     "
 !
 
+testNegation
+    self assert:(self doNegate:SmallInteger minVal) class = LargeInteger.
+    self assert:(self doNegate:SmallInteger minVal) = (SmallInteger maxVal + 1).
+!
+
 testNextPowerOfTwo
     "/ self assert:(0 nextPowerOf2 = 0).
     self assert:(1 nextPowerOf2 = 1).