Search in sources :

Example 46 with Concept

use of nars.concept.Concept in project narchy by automenta.

the class TermTest method testTermEquality.

protected void testTermEquality(@NotNull String s, boolean conceptualize) throws Narsese.NarseseException {
    Term a = $.$(s).term();
    NAR n2 = NARS.shell();
    Term b = $.$(s).term();
    if (a instanceof Compound) {
        assertEquals(a.subterms(), b.subterms());
    }
    assertEquals(a.hashCode(), b.hashCode());
    assertEquals(a.toString(), b.toString());
    assertEquals(a, b);
    assertEquals(a.compareTo(a), a.compareTo(b));
    assertEquals(0, b.compareTo(a));
    if (conceptualize) {
        Concept n2a = n2.conceptualize(a);
        assertNotNull(n2a, a + " should conceptualize");
        assertNotNull(b);
        assertEquals(n2a.toString(), b.toString());
        assertEquals(n2a.hashCode(), b.hashCode());
        assertEquals(n2a.term(), b);
    }
}
Also used : Concept(nars.concept.Concept)

Example 47 with Concept

use of nars.concept.Concept in project narchy by automenta.

the class TaskTest method testValid.

@Test
public void testValid() throws Narsese.NarseseException {
    NAR tt = NARS.shell();
    Task t = $.task("((&&,#1,(#1 &&+0 #3),(#2 &&+0 #3),(#2 &&+0 (toothbrush-->here))) ==>+0 lighter(I,toothbrush))", BELIEF, 1f, 0.9f).apply(tt);
    assertNotNull(t);
    Concept c = t.concept(tt, true);
    assertNotNull(c);
}
Also used : Concept(nars.concept.Concept) Test(org.junit.jupiter.api.Test)

Aggregations

Concept (nars.concept.Concept)47 TaskConcept (nars.concept.TaskConcept)19 Term (nars.term.Term)19 Test (org.junit.jupiter.api.Test)15 Nullable (org.jetbrains.annotations.Nullable)11 Truth (nars.truth.Truth)9 NAR (nars.NAR)6 Termed (nars.term.Termed)6 FasterList (jcog.list.FasterList)4 PermanentConcept (nars.concept.PermanentConcept)4 BeliefTable (nars.table.BeliefTable)4 TestNAR (nars.test.TestNAR)4 Util (jcog.Util)3 PriReference (jcog.pri.PriReference)3 GL2 (com.jogamp.opengl.GL2)2 java.io (java.io)2 java.util (java.util)2 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)2 Op (nars.Op)2 CauseLink (nars.link.CauseLink)2