version update

This commit is contained in:
Sergey Solovyev
2013-02-02 20:21:05 +04:00
parent cafa6b01ed
commit 8d84e24ca9
76 changed files with 282 additions and 874 deletions

View File

@@ -4,8 +4,8 @@ import junit.framework.Assert;
import org.jetbrains.annotations.NotNull;
import org.junit.Test;
import org.solovyev.android.calculator.units.CalculatorNumeralBase;
import org.solovyev.math.units.Unit;
import org.solovyev.math.units.UnitConverter;
import org.solovyev.common.units.Unit;
import org.solovyev.common.units.UnitConverter;
import java.util.Date;
import java.util.Random;

View File

@@ -53,7 +53,7 @@ public class AndroidCalculatorEditorViewTest {
for ( int j = 0; j < count; j++ ) {
try {
int textLength = random.nextInt(maxTextLength);
Locator.getInstance().getEditor().insert(StringUtils.generateRandomString(textLength), textLength);
Locator.getInstance().getEditor().insert(Strings.generateRandomString(textLength), textLength);
} catch (Throwable e) {
System.out.println(e);
error.set(true);

View File

@@ -14,7 +14,7 @@ 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.equals.EqualsTool;
import org.solovyev.common.Objects;
import org.solovyev.common.history.HistoryHelper;
import org.solovyev.common.history.SimpleHistoryHelper;
@@ -122,7 +122,7 @@ public class HistoryUtilsTest {
public void testToXml() throws Exception {
final Date date = new Date(100000000);
HistoryHelper<CalculatorHistoryState> history = new SimpleHistoryHelper<CalculatorHistoryState>();
HistoryHelper<CalculatorHistoryState> history = SimpleHistoryHelper.newInstance();
CalculatorDisplayViewState calculatorDisplay = CalculatorDisplayViewStateImpl.newErrorState(JsclOperation.simplify, "Error");
@@ -170,7 +170,7 @@ public class HistoryUtilsTest {
Assert.assertEquals(toXml2, xml);
final List<CalculatorHistoryState> fromXml = new ArrayList<CalculatorHistoryState>();
final HistoryHelper<CalculatorHistoryState> historyFromXml = new SimpleHistoryHelper<CalculatorHistoryState>();
final HistoryHelper<CalculatorHistoryState> historyFromXml = SimpleHistoryHelper.newInstance();
HistoryUtils.fromXml(xml, fromXml);
for (CalculatorHistoryState historyState : fromXml) {
historyFromXml.addState(historyState);
@@ -186,6 +186,6 @@ public class HistoryUtilsTest {
historyState.setId(0);
historyState.setSaved(true);
}
Assert.assertTrue(EqualsTool.areEqual(history.getStates(), historyFromXml.getStates(), new CollectionEqualizer<CalculatorHistoryState>(null)));
Assert.assertTrue(Objects.areEqual(history.getStates(), historyFromXml.getStates(), new CollectionEqualizer<CalculatorHistoryState>(null)));
}
}

View File

@@ -1,22 +0,0 @@
package org.solovyev.common;
import junit.framework.Assert;
import org.junit.Test;
import org.solovyev.common.interval.IntervalImpl;
import org.solovyev.common.text.NumberIntervalMapper;
/**
* User: serso
* Date: 9/23/11
* Time: 2:54 PM
*/
public class FloatIntervalMapperTest {
@Test
public void testParse() throws Exception {
final NumberIntervalMapper<Float> mapper = new NumberIntervalMapper<Float>(Float.class);
Assert.assertEquals(IntervalImpl.newClosed(1.2f, 12.2f), mapper.parseValue("1.2;12.2"));
Assert.assertEquals(IntervalImpl.newPoint(0f), mapper.parseValue("0;0"));
}
}

View File

@@ -1,34 +0,0 @@
package org.solovyev.common.math;
import org.junit.Assert;
import org.junit.Test;
/**
* User: serso
* Date: 9/20/11
* Time: 5:51 PM
*/
public class DiscreteNormalizerTest {
@Test
public void testNormalize() throws Exception {
DiscreteNormalizer dn = new DiscreteNormalizer(0, 10, 1d);
Assert.assertTrue(MathUtils.equals(0, dn.normalize(0.5), 2));
Assert.assertTrue(MathUtils.equals(0, dn.normalize(0.99), 2));
Assert.assertTrue(MathUtils.equals(0.1, dn.normalize(1), 2));
Assert.assertTrue(MathUtils.equals(0.1, dn.normalize(1.01), 2));
Assert.assertTrue(MathUtils.equals(1, dn.normalize(10), 2));
Assert.assertTrue(MathUtils.equals(0.9, dn.normalize(9.99), 2));
}
@Test
public void testDenormalize() throws Exception {
DiscreteNormalizer dn = new DiscreteNormalizer(0, 10, 1d);
Assert.assertTrue(MathUtils.equals(0, dn.normalize(dn.denormalize(0)), 2));
Assert.assertTrue(MathUtils.equals(0.1, dn.normalize(dn.denormalize(0.1)), 2));
Assert.assertTrue(MathUtils.equals(1, dn.normalize(dn.denormalize(1)), 2));
Assert.assertTrue(MathUtils.equals(0.9, dn.normalize(dn.denormalize(0.9)), 2));
}
}