final Unit s = parser.parse("s"); final Unit epoch = parser.parse("s @ 1970-01-01 00:00:00 UTC"); myAssert(parser, "m m", m.multiplyBy(m)); myAssert(parser, "m.m", m.multiplyBy(m)); myAssert(parser, "(m)(m)", m.multiplyBy(m)); myAssert(parser, "m/s/s", m.divideBy(s).divideBy(s)); myAssert(parser, "m2", m.raiseTo(2)); myAssert(parser, "m2.s", m.raiseTo(2).multiplyBy(s)); myAssert(parser, "m2/s", m.raiseTo(2).divideBy(s)); myAssert(parser, "m^2/s", m.raiseTo(2).divideBy(s)); myAssert(parser, "m s @ 5", m.multiplyBy(s).shiftTo(5.0)); myAssert(parser, "m2 s @ 5", m.raiseTo(2).multiplyBy(s).shiftTo(5)); myAssert(parser, "m2 s-1 @ 5", m.raiseTo(2).multiplyBy(s.raiseTo(-1)) .shiftTo(5)); myAssert(parser, "m s from 5", m.multiplyBy(s).shiftTo(5)); myAssert(parser, "s@19700101", epoch); myAssert(parser, "s@19700101T000000", epoch); myAssert(parser, "s@19700101T000000.00", epoch); myAssert(parser, "s @ 1970-01-01T00:00:00.00", epoch); myAssert(parser, "s @ 1970-01-01 00:00:00.00", epoch); myAssert(parser, "s @ 1970-01-01 00:00:00.00 +0", epoch); myAssert(parser, "s @ 1970-01-01T00:00:00.00 -12", epoch .shiftTo(new Date(12 * 60 * 60 * 1000))); if (!parser.parse("days since 2009-06-14 04:00:00").equals( myAssert(parser, "lg(re: 1)", DerivedUnitImpl.DIMENSIONLESS.log(10)); myAssert(parser, "0.1 lg(re 1 mm)", m.multiplyBy(1e-3).log(10) .multiplyBy(0.1)); myAssert(parser, "m", m);
final Unit s = parser.parse("s"); final Unit epoch = parser.parse("s @ 1970-01-01 00:00:00 UTC"); myAssert(parser, "m m", m.multiplyBy(m)); myAssert(parser, "m.m", m.multiplyBy(m)); myAssert(parser, "(m)(m)", m.multiplyBy(m)); myAssert(parser, "m/s/s", m.divideBy(s).divideBy(s)); myAssert(parser, "m2", m.raiseTo(2)); myAssert(parser, "m2.s", m.raiseTo(2).multiplyBy(s)); myAssert(parser, "m2/s", m.raiseTo(2).divideBy(s)); myAssert(parser, "m^2/s", m.raiseTo(2).divideBy(s)); myAssert(parser, "m s @ 5", m.multiplyBy(s).shiftTo(5.0)); myAssert(parser, "m2 s @ 5", m.raiseTo(2).multiplyBy(s).shiftTo(5)); myAssert(parser, "m2 s-1 @ 5", m.raiseTo(2).multiplyBy(s.raiseTo(-1)) .shiftTo(5)); myAssert(parser, "m s from 5", m.multiplyBy(s).shiftTo(5)); myAssert(parser, "s@19700101", epoch); myAssert(parser, "s@19700101T000000", epoch); myAssert(parser, "s@19700101T000000.00", epoch); myAssert(parser, "s @ 1970-01-01T00:00:00.00", epoch); myAssert(parser, "s @ 1970-01-01 00:00:00.00", epoch); myAssert(parser, "s @ 1970-01-01 00:00:00.00 +0", epoch); myAssert(parser, "s @ 1970-01-01T00:00:00.00 -12", epoch .shiftTo(new Date(12 * 60 * 60 * 1000))); if (!parser.parse("days since 2009-06-14 04:00:00").equals( myAssert(parser, "lg(re: 1)", DerivedUnitImpl.DIMENSIONLESS.log(10)); myAssert(parser, "0.1 lg(re 1 mm)", m.multiplyBy(1e-3).log(10) .multiplyBy(0.1)); myAssert(parser, "m", m);