<commit_before>/*
 * 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 the XfunctionDefinition class.
 *
 * @author clementval
 */
public class XfunctionDefinitionTest {

  private static final String basicFDef =
      "<FfunctionDefinition lineno=\"1\" file=\"original_code.f90\">" +
      "<name type=\"F7ff951406df0\">force_dummy</name>" +
      "<symbols>" +
      "</symbols>" +
      "<declarations>" +
      "</declarations>" +
      "<body>" +
      "<FprintStatement format=\"*\" lineno=\"3\" file=\"original_code.f90\">" +
      "<valueList>" +
      "<value>" +
      "<FcharacterConstant type=\"C7ff9514071e0\">Dummy program for force " +
          "option</FcharacterConstant>" +
      "</value>" +
      "</valueList>" +
      "</FprintStatement>" +
      "</body>" +
      "</FfunctionDefinition>";


  @Test
  public void basicFunctionDefinitionTest(){
    XfunctionDefinition fctDef = XmlHelper.createXfunctionDefinitionFromString(basicFDef);
    assertNotNull(fctDef);
    assertEquals("force_dummy", fctDef.getName().getValue());
    assertEquals("F7ff951406df0", fctDef.getName().getType());
    assertEquals(0, fctDef.getSymbolTable().count());
    assertEquals(0, fctDef.getDeclarationTable().count());
    assertNull(fctDef.getParams());
    assertNotNull(fctDef.getBody());

    assertEquals(1, fctDef.getLineNo());
    assertEquals("original_code.f90", fctDef.getFile());

<commit_msg>Fix get attribute<commit_after>/*
 * This file is released under terms of BSD license
 * See LICENSE file for more information
 */

package cx2x.xcodeml.xelement;

import cx2x.xcodeml.xnode.Xattr;
import helper.XmlHelper;
import org.junit.Test;
import static org.junit.Assert.*;

/**
 * Test features of the XfunctionDefinition class.
 *
 * @author clementval
 */
public class XfunctionDefinitionTest {

  private static final String basicFDef =
      "<FfunctionDefinition lineno=\"1\" file=\"original_code.f90\">" +
      "<name type=\"F7ff951406df0\">force_dummy</name>" +
      "<symbols>" +
      "</symbols>" +
      "<declarations>" +
      "</declarations>" +
      "<body>" +
      "<FprintStatement format=\"*\" lineno=\"3\" file=\"original_code.f90\">" +
      "<valueList>" +
      "<value>" +
      "<FcharacterConstant type=\"C7ff9514071e0\">Dummy program for force " +
          "option</FcharacterConstant>" +
      "</value>" +
      "</valueList>" +
      "</FprintStatement>" +
      "</body>" +
      "</FfunctionDefinition>";


  @Test
  public void basicFunctionDefinitionTest(){
    XfunctionDefinition fctDef = XmlHelper.createXfunctionDefinitionFromString(basicFDef);
    assertNotNull(fctDef);
    assertEquals("force_dummy", fctDef.getName().getValue());
    assertEquals("F7ff951406df0", fctDef.getName().getAttribute(Xattr.TYPE));
    assertEquals(0, fctDef.getSymbolTable().count());
    assertEquals(0, fctDef.getDeclarationTable().count());
    assertNull(fctDef.getParams());
    assertNotNull(fctDef.getBody());

    assertEquals(1, fctDef.getLineNo());
    assertEquals("original_code.f90", fctDef.getFile());


{'fraction_non_alphanumeric': 0.15771604938271605, 'fraction_numerical': 0.023148148148148147, 'mean_word_length': 3.7452415812591506, 'pattern_counts': {'":': 0, '<': 39, '<?xml version=': 0, '>': 39, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4628038', 'n_tokens_mistral': 1009, 'n_tokens_neox': 986, 'n_words': 184}