Skip to content

Instantly share code, notes, and snippets.

@kijuky
Created May 28, 2011 16:35
Show Gist options
  • Save kijuky/997015 to your computer and use it in GitHub Desktop.
Save kijuky/997015 to your computer and use it in GitHub Desktop.
Amountの単項マイナス演算子のテスト(要JScience)
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")
@kijuky
Copy link
Author

kijuky commented May 28, 2011

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