<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.Expression;
import org.junit.Test;

/**
 * @author <a href="mailto:<EMAIL>"><NAME></a>
 * @author <a href="mailto:<EMAIL>"><NAME></a>
 *
 */
public class GetDynamicTest extends ATest {
	
	@Test
	public void getOnManyAN() throws Throwable {

        tAnimo("def A Z 'A'.");
        tAnimo("def B Z 'B'.");
    	Expression d = tAnimo("def d get (Z) (A) (B)");
        assertAnimoResult(d, "d", " \"A\"", " \"B\"", ".");
	}

	@Test
	public void getOnManyANbyIS() throws Throwable {

        tAnimo("def ZZ Z.");
        tAnimo("def A Z 'A'.");
        tAnimo("def B ZZ 'B'.");
        Expression d = tAnimo("def d get (Z) (A) (B)");
        assertAnimoResult(d, "d", " \"A\"", " \"B\"", ".");
	}

	@Test
    public void get_via_is() throws Throwable {

        tAnimo("def B A.");
        tAnimo("def C (Z) (B 'π').");
        tAnimo("def D (Z) (A 'Aπ').");

        Expression E = tAnimo("def E get A all Z");
        assertAnimoResult(E, "E \"π\" \"Aπ\".");

        Expression E1 = tAnimo("def E get B all Z");
        assertAnimoResult(E1, "E1 \"π\".");

        Expression F = tAnimo("def E get (all A) (all Z)");
        assertAnimoResult(F, "F \"π\".");
    }

    @Test
    public void test_00() throws Throwable {
    	testAnimo("def z a z1.");
    	testAnimo("def b z1 \"z1\".");

    	testAnimoResult("get (get a z) (b).", "\"z1\".");
    }

    @Test
    public void test_01() throws Throwable {
    	testAnimo("def z (k) (a z1).");
    	testAnimo("def b (k) (z1 \"z1\").");

    	testAnimoResult("get a z.", "z1.");
    	testAnimoResult("get (get a z) (all k).", "z1. \"z1\".");
    }

    @Test
    public void test_02() throws Throwable {
    	testAnimo("def z (k) (a z1).");
    	testAnimo("def b (k) (z1 \"z1\").");

    	testAnimoResult("get (get a z) (a).", "");<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.junit.Test;

/**
 * @author <a href="mailto:<EMAIL>"><NAME></a>
 * @author <a href="mailto:<EMAIL>"><NAME></a>
 *
 */
public class GetDynamicTest extends ATest {
	
	@Test
	public void getOnManyAN() throws Throwable {

        tAnimo("def A Z 'A'.");
        tAnimo("def B Z 'B'.");

        assertAnimoResult("def d get Z (A) (B).", "d", " \"A\"", " \"B\"", ".");
	}

	@Test
	public void getOnManyANbyIS() throws Throwable {

        tAnimo("def ZZ Z.");
        tAnimo("def A Z 'A'.");
        tAnimo("def B ZZ 'B'.");

        assertAnimoResult("def d get Z (A) (B).", "d", " \"A\"", " \"B\"", ".");
	}

	@Test
    public void get_via_is() throws Throwable {

        tAnimo("def B A.");
        tAnimo("def C (Z) (B 'π').");
        tAnimo("def D (Z) (A 'Aπ').");

        assertAnimoResult("def E get A all Z.", "E \"π\" \"Aπ\".");
        assertAnimoResult("def E1 get B all Z.", "E1 \"π\".");
        assertAnimoResult("def F get (all A) (all Z).", "F \"π\".");
    }

    @Test
    public void test_00() throws Throwable {
    	testAnimo("def z a z1.");
    	testAnimo("def b z1 \"z1\".");

    	testAnimoResult("get (get a z) (b).", "\"z1\".");
    }

    @Test
    public void test_01() throws Throwable {
    	testAnimo("def z (k) (a z1).");
    	testAnimo("def b (k) (z1 \"z1\").");

    	testAnimoResult("get a z.", "z1.");
    	testAnimoResult("get (get a z) (all k).", "z1. \"z1\".");
    }

    @Test
    public void test_02() throws Throwable {
    	testAnimo("def z (k) (a z1).");
    	testAnimo("def b (k) (z1 \"z1\").");

    	testAnimoResult("get (get a z) (a).", "");
{'fraction_non_alphanumeric': 0.1718509984639017, 'fraction_numerical': 0.011712749615975423, 'mean_word_length': 2.6023513139695713, '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': '375272', 'n_tokens_mistral': 1879, 'n_tokens_neox': 1827, 'n_words': 603}