-
-
Save fumokmm/997029 to your computer and use it in GitHub Desktop.
Amountの単項マイナス演算子のテスト(Grab版)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
jscienceのMavenリポジトリの場所がよくわからなかったので
適当にResolverで追加してあります。
動いたので良しとする。