Package org.apache.flex.compiler.tree.mxml

Examples of org.apache.flex.compiler.tree.mxml.IMXMLNumberNode


public class MXMLNumberNodeTests extends MXMLExpressionNodeBaseTests
{
  private IMXMLNumberNode getMXMLNumberNode(String[] code)
  {
    IMXMLFileNode fileNode = getMXMLFileNode(code);
    IMXMLNumberNode node = (IMXMLNumberNode)findFirstDescendantOfType(fileNode, IMXMLNumberNode.class);
    assertThat("getNodeID", node.getNodeID(), is(ASTNodeID.MXMLNumberID));
    assertThat("getName", node.getName(), is("Number"));
    return node;
  }


  {
    String[] code = new String[]
    {
        "<fx:Number/>"
    };
    IMXMLNumberNode node = getMXMLNumberNode(code);
    assertThat("getValue", node.getValue(), is(Double.NaN));
    //assertThat("getExpressionNode", node.getExpressionNode(), is((IASNode)null));
  }

  {
    String[] code = new String[]
    {
        "<fx:Number></fx:Number>"
    };
    IMXMLNumberNode node = getMXMLNumberNode(code);
    assertThat("getValue", node.getValue(), is(Double.NaN));
    //assertThat("getExpressionNode", node.getExpressionNode(), is((IASNode)null));
  }

  {
    String[] code = new String[]
    {
        "<fx:Number> \t\r\n</fx:Number>"
    };
    IMXMLNumberNode node = getMXMLNumberNode(code);
    assertThat("getValue", node.getValue(), is(Double.NaN));
    //assertThat("getExpressionNode", node.getExpressionNode(), is((IASNode)null));
  }

  {
    String[] code = new String[]
    {
        "<fx:Number> 1 </fx:Number>"
    };
    IMXMLNumberNode node = getMXMLNumberNode(code);
    assertThat("getValue", node.getValue(), is(1.0));
    //assertThat("getExpressionNode", node.getExpressionNode(), is((IASNode)null));
  }

  {
    String[] code = new String[]
    {
        "<fx:Number> 0xABCDEF </fx:Number>"
    };
    IMXMLNumberNode node = getMXMLNumberNode(code);
    assertThat("getValue", node.getValue(), is((double)0xABCDEF));
    //assertThat("getExpressionNode", node.getExpressionNode(), is((IASNode)null));
  }

  {
    String[] code = new String[]
    {
        "<fx:Number> -0Xabcdef </fx:Number>"
    };
    IMXMLNumberNode node = getMXMLNumberNode(code);
    assertThat("getValue", node.getValue(), is((double)-0xABCDEF));
    //assertThat("getExpressionNode", node.getExpressionNode(), is((IASNode)null));
  }

  {
    String[] code = new String[]
    {
        "<fx:Number> 0.5 </fx:Number>"
    };
    IMXMLNumberNode node = getMXMLNumberNode(code);
    assertThat("getValue", node.getValue(), is(0.5));
    //assertThat("getExpressionNode", node.getExpressionNode(), is((IASNode)null));
  }

  {
    String[] code = new String[]
    {
        "<fx:Number> -1.5e-10 </fx:Number>"
    };
    IMXMLNumberNode node = getMXMLNumberNode(code);
    assertThat("getValue", node.getValue(), is(-1.5e-10));
    //assertThat("getExpressionNode", node.getExpressionNode(), is((IASNode)null));
  }

  {
    String[] code = new String[]
    {
        "<fx:Number> -1.5E+10 </fx:Number>"
    };
    IMXMLNumberNode node = getMXMLNumberNode(code);
    assertThat("getValue", node.getValue(), is(-1.5e10));
    //assertThat("getExpressionNode", node.getExpressionNode(), is((IASNode)null));
  }

TOP

Related Classes of org.apache.flex.compiler.tree.mxml.IMXMLNumberNode

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.