code reformat
This commit is contained in:
@@ -17,56 +17,56 @@ import java.util.Random;
|
||||
*/
|
||||
public class AndroidNumeralBaseTest {
|
||||
|
||||
@NotNull
|
||||
private final UnitConverter c = CalculatorNumeralBase.getConverter();
|
||||
@NotNull
|
||||
private final UnitConverter c = CalculatorNumeralBase.getConverter();
|
||||
|
||||
@Test
|
||||
public void testIsSupported() throws Exception {
|
||||
Assert.assertTrue(c.isSupported(CalculatorNumeralBase.bin, CalculatorNumeralBase.dec));
|
||||
}
|
||||
@Test
|
||||
public void testIsSupported() throws Exception {
|
||||
Assert.assertTrue(c.isSupported(CalculatorNumeralBase.bin, CalculatorNumeralBase.dec));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testConvertFromDec() throws Exception {
|
||||
@Test
|
||||
public void testConvertFromDec() throws Exception {
|
||||
|
||||
Assert.assertEquals("101", c.convert(CalculatorNumeralBase.dec.createUnit("5"), CalculatorNumeralBase.bin).getValue());
|
||||
Assert.assertEquals("1", c.convert(CalculatorNumeralBase.dec.createUnit("1"), CalculatorNumeralBase.bin).getValue());
|
||||
Assert.assertEquals("0", c.convert(CalculatorNumeralBase.dec.createUnit("0"), CalculatorNumeralBase.bin).getValue());
|
||||
Assert.assertEquals("1111100111", c.convert(CalculatorNumeralBase.dec.createUnit("999"), CalculatorNumeralBase.bin).getValue());
|
||||
Assert.assertEquals("101", c.convert(CalculatorNumeralBase.dec.createUnit("5"), CalculatorNumeralBase.bin).getValue());
|
||||
Assert.assertEquals("1", c.convert(CalculatorNumeralBase.dec.createUnit("1"), CalculatorNumeralBase.bin).getValue());
|
||||
Assert.assertEquals("0", c.convert(CalculatorNumeralBase.dec.createUnit("0"), CalculatorNumeralBase.bin).getValue());
|
||||
Assert.assertEquals("1111100111", c.convert(CalculatorNumeralBase.dec.createUnit("999"), CalculatorNumeralBase.bin).getValue());
|
||||
|
||||
Assert.assertEquals("A23", c.convert(CalculatorNumeralBase.dec.createUnit("2595"), CalculatorNumeralBase.hex).getValue());
|
||||
Assert.assertEquals("AEE", c.convert(CalculatorNumeralBase.dec.createUnit("2798"), CalculatorNumeralBase.hex).getValue());
|
||||
Assert.assertEquals("15", c.convert(CalculatorNumeralBase.dec.createUnit("21"), CalculatorNumeralBase.hex).getValue());
|
||||
Assert.assertEquals("0", c.convert(CalculatorNumeralBase.dec.createUnit("0"), CalculatorNumeralBase.hex).getValue());
|
||||
Assert.assertEquals("3E7", c.convert(CalculatorNumeralBase.dec.createUnit("999"), CalculatorNumeralBase.hex).getValue());
|
||||
Assert.assertEquals("A23", c.convert(CalculatorNumeralBase.dec.createUnit("2595"), CalculatorNumeralBase.hex).getValue());
|
||||
Assert.assertEquals("AEE", c.convert(CalculatorNumeralBase.dec.createUnit("2798"), CalculatorNumeralBase.hex).getValue());
|
||||
Assert.assertEquals("15", c.convert(CalculatorNumeralBase.dec.createUnit("21"), CalculatorNumeralBase.hex).getValue());
|
||||
Assert.assertEquals("0", c.convert(CalculatorNumeralBase.dec.createUnit("0"), CalculatorNumeralBase.hex).getValue());
|
||||
Assert.assertEquals("3E7", c.convert(CalculatorNumeralBase.dec.createUnit("999"), CalculatorNumeralBase.hex).getValue());
|
||||
|
||||
Assert.assertEquals("76", c.convert(CalculatorNumeralBase.dec.createUnit("62"), CalculatorNumeralBase.oct).getValue());
|
||||
Assert.assertEquals("12", c.convert(CalculatorNumeralBase.dec.createUnit("10"), CalculatorNumeralBase.oct).getValue());
|
||||
Assert.assertEquals("15", c.convert(CalculatorNumeralBase.dec.createUnit("13"), CalculatorNumeralBase.oct).getValue());
|
||||
Assert.assertEquals("0", c.convert(CalculatorNumeralBase.dec.createUnit("0"), CalculatorNumeralBase.oct).getValue());
|
||||
Assert.assertEquals("10445", c.convert(CalculatorNumeralBase.dec.createUnit("4389"), CalculatorNumeralBase.oct).getValue());
|
||||
}
|
||||
Assert.assertEquals("76", c.convert(CalculatorNumeralBase.dec.createUnit("62"), CalculatorNumeralBase.oct).getValue());
|
||||
Assert.assertEquals("12", c.convert(CalculatorNumeralBase.dec.createUnit("10"), CalculatorNumeralBase.oct).getValue());
|
||||
Assert.assertEquals("15", c.convert(CalculatorNumeralBase.dec.createUnit("13"), CalculatorNumeralBase.oct).getValue());
|
||||
Assert.assertEquals("0", c.convert(CalculatorNumeralBase.dec.createUnit("0"), CalculatorNumeralBase.oct).getValue());
|
||||
Assert.assertEquals("10445", c.convert(CalculatorNumeralBase.dec.createUnit("4389"), CalculatorNumeralBase.oct).getValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRandomConvert() throws Exception {
|
||||
final Random random = new Random(new Date().getTime());
|
||||
for (int i = 0; i < 100000; i++) {
|
||||
final String value = String.valueOf(random.nextInt());
|
||||
Assert.assertEquals(value, convertChain(value, CalculatorNumeralBase.dec, CalculatorNumeralBase.oct, CalculatorNumeralBase.oct, CalculatorNumeralBase.bin, CalculatorNumeralBase.dec));
|
||||
Assert.assertEquals(value, convertChain(value, CalculatorNumeralBase.dec, CalculatorNumeralBase.bin, CalculatorNumeralBase.hex, CalculatorNumeralBase.dec, CalculatorNumeralBase.dec));
|
||||
Assert.assertEquals(value, convertChain(value, CalculatorNumeralBase.dec, CalculatorNumeralBase.dec, CalculatorNumeralBase.hex, CalculatorNumeralBase.oct, CalculatorNumeralBase.dec));
|
||||
Assert.assertEquals(value, convertChain(value, CalculatorNumeralBase.dec, CalculatorNumeralBase.hex, CalculatorNumeralBase.bin, CalculatorNumeralBase.oct, CalculatorNumeralBase.dec));
|
||||
@Test
|
||||
public void testRandomConvert() throws Exception {
|
||||
final Random random = new Random(new Date().getTime());
|
||||
for (int i = 0; i < 100000; i++) {
|
||||
final String value = String.valueOf(random.nextInt());
|
||||
Assert.assertEquals(value, convertChain(value, CalculatorNumeralBase.dec, CalculatorNumeralBase.oct, CalculatorNumeralBase.oct, CalculatorNumeralBase.bin, CalculatorNumeralBase.dec));
|
||||
Assert.assertEquals(value, convertChain(value, CalculatorNumeralBase.dec, CalculatorNumeralBase.bin, CalculatorNumeralBase.hex, CalculatorNumeralBase.dec, CalculatorNumeralBase.dec));
|
||||
Assert.assertEquals(value, convertChain(value, CalculatorNumeralBase.dec, CalculatorNumeralBase.dec, CalculatorNumeralBase.hex, CalculatorNumeralBase.oct, CalculatorNumeralBase.dec));
|
||||
Assert.assertEquals(value, convertChain(value, CalculatorNumeralBase.dec, CalculatorNumeralBase.hex, CalculatorNumeralBase.bin, CalculatorNumeralBase.oct, CalculatorNumeralBase.dec));
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private String convertChain(@NotNull String value, @NotNull CalculatorNumeralBase baseAndroid, @NotNull CalculatorNumeralBase... typeAndroids) {
|
||||
Unit<String> unit = baseAndroid.createUnit(value);
|
||||
@NotNull
|
||||
private String convertChain(@NotNull String value, @NotNull CalculatorNumeralBase baseAndroid, @NotNull CalculatorNumeralBase... typeAndroids) {
|
||||
Unit<String> unit = baseAndroid.createUnit(value);
|
||||
|
||||
for (CalculatorNumeralBase typeAndroid : typeAndroids) {
|
||||
unit = CalculatorNumeralBase.getConverter().convert(unit, typeAndroid);
|
||||
}
|
||||
for (CalculatorNumeralBase typeAndroid : typeAndroids) {
|
||||
unit = CalculatorNumeralBase.getConverter().convert(unit, typeAndroid);
|
||||
}
|
||||
|
||||
return unit.getValue();
|
||||
}
|
||||
return unit.getValue();
|
||||
}
|
||||
}
|
||||
|
@@ -13,19 +13,19 @@ import org.junit.runner.RunWith;
|
||||
@RunWith(value = CalculatorppTestRunner.class)
|
||||
public class AndroidCalculatorEditorViewTest {
|
||||
|
||||
@BeforeClass
|
||||
public static void staticSetUp() throws Exception {
|
||||
/*CalculatorTestUtils.staticSetUp(null);*/
|
||||
}
|
||||
@BeforeClass
|
||||
public static void staticSetUp() throws Exception {
|
||||
/*CalculatorTestUtils.staticSetUp(null);*/
|
||||
}
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
/* CalculatorActivity context = new CalculatorActivity();
|
||||
CalculatorTestUtils.initViews(context);*/
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAsyncWork() throws Exception {
|
||||
@Test
|
||||
public void testAsyncWork() throws Exception {
|
||||
/* final int threadNum = 10;
|
||||
final int count = 10;
|
||||
final int maxTextLength = 100;
|
||||
@@ -71,5 +71,5 @@ public class AndroidCalculatorEditorViewTest {
|
||||
} else {
|
||||
Assert.fail("Too long execution!");
|
||||
}*/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -16,41 +16,41 @@ import org.solovyev.android.calculator.plot.CalculatorPlotter;
|
||||
*/
|
||||
public class CalculatorTestUtils {
|
||||
|
||||
public static void staticSetUp(@Nullable Context context) throws Exception {
|
||||
Locator.getInstance().init(new CalculatorImpl(), newCalculatorEngine(), Mockito.mock(CalculatorClipboard.class), Mockito.mock(CalculatorNotifier.class), Mockito.mock(CalculatorHistory.class), new SystemOutCalculatorLogger(), Mockito.mock(CalculatorPreferenceService.class), Mockito.mock(CalculatorKeyboard.class), Mockito.mock(CalculatorExternalListenersContainer.class), Mockito.mock(CalculatorPlotter.class));
|
||||
Locator.getInstance().getEngine().init();
|
||||
public static void staticSetUp(@Nullable Context context) throws Exception {
|
||||
Locator.getInstance().init(new CalculatorImpl(), newCalculatorEngine(), Mockito.mock(CalculatorClipboard.class), Mockito.mock(CalculatorNotifier.class), Mockito.mock(CalculatorHistory.class), new SystemOutCalculatorLogger(), Mockito.mock(CalculatorPreferenceService.class), Mockito.mock(CalculatorKeyboard.class), Mockito.mock(CalculatorExternalListenersContainer.class), Mockito.mock(CalculatorPlotter.class));
|
||||
Locator.getInstance().getEngine().init();
|
||||
|
||||
if ( context != null ) {
|
||||
initViews(context);
|
||||
}
|
||||
}
|
||||
if (context != null) {
|
||||
initViews(context);
|
||||
}
|
||||
}
|
||||
|
||||
public static void initViews(@NotNull Context context) {
|
||||
final AndroidCalculatorEditorView editor = new AndroidCalculatorEditorView(context);
|
||||
editor.init(context);
|
||||
Locator.getInstance().getEditor().setView(editor);
|
||||
public static void initViews(@NotNull Context context) {
|
||||
final AndroidCalculatorEditorView editor = new AndroidCalculatorEditorView(context);
|
||||
editor.init(context);
|
||||
Locator.getInstance().getEditor().setView(editor);
|
||||
|
||||
final AndroidCalculatorDisplayView display = new AndroidCalculatorDisplayView(context);
|
||||
display.init(context);
|
||||
Locator.getInstance().getDisplay().setView(display);
|
||||
}
|
||||
final AndroidCalculatorDisplayView display = new AndroidCalculatorDisplayView(context);
|
||||
display.init(context);
|
||||
Locator.getInstance().getDisplay().setView(display);
|
||||
}
|
||||
|
||||
public static void staticSetUp() throws Exception {
|
||||
staticSetUp(null);
|
||||
}
|
||||
public static void staticSetUp() throws Exception {
|
||||
staticSetUp(null);
|
||||
}
|
||||
|
||||
|
||||
@NotNull
|
||||
static CalculatorEngineImpl newCalculatorEngine() {
|
||||
final MathEntityDao mathEntityDao = Mockito.mock(MathEntityDao.class);
|
||||
@NotNull
|
||||
static CalculatorEngineImpl newCalculatorEngine() {
|
||||
final MathEntityDao mathEntityDao = Mockito.mock(MathEntityDao.class);
|
||||
|
||||
final JsclMathEngine jsclEngine = JsclMathEngine.getInstance();
|
||||
final JsclMathEngine jsclEngine = JsclMathEngine.getInstance();
|
||||
|
||||
final CalculatorVarsRegistry varsRegistry = new CalculatorVarsRegistry(jsclEngine.getConstantsRegistry(), mathEntityDao);
|
||||
final CalculatorFunctionsMathRegistry functionsRegistry = new CalculatorFunctionsMathRegistry(jsclEngine.getFunctionsRegistry(), mathEntityDao);
|
||||
final CalculatorOperatorsMathRegistry operatorsRegistry = new CalculatorOperatorsMathRegistry(jsclEngine.getOperatorsRegistry(), mathEntityDao);
|
||||
final CalculatorPostfixFunctionsRegistry postfixFunctionsRegistry = new CalculatorPostfixFunctionsRegistry(jsclEngine.getPostfixFunctionsRegistry(), mathEntityDao);
|
||||
final CalculatorVarsRegistry varsRegistry = new CalculatorVarsRegistry(jsclEngine.getConstantsRegistry(), mathEntityDao);
|
||||
final CalculatorFunctionsMathRegistry functionsRegistry = new CalculatorFunctionsMathRegistry(jsclEngine.getFunctionsRegistry(), mathEntityDao);
|
||||
final CalculatorOperatorsMathRegistry operatorsRegistry = new CalculatorOperatorsMathRegistry(jsclEngine.getOperatorsRegistry(), mathEntityDao);
|
||||
final CalculatorPostfixFunctionsRegistry postfixFunctionsRegistry = new CalculatorPostfixFunctionsRegistry(jsclEngine.getPostfixFunctionsRegistry(), mathEntityDao);
|
||||
|
||||
return new CalculatorEngineImpl(jsclEngine, varsRegistry, functionsRegistry, operatorsRegistry, postfixFunctionsRegistry, null);
|
||||
}
|
||||
return new CalculatorEngineImpl(jsclEngine, varsRegistry, functionsRegistry, operatorsRegistry, postfixFunctionsRegistry, null);
|
||||
}
|
||||
}
|
||||
|
@@ -13,7 +13,7 @@ import java.io.File;
|
||||
*/
|
||||
public class CalculatorppTestRunner extends RobolectricTestRunner {
|
||||
|
||||
public CalculatorppTestRunner(@NotNull Class<?> testClass) throws InitializationError {
|
||||
super(testClass, new File("."));
|
||||
}
|
||||
public CalculatorppTestRunner(@NotNull Class<?> testClass) throws InitializationError {
|
||||
super(testClass, new File("."));
|
||||
}
|
||||
}
|
||||
|
@@ -25,12 +25,12 @@ import java.util.Random;
|
||||
*/
|
||||
public class TextHighlighterTest {
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
CalculatorTestUtils.staticSetUp();
|
||||
}
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
CalculatorTestUtils.staticSetUp();
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test
|
||||
public void testProcess() throws Exception {
|
||||
TextProcessor<?, String> textHighlighter = new TextHighlighter(0, false);
|
||||
|
||||
@@ -127,35 +127,35 @@ public class TextHighlighterTest {
|
||||
|
||||
try {
|
||||
me.setNumeralBase(NumeralBase.bin);
|
||||
Assert.assertEquals("110101", textHighlighter.process("110101").toString());
|
||||
Assert.assertEquals("110101.", textHighlighter.process("110101.").toString());
|
||||
Assert.assertEquals("110101.101", textHighlighter.process("110101.101").toString());
|
||||
Assert.assertEquals("11010100.1", textHighlighter.process("11010100.1").toString());
|
||||
Assert.assertEquals("110101.0", textHighlighter.process("110101.0").toString());
|
||||
Assert.assertEquals("0", textHighlighter.process("0").toString());
|
||||
Assert.assertEquals("1010100101111010101001", textHighlighter.process("1010100101111010101001").toString());
|
||||
Assert.assertEquals("101 010 01 0 111 1 0 10101001", textHighlighter.process("101 010 01 0 111 1 0 10101001").toString());
|
||||
Assert.assertEquals("110101", textHighlighter.process("110101").toString());
|
||||
Assert.assertEquals("110101.", textHighlighter.process("110101.").toString());
|
||||
Assert.assertEquals("110101.101", textHighlighter.process("110101.101").toString());
|
||||
Assert.assertEquals("11010100.1", textHighlighter.process("11010100.1").toString());
|
||||
Assert.assertEquals("110101.0", textHighlighter.process("110101.0").toString());
|
||||
Assert.assertEquals("0", textHighlighter.process("0").toString());
|
||||
Assert.assertEquals("1010100101111010101001", textHighlighter.process("1010100101111010101001").toString());
|
||||
Assert.assertEquals("101 010 01 0 111 1 0 10101001", textHighlighter.process("101 010 01 0 111 1 0 10101001").toString());
|
||||
} finally {
|
||||
me.setNumeralBase(NumeralBase.dec);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTime() throws Exception {
|
||||
final TextProcessor<?, String> textHighlighter = new TextHighlighter(Color.WHITE, false);
|
||||
@Test
|
||||
public void testTime() throws Exception {
|
||||
final TextProcessor<?, String> textHighlighter = new TextHighlighter(Color.WHITE, false);
|
||||
|
||||
final int count = 1000;
|
||||
final String subExpression = "cos(acos(t8ln(t5t85tln(8ln(5t55tln(5))))))+tln(88cos(tln(t)))+t√(ln(t))";
|
||||
final StringBuilder expression = new StringBuilder(subExpression.length() * count);
|
||||
for ( int i = 0; i < count; i++ ){
|
||||
expression.append(subExpression);
|
||||
expression.append("+");
|
||||
}
|
||||
expression.append(subExpression);
|
||||
final int count = 1000;
|
||||
final String subExpression = "cos(acos(t8ln(t5t85tln(8ln(5t55tln(5))))))+tln(88cos(tln(t)))+t√(ln(t))";
|
||||
final StringBuilder expression = new StringBuilder(subExpression.length() * count);
|
||||
for (int i = 0; i < count; i++) {
|
||||
expression.append(subExpression);
|
||||
expression.append("+");
|
||||
}
|
||||
expression.append(subExpression);
|
||||
|
||||
long startTime = System.currentTimeMillis();
|
||||
textHighlighter.process(expression.toString());
|
||||
long endTime = System.currentTimeMillis();
|
||||
System.out.println("Total time, ms: " + (endTime - startTime));
|
||||
}
|
||||
long startTime = System.currentTimeMillis();
|
||||
textHighlighter.process(expression.toString());
|
||||
long endTime = System.currentTimeMillis();
|
||||
System.out.println("Total time, ms: " + (endTime - startTime));
|
||||
}
|
||||
}
|
||||
|
@@ -13,8 +13,8 @@ import org.solovyev.android.calculator.CalculatorDisplayViewStateImpl;
|
||||
import org.solovyev.android.calculator.CalculatorEditorViewState;
|
||||
import org.solovyev.android.calculator.CalculatorEditorViewStateImpl;
|
||||
import org.solovyev.android.calculator.jscl.JsclOperation;
|
||||
import org.solovyev.common.equals.CollectionEqualizer;
|
||||
import org.solovyev.common.Objects;
|
||||
import org.solovyev.common.equals.CollectionEqualizer;
|
||||
import org.solovyev.common.history.HistoryHelper;
|
||||
import org.solovyev.common.history.SimpleHistoryHelper;
|
||||
|
||||
@@ -139,7 +139,7 @@ public class HistoryUtilsTest {
|
||||
|
||||
Assert.assertEquals(toXml1, HistoryUtils.toXml(history.getStates()));
|
||||
|
||||
calculatorDisplay = CalculatorDisplayViewStateImpl.newValidState(JsclOperation.numeric, null, "5/6", 3);
|
||||
calculatorDisplay = CalculatorDisplayViewStateImpl.newValidState(JsclOperation.numeric, null, "5/6", 3);
|
||||
|
||||
calculatorEditor = CalculatorEditorViewStateImpl.newInstance("5/6", 2);
|
||||
|
||||
@@ -148,18 +148,18 @@ public class HistoryUtilsTest {
|
||||
state.setTime(date.getTime());
|
||||
history.addState(state);
|
||||
|
||||
calculatorDisplay = CalculatorDisplayViewStateImpl.newErrorState(JsclOperation.elementary, "Error");
|
||||
calculatorDisplay = CalculatorDisplayViewStateImpl.newErrorState(JsclOperation.elementary, "Error");
|
||||
|
||||
calculatorEditor = CalculatorEditorViewStateImpl.newInstance("", 1);
|
||||
calculatorEditor = CalculatorEditorViewStateImpl.newInstance("", 1);
|
||||
|
||||
state = CalculatorHistoryState.newInstance(calculatorEditor, calculatorDisplay);
|
||||
state.setSaved(true);
|
||||
state.setTime(date.getTime());
|
||||
history.addState(state);
|
||||
|
||||
calculatorDisplay = CalculatorDisplayViewStateImpl.newValidState(JsclOperation.numeric, null, "4+5/35sin(41)+dfdsfsdfs", 1);
|
||||
calculatorDisplay = CalculatorDisplayViewStateImpl.newValidState(JsclOperation.numeric, null, "4+5/35sin(41)+dfdsfsdfs", 1);
|
||||
|
||||
calculatorEditor = CalculatorEditorViewStateImpl.newInstance("4+5/35sin(41)+dfdsfsdfs", 0);
|
||||
calculatorEditor = CalculatorEditorViewStateImpl.newInstance("4+5/35sin(41)+dfdsfsdfs", 0);
|
||||
|
||||
state = CalculatorHistoryState.newInstance(calculatorEditor, calculatorDisplay);
|
||||
state.setSaved(true);
|
||||
|
@@ -10,21 +10,21 @@ import org.junit.Test;
|
||||
*/
|
||||
public class CalculatorGraph2dViewTest {
|
||||
|
||||
@Test
|
||||
public void testFormatTick() throws Exception {
|
||||
Assert.assertEquals("23324", CalculatorGraph2dView.formatTick(23324.0f, 0));
|
||||
Assert.assertEquals("23324.1", CalculatorGraph2dView.formatTick(23324.1f, 1));
|
||||
}
|
||||
@Test
|
||||
public void testFormatTick() throws Exception {
|
||||
Assert.assertEquals("23324", CalculatorGraph2dView.formatTick(23324.0f, 0));
|
||||
Assert.assertEquals("23324.1", CalculatorGraph2dView.formatTick(23324.1f, 1));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCountTickDigits() throws Exception {
|
||||
Assert.assertEquals(0, CalculatorGraph2dView.countTickDigits(1));
|
||||
Assert.assertEquals(0, CalculatorGraph2dView.countTickDigits(10));
|
||||
Assert.assertEquals(0, CalculatorGraph2dView.countTickDigits(100));
|
||||
Assert.assertEquals(1, CalculatorGraph2dView.countTickDigits(0.9f));
|
||||
Assert.assertEquals(1, CalculatorGraph2dView.countTickDigits(0.2f));
|
||||
Assert.assertEquals(1, CalculatorGraph2dView.countTickDigits(0.1f));
|
||||
Assert.assertEquals(2, CalculatorGraph2dView.countTickDigits(0.099f));
|
||||
Assert.assertEquals(3, CalculatorGraph2dView.countTickDigits(0.009f));
|
||||
}
|
||||
@Test
|
||||
public void testCountTickDigits() throws Exception {
|
||||
Assert.assertEquals(0, CalculatorGraph2dView.countTickDigits(1));
|
||||
Assert.assertEquals(0, CalculatorGraph2dView.countTickDigits(10));
|
||||
Assert.assertEquals(0, CalculatorGraph2dView.countTickDigits(100));
|
||||
Assert.assertEquals(1, CalculatorGraph2dView.countTickDigits(0.9f));
|
||||
Assert.assertEquals(1, CalculatorGraph2dView.countTickDigits(0.2f));
|
||||
Assert.assertEquals(1, CalculatorGraph2dView.countTickDigits(0.1f));
|
||||
Assert.assertEquals(2, CalculatorGraph2dView.countTickDigits(0.099f));
|
||||
Assert.assertEquals(3, CalculatorGraph2dView.countTickDigits(0.009f));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user