public void testVanilla() throws Exception { trans._formula = "(FOO + BAR) / baz"; trans.init(); assertFormulaResult(2.0, 10, 10, 10); assertFormulaResult(10.0, 10, 10, 2); assertFormulaResult(5.0, 0, 10, 2); trans._formula = "(FOO + BAR) % baz"; trans.init(); assertFormulaResult(0, 0, 10, 2); assertFormulaResult(4, 3, 11, 5); }
public void testDivideByZero() throws Exception { trans._formula = "(FOO + BAR) / baz"; trans.init(); assertFormulaResult(null, 10, 10, 0); assertFormulaResult(null, -10, -10, 0); assertFormulaResult(null, 0, 0, 0); }
public void testColumnAliases() throws Exception { foo.setName("hello world"); bar.setName("lorem ipsum"); trans._formula = "(helloworld + lorem_ipsum) / col3"; trans.init(); assertFormulaResult(2.0, 10, 10, 10); assertFormulaResult(10.0, 10, 10, 2); assertFormulaResult(5.0, 0, 10, 2); }
public void testNullVariables() throws Exception { trans._formula = "(FOO + BAR) / baz"; trans.init(); assertFormulaResult(1.0, null, 10, 10); }