Skip to content

Instantly share code, notes, and snippets.

@fumokmm
Forked from kijuky/TestAmountNegative.groovy
Created May 28, 2011 16:55
Show Gist options
  • Save fumokmm/997029 to your computer and use it in GitHub Desktop.
Save fumokmm/997029 to your computer and use it in GitHub Desktop.
Amountの単項マイナス演算子のテスト(Grab版)
@GrabResolver(name='jsciencerepos', root='http://maven.obiba.org/maven2/')
@Grab('org.jscience:jscience:4.3.1')
import org.jscience.physics.amount.*
def a = Amount.valueOf("1 m")
def b = Amount.valueOf("2 m")
Amount.metaClass.negative {
opposite()
}
def c = a + -b
assert c == Amount.valueOf("-1 m")
@fumokmm
Copy link
Author

fumokmm commented May 28, 2011

jscienceのMavenリポジトリの場所がよくわからなかったので
適当にResolverで追加してあります。
動いたので良しとする。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment