/*
 * This file is released under terms of BSD license
 * See LICENSE file for more information
 */

package cx2x.xcodeml.xelement;

import helper.XmlHelper;
import org.junit.Test;
import static org.junit.Assert.*;

/**
 * Test features of XvarDecl class
 *
 * @author clementval
 */
public class XvarDeclTest {

  private static final String xVarDecl1 =
      "<varDecl lineno=\"946\" file=\"./src/mymodule.f90\">" +
      "<name type=\"Ib3f750\">testvar</name>" +
      "</varDecl>";

  @Test
  public void simpleXvarDeclTest(){
    XvarDecl varDecl = XmlHelper.createXvarDecl(xVarDecl1);
    assertNotNull(varDecl);
    assertEquals(946, varDecl.getLineNo());
    assertEquals("./src/mymodule.f90", varDecl.getFile());
    assertNotNull(varDecl.getName());
    assertEquals("Ib3f750", varDecl.getName().getType());
    assertEquals("testvar", varDecl.getName().getValue());
  }

}

@@ -455,24 +455,54 @@
 r%3C/name%3E%22 +%0A
+      %22%3Cvalue%3E10.0%3C/value%3E%22 +%0A
       %22%3C/var
@@ -902,13 +902,96 @@
 e());%0A  
-%7D
+  assertTrue(varDecl.hasValue());%0A    assertEquals(%2210.0%22, varDecl.getValue());%0A  %7D%0A
 %0A%0A%7D%0A

Test varDecl with value