Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDani Megert2006-04-03 12:12:25 +0000
committerDani Megert2006-04-03 12:12:25 +0000
commitf4e676bc63555d9139242c3b1d19f6380404700b (patch)
treeaf5a7609f5380a4f0b6123a4b0221ebaa53137b3 /org.eclipse.jface.text.tests/src
parent0916e5720ca5909940bad96b0575634274aa7417 (diff)
downloadeclipse.platform.text-f4e676bc63555d9139242c3b1d19f6380404700b.tar.gz
eclipse.platform.text-f4e676bc63555d9139242c3b1d19f6380404700b.tar.xz
eclipse.platform.text-f4e676bc63555d9139242c3b1d19f6380404700b.zip
Fixed rounding bug
Diffstat (limited to 'org.eclipse.jface.text.tests/src')
-rw-r--r--org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/AbstractUndoManagerTest.java14
1 files changed, 7 insertions, 7 deletions
diff --git a/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/AbstractUndoManagerTest.java b/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/AbstractUndoManagerTest.java
index 1286f4ef4e4..b77d6c415ab 100644
--- a/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/AbstractUndoManagerTest.java
+++ b/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/AbstractUndoManagerTest.java
@@ -434,11 +434,7 @@ public abstract class AbstractUndoManagerTest extends TestCase {
}
private static final char getRandomCharacter() {
-// return Math.random() < 0.5
-// ? '\r'
-// : '\n';
-
- // XXX must include \r, \n, \t
+ // XXX should include \t
return (char) (32 + 95 * Math.random());
}
@@ -449,8 +445,12 @@ public abstract class AbstractUndoManagerTest extends TestCase {
private static Position createRandomPositionPoisson(int documentLength) {
- final float random= (float) Math.random();
- final int offset= (int) (random * (documentLength + 1));
+ float random= (float) Math.random();
+ int offset= (int) (random * (documentLength + 1));
+
+ // Catch potential rounding issue
+ if (offset == documentLength + 1)
+ offset= documentLength;
int length= getRandomPoissonValue(2);
if (offset + length > documentLength)

Back to the top