Package org.boris.expr.engine

Examples of org.boris.expr.engine.IterationEngine


import org.boris.expr.engine.Range;

public class IterationEngineTest extends TestCase
{
    public void testBasic() throws Exception {
        IterationEngine e = new IterationEngine(new BasicEngineProvider());
        e.set("B1", "=A1*2");
        e.set("A1", "=12*2");
        e.set("C1", "=B1*A1");
        assertResult(e, "B1", 48);
        assertResult(e, "C1", 48 * 24);
        e.set("A1", "2");
        assertResult(e, "B1", 4);
        assertResult(e, "C1", 8);
    }
View Full Code Here


        assertResult(e, "B1", 4);
        assertResult(e, "C1", 8);
    }

    public void testRangeDependencies() throws Exception {
        IterationEngine e = new IterationEngine(new BasicEngineProvider());
        e.set("A1", "1");
        e.set("B1", "2");
        e.set("A2", "3");
        e.set("B2", "4");
        e.set("D4", "=sum(A1:B2)");
        assertResult(e, "D4", 10);
        e.set("A1", "10");
        assertResult(e, "D4", 19);
    }
View Full Code Here

        e.set("A1", "10");
        assertResult(e, "D4", 19);
    }

    public void testFunction() throws Exception {
        IterationEngine e = new IterationEngine(new BasicEngineProvider());
        e.set("A4", "25");
        e.set("B6", "26");
        e.set("A1", "=sum(45,34,2.3,A4:B8)");
        assertResult(e, "A1", 132.3);
    }
View Full Code Here

        e.set("A1", "=sum(45,34,2.3,A4:B8)");
        assertResult(e, "A1", 132.3);
    }

    public void testArrays() throws Exception {
        IterationEngine e = new IterationEngine(new BasicEngineProvider());
        e.set("A1:B2", "32");
        assertResult(e, "A2", 32);
        e.set("D5:E6", "=TestRange(A1)");
    }
View Full Code Here

        assertResult(e, "A2", 32);
        e.set("D5:E6", "=TestRange(A1)");
    }

    public void testAliases() throws Exception {
        IterationEngine e = new IterationEngine(new BasicEngineProvider());
        e.setNamespace("Sheet1");
        e.addAlias("x", Range.valueOf("A1:B3"));
        e.addAlias("alias1", Range.valueOf("A1"));
        e.set("A1", "45");
        e.set("B1", "=alias1:x");
        e.set("B2", "=x");
        assertResult(e, "B1", 45);
        assertResult(e, "B2", 45);
    }
View Full Code Here

        assertResult(e, "B1", 45);
        assertResult(e, "B2", 45);
    }

    public void testInvalidReference() throws Exception {
        IterationEngine e = new IterationEngine(new BasicEngineProvider());
        assertException(e, "B1:A1", "12");
    }
View Full Code Here

        IterationEngine e = new IterationEngine(new BasicEngineProvider());
        assertException(e, "B1:A1", "12");
    }

    public void testCircular() throws Exception {
        IterationEngine e = new IterationEngine(new BasicEngineProvider());
    }
View Full Code Here

    public void testCircular() throws Exception {
        IterationEngine e = new IterationEngine(new BasicEngineProvider());
    }

    public void testManualCalculate() throws Exception {
        IterationEngine e = new IterationEngine(new BasicEngineProvider());
        e.setAutoCalculate(false);
    }
View Full Code Here

TOP

Related Classes of org.boris.expr.engine.IterationEngine

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.