This commit is contained in:
serso
2016-01-22 23:36:36 +01:00
parent bbaedc71c9
commit 81510d18ea
24 changed files with 124 additions and 211 deletions

View File

@@ -95,7 +95,7 @@ public class CalculatorTestUtils {
final JsclMathEngine jsclEngine = JsclMathEngine.getInstance();
final VarsRegistry varsRegistry = new VarsRegistry(jsclEngine.getConstantsRegistry(), entityDao);
final FunctionsRegistry functionsRegistry = new FunctionsRegistry(jsclEngine.getFunctionsRegistry());
final FunctionsRegistry functionsRegistry = new FunctionsRegistry(jsclEngine);
final OperatorsRegistry operatorsRegistry = new OperatorsRegistry(jsclEngine.getOperatorsRegistry());
final PostfixFunctionsRegistry postfixFunctionsRegistry = new PostfixFunctionsRegistry(jsclEngine.getPostfixFunctionsRegistry());

View File

@@ -132,7 +132,7 @@ public class HistoryTest {
}
private void addState(@Nonnull String text) {
history.addRecent(HistoryState.builder(EditorState.create(text, 3), DisplayState.empty()));
history.addRecent(HistoryState.builder(EditorState.create(text, 3), DisplayState.empty()).build());
}
private static final String oldXml1 = "<history>\n" +
@@ -281,7 +281,7 @@ public class HistoryTest {
@Test
public void testShouldLoadStates() throws Exception {
final List<HistoryState> states = Json.load(new File(HistoryTest.class.getResource("recent-history.json").getFile()));
final List<HistoryState> states = Json.load(new File(HistoryTest.class.getResource("recent-history.json").getFile()), HistoryState.JSON_CREATOR);
assertEquals(8, states.size());
HistoryState state = states.get(0);

View File

@@ -27,7 +27,7 @@ import org.junit.BeforeClass;
import org.junit.Test;
import org.solovyev.android.calculator.AbstractCalculatorTest;
import org.solovyev.android.calculator.CalculatorEvalException;
import org.solovyev.android.calculator.CalculatorParseException;
import org.solovyev.android.calculator.ParseException;
import org.solovyev.android.calculator.CalculatorTestUtils;
import org.solovyev.android.calculator.Locator;
import org.solovyev.common.Converter;
@@ -42,7 +42,6 @@ import au.com.bytecode.opencsv.CSVReader;
import jscl.JsclMathEngine;
import jscl.MathEngine;
import jscl.math.Expression;
import jscl.text.ParseException;
import jscl.util.ExpressionGeneratorWithInput;
/**
@@ -58,7 +57,7 @@ public class NumeralBaseTest extends AbstractCalculatorTest {
Locator.getInstance().getEngine().getMathEngine().setPrecision(3);
}
public static void testExpression(@Nonnull String[] line, @Nonnull Converter<String, String> converter) throws ParseException, CalculatorEvalException, CalculatorParseException {
public static void testExpression(@Nonnull String[] line, @Nonnull Converter<String, String> converter) throws jscl.text.ParseException, CalculatorEvalException, ParseException {
final String dec = line[0].toUpperCase();
final String hex = "0x:" + line[1].toUpperCase();
final String bin = "0b:" + line[2].toUpperCase();

View File

@@ -26,7 +26,7 @@ import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
import org.solovyev.android.calculator.AbstractCalculatorTest;
import org.solovyev.android.calculator.CalculatorParseException;
import org.solovyev.android.calculator.ParseException;
import org.solovyev.android.calculator.CalculatorTestUtils;
import org.solovyev.android.calculator.Locator;
import org.solovyev.android.calculator.PreparedExpression;
@@ -49,7 +49,7 @@ public class ToJsclTextProcessorTest extends AbstractCalculatorTest {
}
@Test
public void testSpecialCases() throws CalculatorParseException {
public void testSpecialCases() throws ParseException {
final TextProcessor<PreparedExpression, String> preprocessor = ToJsclTextProcessor.getInstance();
Assert.assertEquals("3^E10", preprocessor.process("3^E10").toString());
}
@@ -108,30 +108,30 @@ public class ToJsclTextProcessorTest extends AbstractCalculatorTest {
try {
preprocessor.process("ln()");
Assert.fail();
} catch (CalculatorParseException e) {
} catch (ParseException e) {
}
try {
preprocessor.process("ln()ln()");
Assert.fail();
} catch (CalculatorParseException e) {
} catch (ParseException e) {
}
try {
preprocessor.process("eln()eln()ln()ln()ln()e");
Assert.fail();
} catch (CalculatorParseException e) {
} catch (ParseException e) {
}
try {
preprocessor.process("ln(ln(ln(ln(ln(ln(ln(ln(ln(ln(ln(ln(ln(ln(ln()))))))))))))))");
Assert.fail();
} catch (CalculatorParseException e) {
} catch (ParseException e) {
}
try {
preprocessor.process("cos(cos(cos(cos(acos(acos(acos(acos(acos(acos(acos(acos(cos(cos(cos(cos(cosh(acos(cos(cos(cos(cos(cos(acos(acos(acos(acos(acos(acos(acos(acos(cos(cos(cos(cos(cosh(acos(cos())))))))))))))))))))))))))))))))))))))");
Assert.fail();
} catch (CalculatorParseException e) {
} catch (ParseException e) {
}
}