📄 comparetotest.groovy
字号:
class CompareToTest extends GroovyTestCase { void testCompareTo() { def a = 12 def b = 20 def c = 30 def result = a <=> b assert result < 0 result = a <=> 12 assert result == 0 result = c <=> b assert result > 0 assert (a <=> b) < 0 assert a <=> 12 == 0 assert (c <=> b) > 0 } void testNullCompares() { def a = 123 def b = null def result = a <=> b assert result > 0 result = b <=> a assert result < 0 result = b <=> null assert result == 0 }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -