<commit_before>/*
 *  Copyright (C) 2011-2012 The Animo Project
 *  http://animotron.org
 *  	
 *  This file is part of Animotron.
 *  
 *  Animotron is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU Affero General Public License as 
 *  published by the Free Software Foundation, either version 3 of 
 *  the License, or (at your option) any later version.
 *  
 *  Animotron is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU Affero General Public License for more details.
 *  
 *  You should have received a copy of 
 *  the GNU Affero General Public License along with Animotron.  
 *  If not, see <http://www.gnu.org/licenses/>.
 */
package org.animotron.statement.operator;

import org.animotron.ATest;
import org.animotron.expression.JExpression;
import org.animotron.statement.query.PREFER;
import org.animotron.statement.relation.USE;
import org.junit.Test;

import static org.animotron.expression.JExpression._;
import static org.animotron.expression.JExpression.__;

/**
 * @author <a href="mailto:<EMAIL>"><NAME></a>
 * @author <a href="mailto:<EMAIL>"><NAME></a>
 *
 */
public class PreferTest extends ATest {


    @Test
    public void test_0() throws Throwable {

        __(
            new JExpression(
                    _(DEF._, "A", _(AN._, "X"))
            ),
            new JExpression(
                    _(DEF._, "B", _(AN._, "X"))
            )
        );

        JExpression test = new JExpression(
                _(PREFER._, "X")
        );
        assertAnimoResultOneStep(test, "");

    }

    @Test
    public void test_01() throws Throwable {

        __(
            new JExpression(
                    _(DEF._, "A", _(AN._, "X"))
            ),
            new JExpression(
                    _(DEF._, "B", _(AN._, "X"))
            )
        );

        JExpression test = new JExpression(
                _(PREFER._, "X", _(USE._, "X"))
        );
        assertAnimoResultOneStep(test, "def A X. def B X.");

    }

    @Test
    public void test_02() throws Throwable {

        __(
            new JExpression(
                    _(DEF._, "A", _(AN._, "X"))
            ),
            new JExpression(
                    _(DEF._, "B", _(AN._, "X"))
            )
        );

        JExpression test = new JExpression(
            _(PREFER._, "X", _(USE._, "A"))
        );
        assertAnimoResultOneStep(test, "def A X.");

    }

    @Test
    public void test_03() throws Throwable {

        __(
            new JExpression(
                    _(DEF._, "A", _(AN._, "X"))
            ),
            new JExpression(
                    _(DEF._, "B", _(AN._, "X"))
            )
        );

        JExpression test = new JExpression(
                _(PREFER._, "X", _(USE._, "B"))
        );
        assertAnimoResultOneStep(test, "def B X.");
    }
}<commit_msg>review<commit_after>/*
 *  Copyright (C) 2011-2012 The Animo Project
 *  http://animotron.org
 *  	
 *  This file is part of Animotron.
 *  
 *  Animotron is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU Affero General Public License as 
 *  published by the Free Software Foundation, either version 3 of 
 *  the License, or (at your option) any later version.
 *  
 *  Animotron is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU Affero General Public License for more details.
 *  
 *  You should have received a copy of 
 *  the GNU Affero General Public License along with Animotron.  
 *  If not, see <http://www.gnu.org/licenses/>.
 */
package org.animotron.statement.operator;

import org.animotron.ATest;
import org.animotron.expression.JExpression;
import org.animotron.statement.query.PREFER;
import org.animotron.statement.relation.USE;
import org.junit.Test;

import static org.animotron.expression.JExpression._;
import static org.animotron.expression.JExpression.__;

/**
 * @author <a href="mailto:<EMAIL>"><NAME></a>
 * @author <a href="mailto:<EMAIL>"><NAME></a>
 *
 */
public class PreferTest extends ATest {


    @Test
    public void test_0() throws Throwable {

        __(
            new JExpression(
                    _(DEF._, "A", _(AN._, "X"))
            ),
            new JExpression(
                    _(DEF._, "B", _(AN._, "X"))
            )
        );

        JExpression test = new JExpression(
                _(PREFER._, "X")
        );
        assertAnimoResultOneStep(test, "");

    }

    @Test
    public void test_01() throws Throwable {

        __(
            new JExpression(
                    _(DEF._, "A", _(AN._, "X"))
            ),
            new JExpression(
                    _(DEF._, "B", _(AN._, "X"))
            )
        );

        JExpression test = new JExpression(
                _(PREFER._, "X", _(USE._, "X"))
        );
        assertAnimoResultOneStep(test, "A X. B X.");

    }

    @Test
    public void test_02() throws Throwable {

        __(
            new JExpression(
                    _(DEF._, "A", _(AN._, "X"))
            ),
            new JExpression(
                    _(DEF._, "B", _(AN._, "X"))
            )
        );

        JExpression test = new JExpression(
            _(PREFER._, "X", _(USE._, "A"))
        );
        assertAnimoResultOneStep(test, "A X.");

    }

    @Test
    public void test_03() throws Throwable {

        __(
            new JExpression(
                    _(DEF._, "A", _(AN._, "X"))
            ),
            new JExpression(
                    _(DEF._, "B", _(AN._, "X"))
            )
        );

        JExpression test = new JExpression(
                _(PREFER._, "X", _(USE._, "B"))
        );
        assertAnimoResultOneStep(test, "B X.");
    }
}
{'fraction_non_alphanumeric': 0.12468661206752465, 'fraction_numerical': 0.005348487380912586, 'mean_word_length': 1.7614213197969544, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '3018859', 'n_tokens_mistral': 1817, 'n_tokens_neox': 1739, 'n_words': 516}