Search in sources :

Example 46 with TestNAR

use of nars.test.TestNAR in project narchy by automenta.

the class LinkageTest method testConceptFormed.

public void testConceptFormed(@NotNull String s) throws Exception {
    test.requireConditions = false;
    TestNAR tester = test;
    tester.believe(s, 1.0f, 0.9f);
    tester.nar.run(10);
    Concept ret = tester.nar.conceptualize(s);
    assertNotNull(ret, "Failed to create a concept for " + s);
}
Also used : Concept(nars.concept.Concept) TestNAR(nars.test.TestNAR)

Example 47 with TestNAR

use of nars.test.TestNAR in project narchy by automenta.

the class PatrickTests method testToothbrushSimpler.

@Test
public void testToothbrushSimpler() {
    TestNAR tt = test;
    // Param.TRACE = true;
    int cycles = 5000;
    tt.confTolerance(0.9f);
    // MetaGoal.Desire.want(nar.want, 0.5f);
    tt.nar.freqResolution.set(0.05f);
    tt.nar.confResolution.set(0.02f);
    // tt.nar.DEFAULT_BELIEF_PRIORITY = 0.1f;
    tt.nar.time.dur(10);
    tt.nar.termVolumeMax.set(32);
    // tt.nar.deep.set(0.75f);
    // tt.log();
    // tt.nar.emotion.deriveFailTemporal.why.on((x)->System.out.println(x));
    tt.input("made_of(toothbrush,plastic).", "( ( made_of($1, plastic) &| lighter($1) ) ==>+10 hot:$1).", "(hot:$1 ==>+10 molten:$1).", "(molten:$1 =|> pliable:$1).", "(pliable:$1 =|> molten:$1).", "( (pliable:$1 &| reshape($1)) ==>+10 hard:$1).", "(hard:$1 =|> unscrews:$1).", "$1.0 unscrews:toothbrush! :|:");
    tt.mustGoal(cycles, "hot:toothbrush", 1f, 0.5f, (t) -> t >= 0);
    tt.mustGoal(cycles, "hard:toothbrush", 1f, 0.5f, (t) -> t >= 0);
    tt.mustGoal(cycles, "pliable:toothbrush", 1f, 0.5f, (t) -> t >= 0);
    tt.mustGoal(cycles, "molten:toothbrush", 1f, 0.5f, (t) -> t >= 0);
    tt.mustGoal(cycles, "lighter(toothbrush)", 1f, 0.3f, (t) -> t == 0);
}
Also used : TestNAR(nars.test.TestNAR) Test(org.junit.jupiter.api.Test) NALTest(nars.util.NALTest)

Example 48 with TestNAR

use of nars.test.TestNAR in project narchy by automenta.

the class OperatorTest method testIO.

static void testIO(String input, String output) {
    TestNAR t = new TestNAR(NARS.tmp());
    t.log();
    t.mustOutput(16, output);
    t.input(input);
    t.test(4);
}
Also used : TestNAR(nars.test.TestNAR)

Example 49 with TestNAR

use of nars.test.TestNAR in project narchy by automenta.

the class bAblTests method test2.

@Test
public void test2() {
    // (2) Factoid QA with Two Supporting Facts
    // background knowledge (multiple input for priority boost to have the answer faster ^^)
    // if something is picked, it means that the object which is picked is where the person is
    TestNAR t = test;
    t.nar.freqResolution.set(0.1f);
    t.nar.termVolumeMax.set(24);
    t.believe("((pick(#Person,$Object) &&+0 inside(#Person,$Place)) ==>+0 inside($Object,$Place))").input(// //John is in the playground.
    "inside(john,playground). :|:").input(// //Bob is in the office.
    "inside(bob,office). :|:").input(// //John picked up the football.
    "pick(john,football). :|:").input(// //Bob went to the kitchen.
    "inside(bob,kitchen). :|:").input(// //Where is the football?
    "$0.9 inside(football,?where)?").input(// //Where is the football?
    "$0.9 inside(football,?where)?").mustOutput(0, 1400, "inside(football,playground)", BELIEF, 1f, 1f, 0.5f, 0.99f, // //A: playground
    0);
}
Also used : TestNAR(nars.test.TestNAR) Test(org.junit.jupiter.api.Test) NALTest(nars.util.NALTest)

Example 50 with TestNAR

use of nars.test.TestNAR in project narchy by automenta.

the class NAL2Test method missingEdgeCase1.

@Test
public void missingEdgeCase1() {
    // ((<%1 --> %2>, <%2 <-> %3>, not_equal(%3, %1)), (<%1 --> %3>, (<Analogy --> Truth>, <Strong --> Desire>, <AllowBackward --> Derive>)))
    // ((<%1 --> %2>, <%2 <-> %3>, not_equal(%3, %1)),
    // (<%1 --> %3>,
    // ((<p1 --> p2>, <p2 <-> p3>, not_equal(p3, p1)),
    // (<p1 --> p3>,
    // TestNAR tester = test();
    TestNAR tester = test;
    tester.believe("<p1 --> p2>");
    tester.believe("<p2 <-> p3>");
    tester.mustBelieve(cycles, "<p1 --> p3>", 1.0f, 1.0f, 0.81f, 1.0f);
// tester.debug();
}
Also used : TestNAR(nars.test.TestNAR) Test(org.junit.jupiter.api.Test) NALTest(nars.util.NALTest)

Aggregations

TestNAR (nars.test.TestNAR)178 Test (org.junit.jupiter.api.Test)169 NALTest (nars.util.NALTest)162 NAL7Test (nars.nal.nal7.NAL7Test)18 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)11 Disabled (org.junit.jupiter.api.Disabled)5 NAR (nars.NAR)2 Concept (nars.concept.Concept)2 DoubleSummaryStatistics (java.util.DoubleSummaryStatistics)1 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1 BiFunction (java.util.function.BiFunction)1 IntFunction (java.util.function.IntFunction)1 nars (nars)1 NARS (nars.NARS)1 TaskStatistics (nars.task.util.TaskStatistics)1 Term (nars.term.Term)1 DeductiveMeshTest (nars.test.DeductiveMeshTest)1 ETERNAL (nars.time.Tense.ETERNAL)1 NotNull (org.jetbrains.annotations.NotNull)1 Assertions.assertNotEquals (org.junit.jupiter.api.Assertions.assertNotEquals)1