|
Groovy example source code file (UnaryMinusOperatorTest.groovy)
The Groovy UnaryMinusOperatorTest.groovy source code
package groovy.operator
class UnaryMinusOperatorTest extends GroovyTestCase {
void testUnaryMinus() {
def value = -1
assert value == -1
def x = value + 2
assert x == 1
def y = -value
assert y == 1
}
void testBug() {
def a = 1
def b = -a
assert b == -1
}
void testShellBug() {
assertScript("""
def a = 1
def b = -a
assert b == -1
""")
}
}
Other Groovy examples (source code examples)Here is a short list of links related to this Groovy UnaryMinusOperatorTest.groovy source code file: |
Other websites by Alvin Alexander:
Life/living in Alaska (OneMansAlaska.com)
How I Sold My Business (HowISoldMyBusiness.com)
Copyright 1998-2011 Alvin Alexander, devdaily.com
All Rights Reserved.