<commit_before>//
// Flambe - Rapid game development
// https://github.com/aduros/flambe/blob/master/LICENSE.txt

import haxe.unit.TestCase;

import flambe.Component;
import flambe.Entity;
import flambe.Visitor;

class EntityTest extends TestCase
{
    public function testHierarchy ()
    {
        var parent = new Entity();
        var comp = new TestComponent();

        assertEquals(parent.add(comp), parent);

        assertTrue(parent.has(TestComponent));
        assertEquals(parent.get(TestComponent), comp);

        comp.dispose();
        assertFalse(parent.has(TestComponent));
        assertEquals(parent.get(TestComponent), null);

        comp = new TestComponent();
        var child = new Entity().add(comp);

        parent.addChild(child);
        assertEquals(child.parent, parent);

        parent.dispose();
        assertEquals(child.parent, null);

        child.remove(comp);
        assertFalse(child.has(TestComponent));
    }
}

class TestComponent extends Component
{
    public function new () { }
}
<commit_msg>Unit test fix.<commit_after>//
// Flambe - Rapid game development
// https://github.com/aduros/flambe/blob/master/LICENSE.txt

import haxe.unit.TestCase;

import flambe.Component;
import flambe.Entity;

class EntityTest extends TestCase
{
    public function testHierarchy ()
    {
        var parent = new Entity();
        var comp = new TestComponent();

        assertEquals(parent.add(comp), parent);

        assertTrue(parent.has(TestComponent));
        assertEquals(parent.get(TestComponent), comp);

        comp.dispose();
        assertFalse(parent.has(TestComponent));
        assertEquals(parent.get(TestComponent), null);

        comp = new TestComponent();
        var child = new Entity().add(comp);

        parent.addChild(child);
        assertEquals(child.parent, parent);

        parent.dispose();
        assertEquals(child.parent, null);

        child.remove(comp);
        assertFalse(child.has(TestComponent));
    }
}

class TestComponent extends Component
{
    public function new () { }
}

{'fraction_non_alphanumeric': 0.12052274927395934, 'fraction_numerical': 0.0, 'mean_word_length': 2.8780487804878048, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, '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': '4003571', 'n_tokens_mistral': 579, 'n_tokens_neox': 564, 'n_words': 120}