<commit_before><commit_msg>start of test for parser<commit_after>/**
 * 
 */
package nl.tudelft.lifetiles.tree;

import static org.junit.Assert.*;

import org.junit.Test;

/**
 * @author <NAME>
 *
 */
public class TestNewickParser {

    /**
     * test the parser without any data in the tree.
     */
    @Test
    public void testNewickParserNoNamesNoDistance() {
        // create the actual tree
        String tree = "(,,(,));";
        NewickParser np = new NewickParser(tree);
        assertTrue("Parser constructor failed, np is NULL", np != null);
        PhylogeneticTreeItem rootActual = np.getRoot();

        // create the expected Tree
        // root node
        PhylogeneticTreeItem rootExpected = new PhylogeneticTreeItem();
        // add 3 child nodes
        PhylogeneticTreeItem current = new PhylogeneticTreeItem();
        current.setParent(rootExpected);
        current = new PhylogeneticTreeItem();
        current.setParent(rootExpected);
        current = new PhylogeneticTreeItem();
        current.setParent(rootExpected);
        // add 2 child nodes to the third node
        PhylogeneticTreeItem current2 = new PhylogeneticTreeItem();
        current2.setParent(current);
        current2 = new PhylogeneticTreeItem();
        current2.setParent(current);

        // compare the trees
        assertEquals("both trees do not match",rootExpected,rootActual);

        
    }

    /**
     * test the parser without any data in the tree.
     */
    @Test
    public void testNewickParserNamedLeafsNoDistance() {
        // create the actual tree
        String tree = "(A,B,(C,D));";
        NewickParser np = new NewickParser(tree);
        assertTrue("Parser constructor failed, np is NULL", np != null);
        PhylogeneticTreeItem rootActual = np.getRoot();

        // create the expected Tree
        // root node
        PhylogeneticTreeItem rootExpected = new PhylogeneticTreeItem();
        // add 3 child nodes
        PhylogeneticTreeItem current = new PhylogeneticTreeItem();
        current.setParent(rootExpected);
        current.setName("A");
        current = new PhylogeneticTreeItem();
        current.setName("B");
        current.setParent(rootExpected);
        current = new PhylogeneticTreeItem();
        current.setParent(rootExpected);
        // add 2 child nodes to the third node
        PhylogeneticTreeItem current2 = new PhylogeneticTreeItem();
        current2.setParent(current);
        current.setName("C");
        current2 = new PhylogeneticTreeItem();
        current2.setParent(current);
        current.setName("D");

        // compare the trees
        assertEquals("both trees do not match",rootExpected,rootActual);

        
    }
    /**
     * Test method for {@link nl.tudelft.lifetiles.tree.NewickParser#getRoot()}.
     */
    @Test
    public void testGetRoot() {
        fail("Not yet implemented");
    }

}
{'fraction_non_alphanumeric': 0.10248447204968944, 'fraction_numerical': 0.004140786749482402, 'mean_word_length': 2.480192076830732, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, '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': '6986122', 'n_tokens_mistral': 824, 'n_tokens_neox': 774, 'n_words': 206}