Exemple #1
0
 @Test
 public void testParseParseMult1() {
   Parser<String, Term> p = new ExpressionParser(ucumService.getModel());
   try {
     Term t = p.parse("m.s2");
     assertNotNull(t);
     assertEquals("MULTIPLICATION", t.getOp().toString());
     Symbol s = (Symbol) t.getComp();
     Unit<?> u = s.getUnit();
     assertEquals("m", u.getSymbol());
   } catch (UOMoException e) {
     println(e.getLocalizedMessage());
     fail(e.getLocalizedMessage());
   }
 }
Exemple #2
0
 /** @see <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=371433">Bugzilla: 371433</a> */
 @Test
 public void testParseParseParenthes1() {
   Parser<String, Term> p = new ExpressionParser(ucumService.getModel());
   try {
     Term t = p.parse("kg/m/s");
     assertNotNull(t);
     assertEquals("DIVISION", t.getOp().toString());
     Symbol s = (Symbol) t.getComp();
     Unit<?> u = s.getUnit();
     assertEquals("g", u.getSymbol());
     assertEquals("k", s.getPrefix().getSymbol());
   } catch (UOMoException e) {
     println(e.getLocalizedMessage());
     fail(e.getLocalizedMessage());
   }
 }