Package com.ericsson.otp.erlang

Examples of com.ericsson.otp.erlang.OtpErlangDouble


   */
  @Test
  public void testParse6ha()
  {
    final String text = " 4.0E"+(-ErlangLabel.ErlangLong.minExponent+1)+" ";
    OtpErlangDouble number = (OtpErlangDouble)ErlangLabel.parseText(text);
    Assert.assertEquals(4d*Math.pow(10, -ErlangLabel.ErlangLong.minExponent+1),number.doubleValue(),Configuration.fpAccuracy);
    Assert.assertEquals(text.trim(),ErlangLabel.dumpErlangObject(ErlangRunner.getRunner().evaluateString(text)));
  }
View Full Code Here


 
  @Test
  public void testParse6ia()
  {
    final String text = " 4.0E"+(ErlangLabel.ErlangLong.maxExponent)+" ";
    OtpErlangDouble number = (OtpErlangDouble)ErlangLabel.parseText(text);
    Assert.assertEquals(4d*Math.pow(10, ErlangLabel.ErlangLong.maxExponent),number.doubleValue(),Configuration.fpAccuracy);
    Assert.assertEquals(text.trim(),ErlangLabel.dumpErlangObject(ErlangRunner.getRunner().evaluateString(text)));
  }
View Full Code Here

  /** Erlang refuses to parse 4e10, I think this is wrong and hence my parser accepts this. */
  @Test
  public void testParse6j()
  {
    final String text = " 4e10 ";
    OtpErlangDouble number = (OtpErlangDouble)ErlangLabel.parseText(text);
    Assert.assertEquals(4e10,number.doubleValue(),Configuration.fpAccuracy);
    checkForCorrectException(new whatToRun() { public @Override void run() {
      ErlangRunner.getRunner().evaluateString(text);
    }},RuntimeException.class,"badmatch");
  }
View Full Code Here

  }
 
  @Test
  public void testToString9()
  {
    Assert.assertEquals("-2.340000138101317E-10",ErlangLabel.dumpErlangObject(new OtpErlangDouble(-2.34e-10f)));
  }
View Full Code Here

  }
 
  @Test
  public void testToString10()
  {
    Assert.assertEquals("-2.3399999141693115",ErlangLabel.dumpErlangObject(new OtpErlangDouble(-2.34f)));
  }
View Full Code Here

  }
 
  @Test
  public void testToString11()
  {
    Assert.assertEquals("-2.34E-210",ErlangLabel.dumpErlangObject(new OtpErlangDouble(-2.34e-210)));
  }
View Full Code Here

 
  @Test
  public void testParse6a()
  {
    String text = " 458888.5";
    OtpErlangDouble number = (OtpErlangDouble)ErlangLabel.parseText(text);
    Assert.assertEquals(458888.5,number.doubleValue(),Configuration.fpAccuracy);
    Assert.assertEquals("458888.5",ErlangLabel.dumpErlangObject(ErlangRunner.getRunner().evaluateString(text)));
  }
View Full Code Here

          OtpErlangObject value = null;
          if (outcome.getClass().equals(Boolean.class))
            value = new OtpErlangBoolean(
                ((Boolean) outcome).booleanValue());
          else if (outcome.getClass().equals(Double.class))
            value = new OtpErlangDouble(
                ((Double) outcome).doubleValue());
          else if (outcome.getClass().equals(String.class))
            value = new OtpErlangAtom((String) outcome);
          else if (outcome.getClass().equals(Integer.class))
            value = new OtpErlangInt(((Integer) outcome).intValue());
View Full Code Here

  /** Erlang refuses to parse 4.e10, I think this is wrong hence my parser accepts this. */
  @Test
  public void testParse6k()
  {
    final String text = " 4.e10 ";
    OtpErlangDouble number = (OtpErlangDouble)ErlangLabel.parseText(text);
    Assert.assertEquals(4e10,number.doubleValue(),Configuration.fpAccuracy);
    checkForCorrectException(new whatToRun() { public @Override void run() {
      ErlangRunner.getRunner().evaluateString(text);
    }},RuntimeException.class,"illegal_expr");
  }
View Full Code Here

 
  @Test
  public void testParse6b()
  {
    String text = " 458888.5e0 ";
    OtpErlangDouble number = (OtpErlangDouble)ErlangLabel.parseText(text);
    Assert.assertEquals(458888.5,number.doubleValue(),Configuration.fpAccuracy);
    Assert.assertEquals("458888.5",ErlangLabel.dumpErlangObject(ErlangRunner.getRunner().evaluateString(text)));
  }
View Full Code Here

TOP

Related Classes of com.ericsson.otp.erlang.OtpErlangDouble

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.