|
Groovy example source code file (BinaryIntOperationsTest.groovy)
The Groovy BinaryIntOperationsTest.groovy source code
package org.codehaus.groovy.classgen.asm
/**
* @author Guillaume Laforge
*/
class BinaryIntOperationsTest extends AbstractBytecodeTestCase {
void testIntPlus() {
assert compile("""\
int i = 1
int j = 2
int k = i + j
""").hasSequence([
"ILOAD",
"ILOAD",
"IADD"
])
}
void testIntCompareLessThan() {
assert compile("""\
int i = 0
if (i < 100) println "true"
""").hasSequence([
"ILOAD",
"LDC 100",
"IF_ICMPGE"
])
}
void testCompareLessThanInClosure() {
// GROOVY-4741
assert """
int a = 0
[].each {
if (a < 0) {}
}
true
"""
}
}
Other Groovy examples (source code examples)Here is a short list of links related to this Groovy BinaryIntOperationsTest.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.