Search in sources :

Example 16 with Variable

use of nars.term.var.Variable in project narchy by automenta.

the class CommonVariableTest method commonVariableTest1.

@Test
public void commonVariableTest1() {
    // same forward and reverse
    Variable p1p2 = CommonVariable.common(p1, p2);
    assertEquals("#1_2", p1p2.toString());
    Variable p2p1 = CommonVariable.common(p2, p1);
    assertEquals("#1_2", p2p1.toString());
}
Also used : Variable(nars.term.var.Variable) CommonVariable(nars.term.var.CommonVariable) Test(org.junit.jupiter.api.Test)

Example 17 with Variable

use of nars.term.var.Variable in project narchy by automenta.

the class CommonVariableTest method CommonVariableOfCommonVariable.

@Test
public void CommonVariableOfCommonVariable() {
    Variable c123 = CommonVariable.common(c12, p3);
    assertEquals("#1_2_3 class nars.term.var.CommonVariable", (c123 + " " + c123.getClass()));
    // duplicate: already included
    assertSame(c123, CommonVariable.common(c123, p2));
    assertEquals(c123, CommonVariable.common(c123, p1));
}
Also used : Variable(nars.term.var.Variable) CommonVariable(nars.term.var.CommonVariable) Test(org.junit.jupiter.api.Test)

Aggregations

Variable (nars.term.var.Variable)17 Term (nars.term.Term)12 Test (org.junit.jupiter.api.Test)6 CommonVariable (nars.term.var.CommonVariable)4 Op (nars.Op)3 FileNotFoundException (java.io.FileNotFoundException)2 TODO (jcog.TODO)2 FasterList (jcog.list.FasterList)2 Concept (nars.concept.Concept)2 Subterms (nars.subterm.Subterms)2 Compound (nars.term.Compound)2 Bool (nars.term.atom.Bool)2 Int (nars.term.atom.Int)2 MutableSet (org.eclipse.collections.api.set.MutableSet)2 UnifiedMap (org.eclipse.collections.impl.map.mutable.UnifiedMap)2 IntObjectHashMap (org.eclipse.collections.impl.map.mutable.primitive.IntObjectHashMap)2 NotNull (org.jetbrains.annotations.NotNull)2 NumberTerm (alice.tuprolog.NumberTerm)1 Struct (alice.tuprolog.Struct)1 Theory (alice.tuprolog.Theory)1