use of nars.Task in project narchy by automenta.
the class NarseseBaseTest method testMultiCompound.
@Test
public void testMultiCompound() throws Narsese.NarseseException {
String tt = "((a==>b)-->(c==>d))";
Task t = task(tt + '?');
assertNotNull(t);
assertEquals(Op.INH, t.op());
assertEquals(tt, t.term().toString());
assertEquals('?', t.punc());
assertNull(t.truth());
assertEquals(7, t.term().complexity());
}
use of nars.Task in project narchy by automenta.
the class NarseseBaseTest method testTenses.
@Test
public void testTenses() throws Narsese.NarseseException {
Task now = task("<a --> b>. :|:");
Task f = task("<a --> b>. :/:");
Task p = task("<a --> b>. :\\:");
assertTrue(now.start() > p.start());
assertTrue(now.start() < f.start());
}
use of nars.Task in project narchy by automenta.
the class NarseseBaseTest method testBudget.
@Test
public void testBudget() throws Narsese.NarseseException {
Task t = task("$0.70 <a ==> b>. %0.00;0.93");
assertEquals(0.7f, t.pri(), 0.01f);
Task u = task("$0.9 <a ==> b>. %0.00;0.93");
assertEquals(0.9f, u.pri(), 0.01f);
}
use of nars.Task in project narchy by automenta.
the class NarseseBaseTest method testParseCompleteEternalTask.
@Test
public void testParseCompleteEternalTask() throws Narsese.NarseseException {
Task t = task("$0.99 (a --> b)! %0.93;0.95%");
assertNotNull(t);
assertEquals('!', t.punc());
assertEquals(0.99f, t.pri(), 0.001);
assertEquals(0.93f, t.freq(), 0.001);
assertEquals(0.95f, t.conf(), 0.001);
}
use of nars.Task in project narchy by automenta.
the class NarseseTest method taskParses.
// @Test
// public void testImageIndex() throws Narsese.NarseseException {
// for (char c : new char[] { '/', '\\'}) {
// {
// Compound t = term("(" + c + ",open,$1,_)");
// assertEquals("(" + c + ",open,$1,_)", t.toString());
// assertEquals("index psuedo-term should not count toward its size", 2, t.size());
// }
//
// Compound t = term("(" + c + ",open,_,$1)");
// assertEquals("(" + c + ",open,_,$1)", t.toString());
// assertEquals("index psuedo-term should not count toward its size", 2, t.size());
// }
// }
//
// @Test
// public void testImageExtRel0() throws Narsese.NarseseException { testImageExtRel("(a-->(/,_,y,z))", 0); }
// @Test
// public void testImageIntRel0() throws Narsese.NarseseException { testImageIntRel("((\\,_,y,z)-->a)", 0); }
//
// @Test
// public void testImageExtRel1() throws Narsese.NarseseException { testImageExtRel("(a-->(/,x,_,z))", 1); }
// @Test
// public void testImageIntRel1() throws Narsese.NarseseException { testImageIntRel("((\\,x,_,z)-->a)", 1); }
//
// @Test
// public void testImageExtRel2() throws Narsese.NarseseException { testImageExtRel("(a-->(/,x,y,_))", 2); }
// @Test
// public void testImageIntRel2() throws Narsese.NarseseException { testImageIntRel("((\\,x,y,_)-->a)", 2); }
//
// private void testImageIntRel(@NotNull String imageTerm, int relationIndexExpected) throws Narsese.NarseseException {
// Compound ti = term(imageTerm);
// assertEquals(relationIndexExpected, ((Compound)ti.sub(0)).dt() );
// assertEquals(imageTerm, ti.toString());
// }
//
// private void testImageExtRel(@NotNull String imageTerm, int relationIndexExpected) throws Narsese.NarseseException {
// Compound ti = term(imageTerm);
// assertEquals(relationIndexExpected, ((Compound)ti.sub(1)).dt() );
// assertEquals(imageTerm, ti.toString());
// }
protected void taskParses(@NotNull String s) throws Narsese.NarseseException {
Task t = task(s);
assertNotNull(t);
// Task u = oldParser.parseTaskOld(s, true);
// assertNotNull(u);
//
// assertEquals(u.getTerm() + " != " + t.getTerm(), u.getTerm(), t.getTerm());
// assertEquals("(truth) " + t.getTruth() + " != " + u.getTruth(), u.getTruth(), t.getTruth());
// //assertEquals("(creationTime) " + u.getCreationTime() + " != " + t.getCreationTime(), u.getCreationTime(), t.getCreationTime());
// assertEquals("(occurrencetime) " + u.getOccurrenceTime() + " != " + t.getOccurrenceTime(), u.getOccurrenceTime(), t.getOccurrenceTime());
// TODO budget:
// TODO punctuation:
}
Aggregations