Search in sources :

Example 1 with CompileClonerImpl

use of suite.lp.compile.impl.CompileClonerImpl in project suite by stupidsing.

the class ClonerFactoryTest method test.

private void test(String pattern, String match) {
    for (ClonerFactory cf : new ClonerFactory[] { new CompileClonerImpl(), new SewingClonerImpl() }) {
        Node node = new Generalizer().generalize(Suite.parse(pattern));
        Clone_ p = cf.cloner(node);
        assertTrue(Binder.bind(p.apply(cf.mapper().env()), Suite.parse(match), new Trail()));
    }
}
Also used : Trail(suite.lp.Trail) CompileClonerImpl(suite.lp.compile.impl.CompileClonerImpl) SewingClonerImpl(suite.lp.sewing.impl.SewingClonerImpl) Node(suite.node.Node) Clone_(suite.lp.doer.ClonerFactory.Clone_)

Example 2 with CompileClonerImpl

use of suite.lp.compile.impl.CompileClonerImpl in project suite by stupidsing.

the class EvaluatorFactoryTest method test.

private void test(String pattern, int result) {
    for (var ef : new EvaluatorFactory[] { // 
    new CompileExpressionImpl(new CompileClonerImpl()), new SewingExpressionImpl(new SewingClonerImpl()) }) {
        var e = ef.evaluator(Suite.parse(pattern));
        assertEquals(result, e.evaluate(Env.empty(0)));
    }
}
Also used : CompileClonerImpl(suite.lp.compile.impl.CompileClonerImpl) SewingClonerImpl(suite.lp.sewing.impl.SewingClonerImpl) CompileExpressionImpl(suite.lp.compile.impl.CompileExpressionImpl) SewingExpressionImpl(suite.lp.sewing.impl.SewingExpressionImpl)

Aggregations

CompileClonerImpl (suite.lp.compile.impl.CompileClonerImpl)2 SewingClonerImpl (suite.lp.sewing.impl.SewingClonerImpl)2 Trail (suite.lp.Trail)1 CompileExpressionImpl (suite.lp.compile.impl.CompileExpressionImpl)1 Clone_ (suite.lp.doer.ClonerFactory.Clone_)1 SewingExpressionImpl (suite.lp.sewing.impl.SewingExpressionImpl)1 Node (suite.node.Node)1