Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDani Megert2004-04-14 15:46:14 +0000
committerDani Megert2004-04-14 15:46:14 +0000
commit8048882152e3dd8bb9dd4d25ae2968c9aba05fdb (patch)
tree11941e4c47f030341fa942a532f882605d089677 /org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/TextHoverPopupTest.java
parentfeec0ceb0b6a70b3211729f5051a965caf07b8c3 (diff)
downloadeclipse.platform.text-8048882152e3dd8bb9dd4d25ae2968c9aba05fdb.tar.gz
eclipse.platform.text-8048882152e3dd8bb9dd4d25ae2968c9aba05fdb.tar.xz
eclipse.platform.text-8048882152e3dd8bb9dd4d25ae2968c9aba05fdb.zip
Initial Release - work in progressInitial_Release
Diffstat (limited to 'org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/TextHoverPopupTest.java')
-rw-r--r--org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/TextHoverPopupTest.java73
1 files changed, 73 insertions, 0 deletions
diff --git a/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/TextHoverPopupTest.java b/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/TextHoverPopupTest.java
new file mode 100644
index 00000000000..ecb93b13d2a
--- /dev/null
+++ b/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/TextHoverPopupTest.java
@@ -0,0 +1,73 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jface.text.tests;
+
+import junit.awtui.TestRunner;
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+
+public class TextHoverPopupTest extends TestCase {
+
+
+ public TextHoverPopupTest(String name) {
+ super(name);
+ }
+
+ public static void main(String args[]) {
+ String a[] = { "org.eclipse.jface.text.tests.TextHoverPopupTest" };
+ TestRunner.main(a);
+ }
+
+ protected void setUp() {
+ }
+
+ public static Test suite() {
+ return new TestSuite(TextHoverPopupTest.class);
+ }
+
+ protected void tearDown() {
+ }
+
+
+ protected int search(int[] array, int x) {
+ int low= 0;
+ int high= array.length -1;
+
+ while (high > low) {
+ int offset= (low + high) / 2;
+ int lookup= array[offset];
+ if (lookup > x)
+ high= offset - 1;
+ else if (lookup < x)
+ low= offset + 1;
+ else
+ low= high= offset;
+ }
+
+ return high;
+ }
+
+ public void testSearch() {
+ int[] values= { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
+ for (int i= 0; i < 10; i++) {
+ int result= search(values, i);
+ assertTrue(i == result);
+ }
+
+ int[] values2= { 0, 3, 6, 9, 12, 15, 18, 21, 24, 27 };
+ for (int i= 0; i < 10; i++) {
+ int result= search(values2, i * 3);
+ assertTrue(i == result);
+ }
+ }
+}

Back to the top