Search in sources :

Example 1 with SewingClonerImpl

use of suite.lp.sewing.impl.SewingClonerImpl 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 SewingClonerImpl

use of suite.lp.sewing.impl.SewingClonerImpl in project suite by stupidsing.

the class EvaluatorFactoryTest method test.

private void test(String pattern, int result) {
    for (EvaluatorFactory ef : new EvaluatorFactory[] { // 
    new CompileExpressionImpl(new CompileClonerImpl()), new SewingExpressionImpl(new SewingClonerImpl()) }) {
        Evaluate_ e = ef.evaluator(Suite.parse(pattern));
        assertEquals(result, e.evaluate(Env.empty(0)));
    }
}
Also used : CompileClonerImpl(suite.lp.compile.impl.CompileClonerImpl) Evaluate_(suite.lp.doer.EvaluatorFactory.Evaluate_) 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 Evaluate_ (suite.lp.doer.EvaluatorFactory.Evaluate_)1 SewingExpressionImpl (suite.lp.sewing.impl.SewingExpressionImpl)1 Node (suite.node.Node)1