@Test
public void parse() throws Exception {

    ValueType type = BitcoinMain.get();
    Value coin = type.oneCoin();
    Value cent = coin.divide(100);
    Value millicoin = coin.divide(1000);
    Value microcoin = millicoin.divide(1000);
    assertEquals(coin, NO_CODE.parse(type, "1"));
    assertEquals(coin, NO_CODE.parse(type, "1."));
    assertEquals(coin, NO_CODE.parse(type, "1.0"));
    assertEquals(coin, NO_CODE.decimalMark(',').parse(type, "1,0"));
    assertEquals(coin, NO_CODE.parse(type, "01.0000000000"));
    assertEquals(coin, NO_CODE.positiveSign('+').parse(type, "+1.0"));
    assertEquals(coin.negate(), NO_CODE.parse(type, "-1"));
    assertEquals(coin.negate(), NO_CODE.parse(type, "-1.0"));
    assertEquals(cent, NO_CODE.parse(type, ".01"));
    assertEquals(millicoin, MonetaryFormat.MBTC.parse(type, "1"));
    assertEquals(millicoin, MonetaryFormat.MBTC.parse(type, "1.0"));
    assertEquals(millicoin, MonetaryFormat.MBTC.parse(type, "01.0000000000"));
    assertEquals(millicoin, MonetaryFormat.MBTC.positiveSign('+').parse(type, "+1.0"));
    assertEquals(millicoin.negate(), MonetaryFormat.MBTC.parse(type, "-1"));
    assertEquals(millicoin.negate(), MonetaryFormat.MBTC.parse(type, "-1.0"));
    assertEquals(microcoin, MonetaryFormat.UBTC.parse(type, "1"));
    assertEquals(microcoin, MonetaryFormat.UBTC.parse(type, "1.0"));
    assertEquals(microcoin, MonetaryFormat.UBTC.parse(type, "01.0000000000"));
    assertEquals(microcoin, MonetaryFormat.UBTC.positiveSign('+').parse(type, "+1.0"));
    assertEquals(microcoin.negate(), MonetaryFormat.UBTC.parse(type, "-1"));
    assertEquals(microcoin.negate(), MonetaryFormat.UBTC.parse(type, "-1.0"));
    assertEquals(cent, NO_CODE.withLocale(new Locale("hi", "IN")).parse(type, ".०१")); // Devanagari
}