You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by pa...@apache.org on 2015/05/21 18:52:01 UTC

incubator-groovy git commit: GROOVY-7431: Added a Abs() verifications

Repository: incubator-groovy
Updated Branches:
  refs/heads/master 7f9401599 -> 4713f5c39


GROOVY-7431: Added a Abs() verifications

As far as I know GroovyMethodsTest needs to cover all the methods from DefaultGroovyMethods.
I've created a test for GroovyMethodsTest.abs() method


Project: http://git-wip-us.apache.org/repos/asf/incubator-groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-groovy/commit/4713f5c3
Tree: http://git-wip-us.apache.org/repos/asf/incubator-groovy/tree/4713f5c3
Diff: http://git-wip-us.apache.org/repos/asf/incubator-groovy/diff/4713f5c3

Branch: refs/heads/master
Commit: 4713f5c39a1a858d9f73a326620056a71642c588
Parents: 7f94015
Author: Jonatas Emidio <jo...@gmail.com>
Authored: Thu May 21 13:41:10 2015 -0300
Committer: pascalschumacher <pa...@gmx.net>
Committed: Thu May 21 18:51:30 2015 +0200

----------------------------------------------------------------------
 src/test/groovy/GroovyMethodsTest.groovy | 12 ++++++++++++
 1 file changed, 12 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-groovy/blob/4713f5c3/src/test/groovy/GroovyMethodsTest.groovy
----------------------------------------------------------------------
diff --git a/src/test/groovy/GroovyMethodsTest.groovy b/src/test/groovy/GroovyMethodsTest.groovy
index e5cc918..b32db93 100644
--- a/src/test/groovy/GroovyMethodsTest.groovy
+++ b/src/test/groovy/GroovyMethodsTest.groovy
@@ -36,6 +36,18 @@ import org.codehaus.groovy.util.StringUtil
  * @author Yu Kobayashi
  */
 class GroovyMethodsTest extends GroovyTestCase {
+    
+    void testAbs() {
+        def absoluteNumberOne = 1
+        def negativeDouble = -1d
+        def negativeFloat = -1f
+        def negativeLong = -1l
+        
+        assert absoluteNumberOne == negativeDouble.abs()   
+        assert absoluteNumberOne == negativeFloat.abs()   
+        assert absoluteNumberOne == negativeLong.abs()   
+    }
+    
     void testCollect() {
         assert [2, 4, 6].collect {it * 2} == [4, 8, 12]
         def answer = [2, 4, 6].collect(new Vector()) {it * 2}