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

package cx2x.xcodeml.xnode;

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

/**
 * Test the features of the XglobalDecl class.
 *
 * @author clementval
 */
public class XglobalDeclTest {

  private static final String simpleGlobDecl =
      "<globalDeclarations>" +
      "<FmoduleDefinition name=\"module\" lineno=\"4\" " +
          "file=\"./src/module.f90\">" +
      "</FmoduleDefinition>" +
      "<FfunctionDefinition lineno=\"917\" file=\"./src/module.f90\">\n" +
      "<name type=\"Fb39d60\">fct1</name>" +
      "</FfunctionDefinition>" +
      "</globalDeclarations>";


  @Test
  public void simpleGlobalDeclarationTest(){
    XglobalDeclTable gdTable = XmlHelper.createGlobalDeclTable(simpleGlobDecl);
    assertNotNull(gdTable);
    assertEquals(2, gdTable.count());
    assertTrue(gdTable.hasDefinition("fct1"));
    assertTrue(gdTable.hasFunctionDefinition("fct1"));
    assertFalse(gdTable.hasModuleDefinition("fct1"));
    XfunctionDefinition fDef = gdTable.getFctDefinition("fct1");
    assertNotNull(fDef);
    assertEquals("fct1", fDef.getName().getValue());
    assertNull(fDef.getBody());
    assertNull(fDef.getDeclarationTable());
    assertNull(fDef.getParams());
    assertNull(fDef.getSymbolTable());
    assertEquals(917, fDef.getLineNo());
    assertEquals("./src/module.f90", fDef.getFile());
    assertTrue(gdTable.hasDefinition("module"));
    assertFalse(gdTable.hasFunctionDefinition("module"));
    assertTrue(gdTable.hasModuleDefinition("module"));
    XmoduleDefinition mDef = gdTable.getModuleDefinition("module");
    assertNotNull(mDef);
    assertEquals("module", mDef.getName());
    assertEquals(4, mDef.getLineNo());
    assertEquals("./src/module.f90", mDef.getFile());
  }
}

@@ -643,24 +643,118 @@
 1%3C/name%3E%22 +%0A
+      %22%3Csymbols%3E%3C/symbols%3E%22 +%0A      %22%3Cdeclarations%3E%3C/declarations%3E%22 +%0A      %22%3Cbody%3E%3C/body%3E%22 +%0A
       %22%3C/Ffu
@@ -1308,32 +1308,35 @@
 ());%0A    assertN
+otN
 ull(fDef.getBody
@@ -1343,32 +1343,35 @@
 ());%0A    assertN
+otN
 ull(fDef.getDecl
@@ -1424,32 +1424,35 @@
 ());%0A    assertN
+otN
 ull(fDef.getSymb

Fix test