Created
May 28, 2011 23:56
-
-
Save kijuky/997354 to your computer and use it in GitHub Desktop.
Amountの等値比較テスト
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.Amount | |
q = Amount.valueOf("1.0 kW") | |
dt = Amount.valueOf("1.0 K") | |
cp = q.divide(dt) | |
//assert Amount.valueOf("1.0 kW/K") != cp // なんかおかしい | |
assert !Amount.valueOf("1.0 kW/K").equals(cp) | |
assert Amount.valueOf("1.0 kW/K").approximates(cp) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment