Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 186054 Details for
Bug 183164
[Implementation for] Display of Complex Expressions Containing Bidirectional Text
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Updated JUnits corresponding to patch_bidi_20110104
patch_test_20110104.txt (text/plain), 98.72 KB, created by
Matitiahu Allouche
on 2011-01-04 16:47:32 EST
(
hide
)
Description:
Updated JUnits corresponding to patch_bidi_20110104
Filename:
MIME Type:
Creator:
Matitiahu Allouche
Created:
2011-01-04 16:47:32 EST
Size:
98.72 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.equinox.bidi.tests >Index: plugin.xml >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/components/bundles/org.eclipse.equinox.bidi.tests/plugin.xml,v >retrieving revision 1.1 >diff -u -r1.1 plugin.xml >--- plugin.xml 3 Feb 2010 20:08:12 -0000 1.1 >+++ plugin.xml 4 Jan 2011 21:41:34 -0000 >@@ -5,7 +5,7 @@ > id="id2" > point="org.eclipse.equinox.bidi.bidiTypes"> > <typeDescription >- class="org.eclipse.equinox.bidi.internal.tests.ComplExpTest" >+ class="org.eclipse.equinox.bidi.internal.tests.CxpTest" > description="Test" > type="test"> > </typeDescription> >Index: src/org/eclipse/equinox/bidi/internal/tests/ComplExpMathTest.java >=================================================================== >RCS file: src/org/eclipse/equinox/bidi/internal/tests/ComplExpMathTest.java >diff -N src/org/eclipse/equinox/bidi/internal/tests/ComplExpMathTest.java >--- src/org/eclipse/equinox/bidi/internal/tests/ComplExpMathTest.java 17 Mar 2010 17:53:44 -0000 1.3 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,55 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2010 IBM Corporation and others. >- * All rights reserved. This program and the accompanying materials >- * are made available under the terms of the Eclipse Public License v1.0 >- * which accompanies this distribution, and is available at >- * http://www.eclipse.org/legal/epl-v10.html >- * >- * Contributors: >- * IBM Corporation - initial API and implementation >- ******************************************************************************/ >- >-package org.eclipse.equinox.bidi.internal.tests; >- >-import org.eclipse.equinox.bidi.complexp.IBiDiProcessor; >-import org.eclipse.equinox.bidi.complexp.IComplExpProcessor; >-import org.eclipse.equinox.bidi.complexp.StringProcessor; >- >-/** >- * Tests RTL arithmetic >- */ >-public class ComplExpMathTest extends ComplExpTestBase { >- >- private IComplExpProcessor processor; >- >- protected void setUp() throws Exception { >- super.setUp(); >- processor = StringProcessor.getProcessor(IBiDiProcessor.RTL_ARITHMETIC); >- } >- >- private void verifyOneLine(String msg, String data, String resLTR, >- String resRTL) { >- String lean = toUT16(data); >- processor.assumeOrientation(IComplExpProcessor.ORIENT_LTR); >- String fullLTR = processor.leanToFullText(lean); >- assertEquals(msg + " LTR - ", resLTR, toPseudo(fullLTR)); >- >- processor.assumeOrientation(IComplExpProcessor.ORIENT_RTL); >- String fullRTL = processor.leanToFullText(lean); >- assertEquals(msg + " RTL - ", resRTL, toPseudo(fullRTL)); >- } >- >- public void testRTLarithmetic() { >- verifyOneLine("Math #0", "", "", ""); >- verifyOneLine("Math #1", "1+abc", "<&1+abc&^", "1+abc"); >- verifyOneLine("Math #2", "2+abc-def", "<&2+abc&-def&^", "2+abc&-def"); >- verifyOneLine("Math #3", "a+3*bc/def", "<&a&+3*bc&/def&^", >- "a&+3*bc&/def"); >- verifyOneLine("Math #4", "4+abc/def", "<&4+abc&/def&^", "4+abc&/def"); >- verifyOneLine("Math #5", "13ABC", "<&13ABC&^", "13ABC"); >- verifyOneLine("Math #6", "14ABC-DE", "<&14ABC-DE&^", "14ABC-DE"); >- verifyOneLine("Math #7", "15ABC+DE", "<&15ABC+DE&^", "15ABC+DE"); >- verifyOneLine("Math #8", "16ABC*DE", "<&16ABC*DE&^", "16ABC*DE"); >- verifyOneLine("Math #9", "17ABC/DE", "<&17ABC/DE&^", "17ABC/DE"); >- } >-} >Index: src/org/eclipse/equinox/bidi/internal/tests/ComplExpTest.java >=================================================================== >RCS file: src/org/eclipse/equinox/bidi/internal/tests/ComplExpTest.java >diff -N src/org/eclipse/equinox/bidi/internal/tests/ComplExpTest.java >--- src/org/eclipse/equinox/bidi/internal/tests/ComplExpTest.java 17 Mar 2010 17:53:43 -0000 1.3 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,136 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2010 IBM Corporation and others. >- * All rights reserved. This program and the accompanying materials >- * are made available under the terms of the Eclipse Public License v1.0 >- * which accompanies this distribution, and is available at >- * http://www.eclipse.org/legal/epl-v10.html >- * >- * Contributors: >- * IBM Corporation - initial API and implementation >- ******************************************************************************/ >-package org.eclipse.equinox.bidi.internal.tests; >- >-import org.eclipse.equinox.bidi.complexp.IComplExpProcessor; >- >-public class ComplExpTest implements IComplExpProcessor { >- >- private static final int[] EMPTY_INT_ARRAY = new int[0]; >- private static final int[][] ALL_LTR = new int[][] { >- { DIRECTION_LTR, DIRECTION_LTR }, { DIRECTION_LTR, DIRECTION_LTR } }; >- >- public ComplExpTest() { >- return; >- } >- >- public void setOperators(String operators) { >- // empty >- } >- >- public String getOperators() { >- return ""; >- } >- >- public void selectBidiScript(boolean arabic, boolean hebrew) { >- // empty >- } >- >- public boolean handlesArabicScript() { >- return false; >- } >- >- public boolean handlesHebrewScript() { >- return false; >- } >- >- public String leanToFullText(String text) { >- return text; >- } >- >- public String leanToFullText(String text, int initState) { >- return text; >- } >- >- public int[] leanBidiCharOffsets(String text) { >- return EMPTY_INT_ARRAY; >- } >- >- public int[] leanBidiCharOffsets(String text, int initState) { >- return EMPTY_INT_ARRAY; >- } >- >- public int[] leanBidiCharOffsets() { >- return EMPTY_INT_ARRAY; >- } >- >- public int[] fullBidiCharOffsets() { >- return EMPTY_INT_ARRAY; >- } >- >- public String fullToLeanText(String text) { >- return text; >- } >- >- public String fullToLeanText(String text, int initState) { >- return text; >- } >- >- public int getFinalState() { >- return STATE_NOTHING_GOING; >- } >- >- public int leanToFullPos(int pos) { >- return pos; >- } >- >- public int fullToLeanPos(int pos) { >- return pos; >- } >- >- public void assumeMirrored(boolean mirrored) { >- // empty >- } >- >- public boolean isMirrored() { >- return false; >- } >- >- public void assumeOrientation(int orientation) { >- // empty >- } >- >- public int recallOrientation() { >- return ORIENT_LTR; >- } >- >- public void setArabicDirection(int not_mirrored, int mirrored) { >- // empty >- } >- >- public void setArabicDirection(int direction) { >- // empty >- } >- >- public void setHebrewDirection(int not_mirrored, int mirrored) { >- // empty >- } >- >- public void setHebrewDirection(int direction) { >- // empty >- } >- >- public void setDirection(int not_mirrored, int mirrored) { >- // empty >- } >- >- public void setDirection(int direction) { >- // empty >- } >- >- public int[][] getDirection() { >- return ALL_LTR; >- } >- >- public int getCurDirection() { >- return DIRECTION_LTR; >- } >-} >Index: src/org/eclipse/equinox/bidi/internal/tests/ComplExpTestBase.java >=================================================================== >RCS file: src/org/eclipse/equinox/bidi/internal/tests/ComplExpTestBase.java >diff -N src/org/eclipse/equinox/bidi/internal/tests/ComplExpTestBase.java >--- src/org/eclipse/equinox/bidi/internal/tests/ComplExpTestBase.java 17 Mar 2010 17:53:44 -0000 1.2 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,156 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2010 IBM Corporation and others. >- * All rights reserved. This program and the accompanying materials >- * are made available under the terms of the Eclipse Public License v1.0 >- * which accompanies this distribution, and is available at >- * http://www.eclipse.org/legal/epl-v10.html >- * >- * Contributors: >- * IBM Corporation - initial API and implementation >- ******************************************************************************/ >- >-package org.eclipse.equinox.bidi.internal.tests; >- >-import junit.framework.TestCase; >- >-/** >- * Base functionality for the processor tests. >- */ >-public class ComplExpTestBase extends TestCase { >- >- static final private char LRM = 0x200E; >- static final private char RLM = 0x200F; >- static final private char LRE = 0x202A; >- static final private char RLE = 0x202B; >- static final private char PDF = 0x202C; >- >- protected String toPseudo(String text) { >- char[] chars = text.toCharArray(); >- int len = chars.length; >- >- for (int i = 0; i < len; i++) { >- char c = chars[i]; >- if (c >= 'A' && c <= 'Z') >- chars[i] = (char) (c + 'a' - 'A'); >- else if (c >= 0x05D0 && c < 0x05EA) >- chars[i] = (char) (c + 'A' - 0x05D0); >- else if (c == 0x05EA) >- chars[i] = '~'; >- else if (c == 0x0644) >- chars[i] = '#'; >- else if (c >= 0x0665 && c <= 0x0669) >- chars[i] = (char) (c + '5' - 0x0665); >- else if (c == LRM) >- chars[i] = '@'; >- else if (c == RLM) >- chars[i] = '&'; >- else if (c == LRE) >- chars[i] = '>'; >- else if (c == RLE) >- chars[i] = '<'; >- else if (c == PDF) >- chars[i] = '^'; >- else if (c == '\n') >- chars[i] = '|'; >- else if (c == '\r') >- chars[i] = '`'; >- } >- return new String(chars); >- } >- >- protected String toUT16(String text) { >- char[] chars = text.toCharArray(); >- int len = chars.length; >- >- for (int i = 0; i < len; i++) { >- char c = chars[i]; >- if (c >= '5' && c <= '9') >- chars[i] = (char) (0x0665 + c - '5'); >- else if (c >= 'A' && c <= 'Z') >- chars[i] = (char) (0x05D0 + c - 'A'); >- else if (c == '~') >- chars[i] = (char) (0x05EA); >- else if (c == '#') >- chars[i] = (char) (0x0644); >- else if (c == '@') >- chars[i] = LRM; >- else if (c == '&') >- chars[i] = RLM; >- else if (c == '>') >- chars[i] = LRE; >- else if (c == '<') >- chars[i] = RLE; >- else if (c == '^') >- chars[i] = PDF; >- else if (c == '|') >- chars[i] = '\n'; >- else if (c == '`') >- chars[i] = '\r'; >- } >- return new String(chars); >- } >- >- static String array_display(int[] array) { >- if (array == null) { >- return "null"; >- } >- StringBuffer sb = new StringBuffer(50); >- int len = array.length; >- for (int i = 0; i < len; i++) { >- sb.append(array[i]); >- sb.append(' '); >- } >- return sb.toString(); >- } >- >- static boolean arrays_equal(int[] one, int[] two) { >- int len = one.length; >- if (len != two.length) { >- return false; >- } >- for (int i = 0; i < len; i++) { >- if (one[i] != two[i]) { >- return false; >- } >- } >- return true; >- } >- >- static boolean arrays2_equal(int[][] one, int[][] two) { >- int dim1, dim2; >- dim1 = one.length; >- if (dim1 != two.length) { >- return false; >- } >- for (int i = 0; i < dim1; i++) { >- dim2 = one[i].length; >- if (dim2 != two[i].length) { >- return false; >- } >- for (int j = 0; j < dim2; j++) { >- if (one[i][j] != two[i][j]) { >- return false; >- } >- } >- } >- return true; >- } >- >- static String array2_display(int[][] array) { >- int dim1, dim2; >- if (array == null) { >- return "null"; >- } >- StringBuffer sb = new StringBuffer(50); >- dim1 = array.length; >- for (int i = 0; i < dim1; i++) { >- dim2 = array[i].length; >- for (int j = 0; j < dim2; j++) { >- sb.append(array[i][j]); >- sb.append(' '); >- } >- } >- return sb.toString(); >- } >- >-} >Index: src/org/eclipse/equinox/bidi/internal/tests/ComplExpUtilTest.java >=================================================================== >RCS file: src/org/eclipse/equinox/bidi/internal/tests/ComplExpUtilTest.java >diff -N src/org/eclipse/equinox/bidi/internal/tests/ComplExpUtilTest.java >--- src/org/eclipse/equinox/bidi/internal/tests/ComplExpUtilTest.java 17 Mar 2010 17:53:44 -0000 1.2 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,131 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2010 IBM Corporation and others. >- * All rights reserved. This program and the accompanying materials >- * are made available under the terms of the Eclipse Public License v1.0 >- * which accompanies this distribution, and is available at >- * http://www.eclipse.org/legal/epl-v10.html >- * >- * Contributors: >- * IBM Corporation - initial API and implementation >- ******************************************************************************/ >- >-package org.eclipse.equinox.bidi.internal.tests; >- >-import org.eclipse.equinox.bidi.complexp.*; >-import java.util.Locale; >- >-/** >- * Tests methods in ComplExpUtil >- */ >- >-public class ComplExpUtilTest extends ComplExpTestBase { >- >- private static final String HEBREW = "iw"; >- private static final String HEBREW2 = "he"; >- private static final String ARABIC = "ar"; >- private static final String FARSI = "fa"; >- private static final String URDU = "ur"; >- private Locale locale; >- >- protected void setUp() throws Exception { >- super.setUp(); >- locale = Locale.getDefault(); >- } >- >- protected void tearDown() { >- Locale.setDefault(locale); >- } >- >- private void doTest1(String data, String result) { >- Locale.setDefault(Locale.ENGLISH); >- String full = ComplExpUtil.process(toUT16(data)); >- assertEquals("Util #1 full EN - ", data, toPseudo(full)); >- Locale.setDefault(new Locale(HEBREW2)); >- full = ComplExpUtil.process(toUT16(data)); >- assertEquals("Util #1 full HE - ", result, toPseudo(full)); >- Locale.setDefault(new Locale(ARABIC)); >- full = ComplExpUtil.process(toUT16(data)); >- assertEquals("Util #1 full AR - ", result, toPseudo(full)); >- Locale.setDefault(new Locale(FARSI)); >- full = ComplExpUtil.process(toUT16(data)); >- assertEquals("Util #1 full FA - ", result, toPseudo(full)); >- Locale.setDefault(new Locale(URDU)); >- full = ComplExpUtil.process(toUT16(data)); >- assertEquals("Util #1 full UR - ", result, toPseudo(full)); >- Locale.setDefault(new Locale(HEBREW)); >- full = ComplExpUtil.process(toUT16(data)); >- String ful2 = ComplExpUtil.process(toUT16(data), null); >- assertEquals("Util #1 full - ", result, toPseudo(full)); >- assertEquals("Util #1 ful2 - ", result, toPseudo(ful2)); >- String lean = ComplExpUtil.deprocess(full); >- assertEquals("Util #1 lean - ", data, toPseudo(lean)); >- } >- >- private void doTest2(String msg, String data, String result) { >- doTest2(msg, data, result, data); >- } >- >- private void doTest2(String msg, String data, String result, String resLean) { >- String full = ComplExpUtil.process(toUT16(data), "*"); >- assertEquals(msg + "full", result, toPseudo(full)); >- String lean = ComplExpUtil.deprocess(full); >- assertEquals(msg + "lean", resLean, toPseudo(lean)); >- } >- >- private void doTest3(String msg, String data, String result) { >- doTest3(msg, data, result, data); >- } >- >- private void doTest3(String msg, String data, String result, String resLean) { >- String full = ComplExpUtil.processTyped(toUT16(data), >- IBiDiProcessor.COMMA_DELIMITED); >- assertEquals(msg + "full", result, toPseudo(full)); >- String lean = ComplExpUtil.deprocess(full, >- IBiDiProcessor.COMMA_DELIMITED); >- assertEquals(msg + "lean", resLean, toPseudo(lean)); >- } >- >- private void doTest4(String msg, String data, int[] offsets, int direction, >- boolean affix, String result) { >- String txt = msg + "text=" + data + "\n offsets=" >- + array_display(offsets) + "\n direction=" + direction >- + "\n affix=" + affix; >- String lean = toUT16(data); >- String full = ComplExpUtil.insertMarks(lean, offsets, direction, affix); >- assertEquals(txt, result, toPseudo(full)); >- } >- >- public void testComplExpUtil() { >- >- // Test process() and deprocess() with default delimiters >- doTest1("ABC/DEF/G", ">@ABC@/DEF@/G@^"); >- // Test process() and deprocess() with specified delimiters >- doTest2("Util #2.1 - ", "", ""); >- doTest2("Util #2.2 - ", ">@ABC@^", ">@ABC@^", "ABC"); >- doTest2("Util #2.3 - ", "abc", "abc"); >- doTest2("Util #2.4 - ", "!abc", ">@!abc@^"); >- doTest2("Util #2.5 - ", "abc!", ">@abc!@^"); >- doTest2("Util #2.6 - ", "ABC*DEF*G", ">@ABC@*DEF@*G@^"); >- // Test process() and deprocess() with specified expression type >- doTest3("Util #3.1 - ", "ABC,DEF,G", ">@ABC@,DEF@,G@^"); >- doTest3("Util #3.2 - ", "", ""); >- doTest3("Util #3.3 - ", ">@DEF@^", ">@DEF@^", "DEF"); >- String str = ComplExpUtil.deprocess(toUT16("ABC,DE"), "wrong_type"); >- assertEquals("deprocess(9999)", "ABC,DE", toPseudo(str)); >- str = ComplExpUtil.process("abc", "wrong_type"); >- assertEquals("invalid type", "abc", toPseudo(str)); >- // Test insertMarks() >- doTest4("Util #4.1 - ", "ABCDEFG", new int[] { 3, 6 }, 0, false, >- "ABC@DEF@G"); >- doTest4("Util #4.2 - ", "ABCDEFG", new int[] { 3, 6 }, 0, true, >- ">@ABC@DEF@G@^"); >- doTest4("Util #4.3 - ", "ABCDEFG", new int[] { 3, 6 }, 1, false, >- "ABC&DEF&G"); >- doTest4("Util #4.4 - ", "ABCDEFG", new int[] { 3, 6 }, 1, true, >- "<&ABC&DEF&G&^"); >- doTest4("Util #4.5 - ", "", new int[] { 3, 6 }, 0, false, ""); >- doTest4("Util #4.6 - ", "", new int[] { 3, 6 }, 0, true, ""); >- doTest4("Util #4.7 - ", "ABCDEFG", null, 1, false, "ABCDEFG"); >- doTest4("Util #4.8 - ", "ABCDEFG", null, 1, true, "<&ABCDEFG&^"); >- } >-} >Index: src/org/eclipse/equinox/bidi/internal/tests/CxpMathTest.java >=================================================================== >RCS file: src/org/eclipse/equinox/bidi/internal/tests/CxpMathTest.java >diff -N src/org/eclipse/equinox/bidi/internal/tests/CxpMathTest.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/equinox/bidi/internal/tests/CxpMathTest.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,55 @@ >+/******************************************************************************* >+ * Copyright (c) 2010 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ ******************************************************************************/ >+ >+package org.eclipse.equinox.bidi.internal.tests; >+ >+import org.eclipse.equinox.bidi.complexp.*; >+ >+/** >+ * Tests RTL arithmetic >+ */ >+public class CxpMathTest extends CxpTestBase { >+ >+ static final CxpEnv envLTR = new CxpEnv(null, false, CxpEnv.ORIENT_LTR); >+ static final CxpEnv envRTL = new CxpEnv(null, false, CxpEnv.ORIENT_RTL); >+ private CxpHelper helper; >+ >+ protected void setUp() throws Exception { >+ super.setUp(); >+ helper = new CxpHelper(IProcessorTypes.RTL_ARITHMETIC); >+ } >+ >+ private void verifyOneLine(String msg, String data, String resLTR, >+ String resRTL) { >+ String lean = toUT16(data); >+ helper.setEnvironment(envLTR); >+ String fullLTR = helper.leanToFullText(lean); >+ assertEquals(msg + " LTR - ", resLTR, toPseudo(fullLTR)); >+ >+ helper.setEnvironment(envRTL); >+ String fullRTL = helper.leanToFullText(lean); >+ assertEquals(msg + " RTL - ", resRTL, toPseudo(fullRTL)); >+ } >+ >+ public void testRTLarithmetic() { >+ verifyOneLine("Math #0", "", "", ""); >+ verifyOneLine("Math #1", "1+abc", "<&1+abc&^", "1+abc"); >+ verifyOneLine("Math #2", "2+abc-def", "<&2+abc&-def&^", "2+abc&-def"); >+ verifyOneLine("Math #3", "a+3*bc/def", "<&a&+3*bc&/def&^", >+ "a&+3*bc&/def"); >+ verifyOneLine("Math #4", "4+abc/def", "<&4+abc&/def&^", "4+abc&/def"); >+ verifyOneLine("Math #5", "13ABC", "<&13ABC&^", "13ABC"); >+ verifyOneLine("Math #6", "14ABC-DE", "<&14ABC-DE&^", "14ABC-DE"); >+ verifyOneLine("Math #7", "15ABC+DE", "<&15ABC+DE&^", "15ABC+DE"); >+ verifyOneLine("Math #8", "16ABC*DE", "<&16ABC*DE&^", "16ABC*DE"); >+ verifyOneLine("Math #9", "17ABC/DE", "<&17ABC/DE&^", "17ABC/DE"); >+ } >+} >Index: src/org/eclipse/equinox/bidi/internal/tests/CxpTest.java >=================================================================== >RCS file: src/org/eclipse/equinox/bidi/internal/tests/CxpTest.java >diff -N src/org/eclipse/equinox/bidi/internal/tests/CxpTest.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/equinox/bidi/internal/tests/CxpTest.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,35 @@ >+/******************************************************************************* >+ * Copyright (c) 2010 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ ******************************************************************************/ >+package org.eclipse.equinox.bidi.internal.tests; >+ >+import org.eclipse.equinox.bidi.complexp.*; >+ >+public class CxpTest implements ICxpProcessor { >+ >+ static final CxpFeatures FEATURES = new CxpFeatures("-=.:", 0, -1, -1, false, false); >+ >+ public CxpFeatures init(CxpHelper ceh, CxpEnv env) { >+ return FEATURES; >+ } >+ >+ public CxpFeatures init2(CxpHelper ceh, CxpEnv env) { >+ return FEATURES; >+ } >+ >+ public int indexOfSpecial(CxpHelper ceh, int whichSpecial, String srcText, int fromIndex) { >+ throw new IllegalStateException(); >+ } >+ >+ public int processSpecial(CxpHelper ceh, int whichSpecial, String srcText, int operLocation) { >+ throw new IllegalStateException(); >+ } >+ >+} >Index: src/org/eclipse/equinox/bidi/internal/tests/CxpTestBase.java >=================================================================== >RCS file: src/org/eclipse/equinox/bidi/internal/tests/CxpTestBase.java >diff -N src/org/eclipse/equinox/bidi/internal/tests/CxpTestBase.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/equinox/bidi/internal/tests/CxpTestBase.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,119 @@ >+/******************************************************************************* >+ * Copyright (c) 2010 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ ******************************************************************************/ >+ >+package org.eclipse.equinox.bidi.internal.tests; >+ >+import junit.framework.TestCase; >+ >+/** >+ * Base functionality for the processor tests. >+ */ >+public class CxpTestBase extends TestCase { >+ >+ static final private char LRM = 0x200E; >+ static final private char RLM = 0x200F; >+ static final private char LRE = 0x202A; >+ static final private char RLE = 0x202B; >+ static final private char PDF = 0x202C; >+ >+ protected String toPseudo(String text) { >+ char[] chars = text.toCharArray(); >+ int len = chars.length; >+ >+ for (int i = 0; i < len; i++) { >+ char c = chars[i]; >+ if (c >= 'A' && c <= 'Z') >+ chars[i] = (char) (c + 'a' - 'A'); >+ else if (c >= 0x05D0 && c < 0x05EA) >+ chars[i] = (char) (c + 'A' - 0x05D0); >+ else if (c == 0x05EA) >+ chars[i] = '~'; >+ else if (c == 0x0644) >+ chars[i] = '#'; >+ else if (c >= 0x0665 && c <= 0x0669) >+ chars[i] = (char) (c + '5' - 0x0665); >+ else if (c == LRM) >+ chars[i] = '@'; >+ else if (c == RLM) >+ chars[i] = '&'; >+ else if (c == LRE) >+ chars[i] = '>'; >+ else if (c == RLE) >+ chars[i] = '<'; >+ else if (c == PDF) >+ chars[i] = '^'; >+ else if (c == '\n') >+ chars[i] = '|'; >+ else if (c == '\r') >+ chars[i] = '`'; >+ } >+ return new String(chars); >+ } >+ >+ protected String toUT16(String text) { >+ char[] chars = text.toCharArray(); >+ int len = chars.length; >+ >+ for (int i = 0; i < len; i++) { >+ char c = chars[i]; >+ if (c >= '5' && c <= '9') >+ chars[i] = (char) (0x0665 + c - '5'); >+ else if (c >= 'A' && c <= 'Z') >+ chars[i] = (char) (0x05D0 + c - 'A'); >+ else if (c == '~') >+ chars[i] = (char) (0x05EA); >+ else if (c == '#') >+ chars[i] = (char) (0x0644); >+ else if (c == '@') >+ chars[i] = LRM; >+ else if (c == '&') >+ chars[i] = RLM; >+ else if (c == '>') >+ chars[i] = LRE; >+ else if (c == '<') >+ chars[i] = RLE; >+ else if (c == '^') >+ chars[i] = PDF; >+ else if (c == '|') >+ chars[i] = '\n'; >+ else if (c == '`') >+ chars[i] = '\r'; >+ } >+ return new String(chars); >+ } >+ >+ static String array_display(int[] array) { >+ if (array == null) { >+ return "null"; >+ } >+ StringBuffer sb = new StringBuffer(50); >+ int len = array.length; >+ for (int i = 0; i < len; i++) { >+ sb.append(array[i]); >+ sb.append(' '); >+ } >+ return sb.toString(); >+ } >+ >+ static boolean arrays_equal(int[] one, int[] two) { >+ int len = one.length; >+ if (len != two.length) { >+ return false; >+ } >+ for (int i = 0; i < len; i++) { >+ if (one[i] != two[i]) { >+ return false; >+ } >+ } >+ return true; >+ } >+ >+} >Index: src/org/eclipse/equinox/bidi/internal/tests/CxpUtilTest.java >=================================================================== >RCS file: src/org/eclipse/equinox/bidi/internal/tests/CxpUtilTest.java >diff -N src/org/eclipse/equinox/bidi/internal/tests/CxpUtilTest.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/equinox/bidi/internal/tests/CxpUtilTest.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,141 @@ >+/******************************************************************************* >+ * Copyright (c) 2010 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ ******************************************************************************/ >+ >+package org.eclipse.equinox.bidi.internal.tests; >+ >+import org.eclipse.equinox.bidi.complexp.*; >+import java.util.Locale; >+ >+/** >+ * Tests methods in CxpUtil >+ */ >+ >+public class CxpUtilTest extends CxpTestBase { >+ >+ private static final String HEBREW = "iw"; >+ private static final String HEBREW2 = "he"; >+ private static final String ARABIC = "ar"; >+ private static final String FARSI = "fa"; >+ private static final String URDU = "ur"; >+ private Locale locale; >+ >+ protected void setUp() throws Exception { >+ super.setUp(); >+ locale = Locale.getDefault(); >+ } >+ >+ protected void tearDown() { >+ Locale.setDefault(locale); >+ } >+ >+ private void doTest1(String data, String result) { >+ Locale.setDefault(Locale.ENGLISH); >+ String full = CxpUtil.process(toUT16(data)); >+ assertEquals("Util #1 full EN - ", data, toPseudo(full)); >+ Locale.setDefault(new Locale(HEBREW2)); >+ full = CxpUtil.process(toUT16(data)); >+ assertEquals("Util #1 full HE - ", result, toPseudo(full)); >+ Locale.setDefault(new Locale(ARABIC)); >+ full = CxpUtil.process(toUT16(data)); >+ assertEquals("Util #1 full AR - ", result, toPseudo(full)); >+ Locale.setDefault(new Locale(FARSI)); >+ full = CxpUtil.process(toUT16(data)); >+ assertEquals("Util #1 full FA - ", result, toPseudo(full)); >+ Locale.setDefault(new Locale(URDU)); >+ full = CxpUtil.process(toUT16(data)); >+ assertEquals("Util #1 full UR - ", result, toPseudo(full)); >+ Locale.setDefault(new Locale(HEBREW)); >+ full = CxpUtil.process(toUT16(data)); >+ String ful2 = CxpUtil.process(toUT16(data), null); >+ assertEquals("Util #1 full - ", result, toPseudo(full)); >+ assertEquals("Util #1 ful2 - ", result, toPseudo(ful2)); >+ String lean = CxpUtil.deprocess(full); >+ assertEquals("Util #1 lean - ", data, toPseudo(lean)); >+ } >+ >+ private void doTest2(String msg, String data, String result) { >+ doTest2(msg, data, result, data); >+ } >+ >+ private void doTest2(String msg, String data, String result, String resLean) { >+ String full = CxpUtil.process(toUT16(data), "*"); >+ assertEquals(msg + "full", result, toPseudo(full)); >+ String lean = CxpUtil.deprocess(full); >+ assertEquals(msg + "lean", resLean, toPseudo(lean)); >+ } >+ >+ private void doTest3(String msg, String data, String result) { >+ doTest3(msg, data, result, data); >+ } >+ >+ private void doTest3(String msg, String data, String result, String resLean) { >+ String full = CxpUtil.processTyped(toUT16(data), >+ IProcessorTypes.COMMA_DELIMITED); >+ assertEquals(msg + "full", result, toPseudo(full)); >+ String lean = CxpUtil.deprocess(full, >+ IProcessorTypes.COMMA_DELIMITED); >+ assertEquals(msg + "lean", resLean, toPseudo(lean)); >+ } >+ >+ private void doTest4(String msg, String data, int[] offsets, int direction, >+ boolean affix, String result) { >+ String txt = msg + "text=" + data + "\n offsets=" >+ + array_display(offsets) + "\n direction=" + direction >+ + "\n affix=" + affix; >+ String lean = toUT16(data); >+ String full = CxpUtil.insertMarks(lean, offsets, direction, affix); >+ assertEquals(txt, result, toPseudo(full)); >+ } >+ >+ public void testCxpUtil() { >+ >+ // Test process() and deprocess() with default delimiters >+ doTest1("ABC/DEF/G", ">@ABC@/DEF@/G@^"); >+ // Test process() and deprocess() with specified delimiters >+ doTest2("Util #2.1 - ", "", ""); >+ doTest2("Util #2.2 - ", ">@ABC@^", ">@ABC@^", "ABC"); >+ doTest2("Util #2.3 - ", "abc", "abc"); >+ doTest2("Util #2.4 - ", "!abc", ">@!abc@^"); >+ doTest2("Util #2.5 - ", "abc!", ">@abc!@^"); >+ doTest2("Util #2.6 - ", "ABC*DEF*G", ">@ABC@*DEF@*G@^"); >+ // Test process() and deprocess() with specified expression type >+ doTest3("Util #3.1 - ", "ABC,DEF,G", ">@ABC@,DEF@,G@^"); >+ doTest3("Util #3.2 - ", "", ""); >+ doTest3("Util #3.3 - ", ">@DEF@^", ">@DEF@^", "DEF"); >+ boolean catchFlag = false; >+ try { >+ CxpUtil.deprocess(toUT16("ABC,DE"), "wrong_type"); >+ } catch(IllegalArgumentException e) { >+ catchFlag = true; >+ } >+ assertTrue("Catch invalid type on deprocess", catchFlag); >+ catchFlag = false; >+ try { >+ CxpUtil.processTyped("abc", "wrong_type"); >+ } catch(IllegalArgumentException e) { >+ catchFlag = true; >+ } >+ assertTrue("Catch invalid type on process", catchFlag); >+ // Test insertMarks() >+ doTest4("Util #4.1 - ", "ABCDEFG", new int[] { 3, 6 }, 0, false, >+ "ABC@DEF@G"); >+ doTest4("Util #4.2 - ", "ABCDEFG", new int[] { 3, 6 }, 0, true, >+ ">@ABC@DEF@G@^"); >+ doTest4("Util #4.3 - ", "ABCDEFG", new int[] { 3, 6 }, 1, false, >+ "ABC&DEF&G"); >+ doTest4("Util #4.4 - ", "ABCDEFG", new int[] { 3, 6 }, 1, true, >+ "<&ABC&DEF&G&^"); >+ doTest4("Util #4.5 - ", "", new int[] { 3, 6 }, 0, false, ""); >+ doTest4("Util #4.6 - ", "", new int[] { 3, 6 }, 0, true, ""); >+ doTest4("Util #4.7 - ", "ABCDEFG", null, 1, false, "ABCDEFG"); >+ doTest4("Util #4.8 - ", "ABCDEFG", null, 1, true, "<&ABCDEFG&^"); >+ } >+} >Index: src/org/eclipse/equinox/bidi/internal/tests/ExtensibilityTest.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/components/bundles/org.eclipse.equinox.bidi.tests/src/org/eclipse/equinox/bidi/internal/tests/ExtensibilityTest.java,v >retrieving revision 1.5 >diff -u -r1.5 ExtensibilityTest.java >--- src/org/eclipse/equinox/bidi/internal/tests/ExtensibilityTest.java 17 Mar 2010 17:53:44 -0000 1.5 >+++ src/org/eclipse/equinox/bidi/internal/tests/ExtensibilityTest.java 4 Jan 2011 21:41:37 -0000 >@@ -11,45 +11,53 @@ > > package org.eclipse.equinox.bidi.internal.tests; > >-import junit.framework.TestCase; >- >-import org.eclipse.equinox.bidi.complexp.IComplExpProcessor; >-import org.eclipse.equinox.bidi.complexp.StringProcessor; >+import org.eclipse.equinox.bidi.complexp.*; > > /** > * Tests contribution of BiDi processors. > */ >-public class ExtensibilityTest extends TestCase { >+public class ExtensibilityTest extends CxpTestBase { > >- public void testBaseContributions() { >- String[] types = StringProcessor.getKnownTypes(); >- assertNotNull(types); >- assertTrue(types.length > 0); >- >- // check one of the types that we know should be there >- assertTrue(isTypePresent(types, "regex")); >- >- IComplExpProcessor processor = StringProcessor.getProcessor("regex"); >- assertNotNull(processor); >- } >- >- public void testOtherContributions() { >- String[] types = StringProcessor.getKnownTypes(); >- assertNotNull(types); >- assertTrue(types.length > 0); >- >- // check the type added by the test bundle >- assertTrue(isTypePresent(types, "test")); >- >- IComplExpProcessor processor = StringProcessor.getProcessor("test"); >- assertNotNull(processor); >- } >- >- private boolean isTypePresent(String[] types, String type) { >- for (int i = 0; i < types.length; i++) { >- if (type.equalsIgnoreCase(types[i])) >- return true; >- } >- return false; >- } >+ public void testBaseContributions() { >+ String[] types = StringProcessor.getKnownTypes(); >+ assertNotNull(types); >+ assertTrue(types.length > 0); >+ >+ // check one of the types that we know should be there >+ assertTrue(isTypePresent(types, "regex")); >+ >+ ICxpProcessor processor = StringProcessor.getProcessor("regex"); >+ assertNotNull(processor); >+ } >+ >+ public void testOtherContributions() { >+ String[] types = StringProcessor.getKnownTypes(); >+ assertNotNull(types); >+ assertTrue(types.length > 0); >+ >+ // check the type added by the test bundle >+ assertTrue(isTypePresent(types, "test")); >+ >+ ICxpProcessor processor = StringProcessor.getProcessor("test"); >+ assertNotNull(processor); >+ >+ processor = StringProcessor.getProcessor("badtest"); >+ assertNull(processor); >+ >+ CxpHelper helper = new CxpHelper("test"); >+ String data, lean, full, model; >+ data = "ABC.DEF:HOST-COM=HELLO"; >+ lean = toUT16(data); >+ full = helper.leanToFullText(lean); >+ model = "ABC@.DEF@:HOST@-COM@=HELLO"; >+ assertEquals("Test 'test' plugin", model, toPseudo(full)); >+ } >+ >+ private boolean isTypePresent(String[] types, String type) { >+ for (int i = 0; i < types.length; i++) { >+ if (type.equalsIgnoreCase(types[i])) >+ return true; >+ } >+ return false; >+ } > } >Index: src/org/eclipse/equinox/bidi/internal/tests/ExtensionsTest.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/components/bundles/org.eclipse.equinox.bidi.tests/src/org/eclipse/equinox/bidi/internal/tests/ExtensionsTest.java,v >retrieving revision 1.2 >diff -u -r1.2 ExtensionsTest.java >--- src/org/eclipse/equinox/bidi/internal/tests/ExtensionsTest.java 17 Mar 2010 17:53:44 -0000 1.2 >+++ src/org/eclipse/equinox/bidi/internal/tests/ExtensionsTest.java 4 Jan 2011 21:41:38 -0000 >@@ -11,19 +11,17 @@ > > package org.eclipse.equinox.bidi.internal.tests; > >-import org.eclipse.equinox.bidi.complexp.IComplExpProcessor; >-import org.eclipse.equinox.bidi.complexp.StringProcessor; >-import org.eclipse.equinox.bidi.complexp.IBiDiProcessor; >+import org.eclipse.equinox.bidi.complexp.*; > > /** > * Tests all plug-in extensions > */ > >-public class ExtensionsTest extends ComplExpTestBase { >+public class ExtensionsTest extends CxpTestBase { > >- static int state = IComplExpProcessor.STATE_NOTHING_GOING; >+ static int state = CxpHelper.STATE_NOTHING_GOING; > >- private void doTest1(IComplExpProcessor complexp, String label, >+ private void doTest1(CxpHelper complexp, String label, > String data, String result) { > String full; > full = complexp.leanToFullText(toUT16(data), state); >@@ -31,7 +29,7 @@ > assertEquals(label + " data = " + data, result, toPseudo(full)); > } > >- private void doTest2(IComplExpProcessor complexp, String label, >+ private void doTest2(CxpHelper complexp, String label, > String data, String result) { > String full; > full = complexp.leanToFullText(data, state); >@@ -41,170 +39,160 @@ > > public void testExtensions() { > >- IComplExpProcessor ce; >+ CxpHelper ceh; > >- ce = StringProcessor.getProcessor(IBiDiProcessor.COMMA_DELIMITED); >- assertNotNull(ce); >- ce.assumeOrientation(IComplExpProcessor.ORIENT_LTR); >- state = IComplExpProcessor.STATE_NOTHING_GOING; >- doTest1(ce, "Comma #1", "ab,cd, AB, CD, EFG", "ab,cd, AB@, CD@, EFG"); >- >- ce = StringProcessor.getProcessor(IBiDiProcessor.EMAIL); >- assertNotNull(ce); >- ce.assumeOrientation(IComplExpProcessor.ORIENT_LTR); >- state = IComplExpProcessor.STATE_NOTHING_GOING; >- doTest1(ce, "Email #1", "abc.DEF:GHI", "abc.DEF@:GHI"); >- doTest1(ce, "Email #2", "DEF.GHI \"A.B\":JK ", "DEF@.GHI @\"A.B\"@:JK "); >- doTest1(ce, "Email #3", "DEF,GHI (A,B);JK ", "DEF@,GHI @(A,B)@;JK "); >- doTest1(ce, "Email #4", "DEF.GHI (A.B :JK ", "DEF@.GHI @(A.B :JK "); >- >- ce = StringProcessor.getProcessor(IBiDiProcessor.FILE); >- assertNotNull(ce); >- ce.assumeOrientation(IComplExpProcessor.ORIENT_LTR); >- state = IComplExpProcessor.STATE_NOTHING_GOING; >- doTest1(ce, "File #1", "c:\\A\\B\\FILE.EXT", "c:\\A@\\B@\\FILE@.EXT"); >- >- ce = StringProcessor.getProcessor(IBiDiProcessor.JAVA); >- assertNotNull(ce); >- ce.assumeOrientation(IComplExpProcessor.ORIENT_LTR); >- state = IComplExpProcessor.STATE_NOTHING_GOING; >- doTest1(ce, "Java #1", "A = B + C;", "A@ = B@ + C;"); >- doTest1(ce, "Java #2", "A = B + C;", "A@ = B@ + C;"); >- doTest1(ce, "Java #3", "A = \"B+C\"+D;", "A@ = \"B+C\"@+D;"); >- doTest1(ce, "Java #4", "A = \"B+C+D;", "A@ = \"B+C+D;"); >- doTest1(ce, "Java #5", "A = \"B\\\"C\"+D;", "A@ = \"B\\\"C\"@+D;"); >- doTest1(ce, "Java #6", "A = /*B+C*/ D;", "A@ = /*B+C*/@ D;"); >- doTest1(ce, "Java #7", "A = /*B+C* D;", "A@ = /*B+C* D;"); >- doTest1(ce, "Java #8", "X+Y+Z */ B; ", "X+Y+Z */@ B; "); >- doTest1(ce, "Java #9", "A = //B+C* D;", "A@ = //B+C* D;"); >- doTest1(ce, "Java #10", "A = //B+C`|D+E;", "A@ = //B+C`|D@+E;"); >- >- ce = StringProcessor.getProcessor(IBiDiProcessor.PROPERTY); >- assertNotNull(ce); >- ce.assumeOrientation(IComplExpProcessor.ORIENT_LTR); >- state = IComplExpProcessor.STATE_NOTHING_GOING; >- doTest1(ce, "Property #0", "NAME,VAL1,VAL2", "NAME,VAL1,VAL2"); >- doTest1(ce, "Property #1", "NAME=VAL1,VAL2", "NAME@=VAL1,VAL2"); >- doTest1(ce, "Property #2", "NAME=VAL1,VAL2=VAL3", >+ ceh = new CxpHelper(IProcessorTypes.COMMA_DELIMITED); >+ assertNotNull(ceh); >+ state = CxpHelper.STATE_NOTHING_GOING; >+ doTest1(ceh, "Comma #1", "ab,cd, AB, CD, EFG", "ab,cd, AB@, CD@, EFG"); >+ >+ ceh = new CxpHelper(IProcessorTypes.EMAIL); >+ assertNotNull(ceh); >+ state = CxpHelper.STATE_NOTHING_GOING; >+ doTest1(ceh, "Email #1", "abc.DEF:GHI", "abc.DEF@:GHI"); >+ doTest1(ceh, "Email #2", "DEF.GHI \"A.B\":JK ", "DEF@.GHI @\"A.B\"@:JK "); >+ doTest1(ceh, "Email #3", "DEF,GHI (A,B);JK ", "DEF@,GHI @(A,B)@;JK "); >+ doTest1(ceh, "Email #4", "DEF.GHI (A.B :JK ", "DEF@.GHI @(A.B :JK "); >+ >+ ceh = new CxpHelper(IProcessorTypes.FILE); >+ assertNotNull(ceh); >+ state = CxpHelper.STATE_NOTHING_GOING; >+ doTest1(ceh, "File #1", "c:\\A\\B\\FILE.EXT", "c:\\A@\\B@\\FILE@.EXT"); >+ >+ ceh = new CxpHelper(IProcessorTypes.JAVA); >+ assertNotNull(ceh); >+ state = CxpHelper.STATE_NOTHING_GOING; >+ doTest1(ceh, "Java #1", "A = B + C;", "A@ = B@ + C;"); >+ doTest1(ceh, "Java #2", "A = B + C;", "A@ = B@ + C;"); >+ doTest1(ceh, "Java #3", "A = \"B+C\"+D;", "A@ = \"B+C\"@+D;"); >+ doTest1(ceh, "Java #4", "A = \"B+C+D;", "A@ = \"B+C+D;"); >+ doTest1(ceh, "Java #5", "A = \"B\\\"C\"+D;", "A@ = \"B\\\"C\"@+D;"); >+ doTest1(ceh, "Java #6", "A = /*B+C*/ D;", "A@ = /*B+C*/@ D;"); >+ doTest1(ceh, "Java #7", "A = /*B+C* D;", "A@ = /*B+C* D;"); >+ doTest1(ceh, "Java #8", "X+Y+Z */ B; ", "X+Y+Z */@ B; "); >+ doTest1(ceh, "Java #9", "A = //B+C* D;", "A@ = //B+C* D;"); >+ doTest1(ceh, "Java #10", "A = //B+C`|D+E;", "A@ = //B+C`|D@+E;"); >+ >+ ceh = new CxpHelper(IProcessorTypes.PROPERTY); >+ assertNotNull(ceh); >+ state = CxpHelper.STATE_NOTHING_GOING; >+ doTest1(ceh, "Property #0", "NAME,VAL1,VAL2", "NAME,VAL1,VAL2"); >+ doTest1(ceh, "Property #1", "NAME=VAL1,VAL2", "NAME@=VAL1,VAL2"); >+ doTest1(ceh, "Property #2", "NAME=VAL1,VAL2=VAL3", > "NAME@=VAL1,VAL2=VAL3"); > > String data; >- ce = StringProcessor.getProcessor(IBiDiProcessor.REGEXP); >- assertNotNull(ce); >- ce.assumeOrientation(IComplExpProcessor.ORIENT_LTR); >- state = IComplExpProcessor.STATE_NOTHING_GOING; >+ ceh = new CxpHelper(IProcessorTypes.REGEXP); >+ assertNotNull(ceh); >+ state = CxpHelper.STATE_NOTHING_GOING; > data = toUT16("ABC(?") + "#" + toUT16("DEF)GHI"); >- doTest2(ce, "Regex #0.0", data, "A@B@C@(?#DEF)@G@H@I"); >+ doTest2(ceh, "Regex #0.0", data, "A@B@C@(?#DEF)@G@H@I"); > data = toUT16("ABC(?") + "#" + toUT16("DEF"); >- doTest2(ce, "Regex #0.1", data, "A@B@C@(?#DEF"); >- doTest1(ce, "Regex #0.2", "GHI)JKL", "GHI)@J@K@L"); >+ doTest2(ceh, "Regex #0.1", data, "A@B@C@(?#DEF"); >+ doTest1(ceh, "Regex #0.2", "GHI)JKL", "GHI)@J@K@L"); > data = toUT16("ABC(?") + "<" + toUT16("DEF") + ">" + toUT16("GHI"); >- doTest2(ce, "Regex #1", data, "A@B@C@(?<DEF>@G@H@I"); >- doTest1(ce, "Regex #2.0", "ABC(?'DEF'GHI", "A@B@C@(?'DEF'@G@H@I"); >- doTest1(ce, "Regex #2.1", "ABC(?'DEFGHI", "A@B@C@(?'DEFGHI"); >+ doTest2(ceh, "Regex #1", data, "A@B@C@(?<DEF>@G@H@I"); >+ doTest1(ceh, "Regex #2.0", "ABC(?'DEF'GHI", "A@B@C@(?'DEF'@G@H@I"); >+ doTest1(ceh, "Regex #2.1", "ABC(?'DEFGHI", "A@B@C@(?'DEFGHI"); > data = toUT16("ABC(?(") + "<" + toUT16("DEF") + ">" + toUT16(")GHI"); >- doTest2(ce, "Regex #3", data, "A@B@C@(?(<DEF>)@G@H@I"); >- doTest1(ce, "Regex #4", "ABC(?('DEF')GHI", "A@B@C@(?('DEF')@G@H@I"); >- doTest1(ce, "Regex #5", "ABC(?(DEF)GHI", "A@B@C@(?(DEF)@G@H@I"); >+ doTest2(ceh, "Regex #3", data, "A@B@C@(?(<DEF>)@G@H@I"); >+ doTest1(ceh, "Regex #4", "ABC(?('DEF')GHI", "A@B@C@(?('DEF')@G@H@I"); >+ doTest1(ceh, "Regex #5", "ABC(?(DEF)GHI", "A@B@C@(?(DEF)@G@H@I"); > data = toUT16("ABC(?") + "&" + toUT16("DEF)GHI"); >- doTest2(ce, "Regex #6", data, "A@B@C@(?&DEF)@G@H@I"); >+ doTest2(ceh, "Regex #6", data, "A@B@C@(?&DEF)@G@H@I"); > data = toUT16("ABC(?") + "P<" + toUT16("DEF") + ">" + toUT16("GHI"); >- doTest2(ce, "Regex #7", data, "A@B@C(?p<DEF>@G@H@I"); >+ doTest2(ceh, "Regex #7", data, "A@B@C(?p<DEF>@G@H@I"); > data = toUT16("ABC\\k") + "<" + toUT16("DEF") + ">" + toUT16("GHI"); >- doTest2(ce, "Regex #8", data, "A@B@C\\k<DEF>@G@H@I"); >- doTest1(ce, "Regex #9", "ABC\\k'DEF'GHI", "A@B@C\\k'DEF'@G@H@I"); >- doTest1(ce, "Regex #10", "ABC\\k{DEF}GHI", "A@B@C\\k{DEF}@G@H@I"); >+ doTest2(ceh, "Regex #8", data, "A@B@C\\k<DEF>@G@H@I"); >+ doTest1(ceh, "Regex #9", "ABC\\k'DEF'GHI", "A@B@C\\k'DEF'@G@H@I"); >+ doTest1(ceh, "Regex #10", "ABC\\k{DEF}GHI", "A@B@C\\k{DEF}@G@H@I"); > data = toUT16("ABC(?") + "P=" + toUT16("DEF)GHI"); >- doTest2(ce, "Regex #11", data, "A@B@C(?p=DEF)@G@H@I"); >- doTest1(ce, "Regex #12", "ABC\\g{DEF}GHI", "A@B@C\\g{DEF}@G@H@I"); >+ doTest2(ceh, "Regex #11", data, "A@B@C(?p=DEF)@G@H@I"); >+ doTest1(ceh, "Regex #12", "ABC\\g{DEF}GHI", "A@B@C\\g{DEF}@G@H@I"); > data = toUT16("ABC\\g") + "<" + toUT16("DEF") + ">" + toUT16("GHI"); >- doTest2(ce, "Regex #13", data, "A@B@C\\g<DEF>@G@H@I"); >- doTest1(ce, "Regex #14", "ABC\\g'DEF'GHI", "A@B@C\\g'DEF'@G@H@I"); >+ doTest2(ceh, "Regex #13", data, "A@B@C\\g<DEF>@G@H@I"); >+ doTest1(ceh, "Regex #14", "ABC\\g'DEF'GHI", "A@B@C\\g'DEF'@G@H@I"); > data = toUT16("ABC(?(") + "R&" + toUT16("DEF)GHI"); >- doTest2(ce, "Regex #15", data, "A@B@C(?(r&DEF)@G@H@I"); >+ doTest2(ceh, "Regex #15", data, "A@B@C(?(r&DEF)@G@H@I"); > data = toUT16("ABC") + "\\Q" + toUT16("DEF") + "\\E" + toUT16("GHI"); >- doTest2(ce, "Regex #16.0", data, "A@B@C\\qDEF\\eG@H@I"); >+ doTest2(ceh, "Regex #16.0", data, "A@B@C\\qDEF\\eG@H@I"); > data = toUT16("ABC") + "\\Q" + toUT16("DEF"); >- doTest2(ce, "Regex #16.1", data, "A@B@C\\qDEF"); >+ doTest2(ceh, "Regex #16.1", data, "A@B@C\\qDEF"); > data = toUT16("GHI") + "\\E" + toUT16("JKL"); >- doTest2(ce, "Regex #16.2", data, "GHI\\eJ@K@L"); >- doTest1(ce, "Regex #17.0", "abc[d-h]ijk", "abc[d-h]ijk"); >- doTest1(ce, "Regex #17.1", "aBc[d-H]iJk", "aBc[d-H]iJk"); >- doTest1(ce, "Regex #17.2", "aB*[!-H]iJ2", "aB*[!-@H]iJ@2"); >- doTest1(ce, "Regex #17.3", "aB*[1-2]J3", "aB*[@1-2]J@3"); >- doTest1(ce, "Regex #17.4", "aB*[5-6]J3", "aB*[@5-@6]@J@3"); >- doTest1(ce, "Regex #17.5", "a*[5-6]J3", "a*[5-@6]@J@3"); >- doTest1(ce, "Regex #17.6", "aB*123", "aB*@123"); >- doTest1(ce, "Regex #17.7", "aB*567", "aB*@567"); >- >- ce = StringProcessor.getProcessor(IBiDiProcessor.SQL); >- assertNotNull(ce); >- ce.assumeOrientation(IComplExpProcessor.ORIENT_LTR); >- state = IComplExpProcessor.STATE_NOTHING_GOING; >- doTest1(ce, "SQL #0", "abc GHI", "abc GHI"); >- doTest1(ce, "SQL #1", "abc DEF GHI", "abc DEF@ GHI"); >- doTest1(ce, "SQL #2", "ABC, DEF, GHI", "ABC@, DEF@, GHI"); >- doTest1(ce, "SQL #3", "ABC'DEF GHI' JKL,MN", "ABC@'DEF GHI'@ JKL@,MN"); >- doTest1(ce, "SQL #4.0", "ABC'DEF GHI JKL", "ABC@'DEF GHI JKL"); >- doTest1(ce, "SQL #4.1", "MNO PQ' RS,TUV", "MNO PQ'@ RS@,TUV"); >- doTest1(ce, "SQL #5", "ABC\"DEF GHI\" JKL,MN", >+ doTest2(ceh, "Regex #16.2", data, "GHI\\eJ@K@L"); >+ doTest1(ceh, "Regex #17.0", "abc[d-h]ijk", "abc[d-h]ijk"); >+ doTest1(ceh, "Regex #17.1", "aBc[d-H]iJk", "aBc[d-H]iJk"); >+ doTest1(ceh, "Regex #17.2", "aB*[!-H]iJ2", "aB*[!-@H]iJ@2"); >+ doTest1(ceh, "Regex #17.3", "aB*[1-2]J3", "aB*[@1-2]J@3"); >+ doTest1(ceh, "Regex #17.4", "aB*[5-6]J3", "aB*[@5-@6]@J@3"); >+ doTest1(ceh, "Regex #17.5", "a*[5-6]J3", "a*[5-@6]@J@3"); >+ doTest1(ceh, "Regex #17.6", "aB*123", "aB*@123"); >+ doTest1(ceh, "Regex #17.7", "aB*567", "aB*@567"); >+ >+ ceh = new CxpHelper(IProcessorTypes.SQL); >+ assertNotNull(ceh); >+ state = CxpHelper.STATE_NOTHING_GOING; >+ doTest1(ceh, "SQL #0", "abc GHI", "abc GHI"); >+ doTest1(ceh, "SQL #1", "abc DEF GHI", "abc DEF@ GHI"); >+ doTest1(ceh, "SQL #2", "ABC, DEF, GHI", "ABC@, DEF@, GHI"); >+ doTest1(ceh, "SQL #3", "ABC'DEF GHI' JKL,MN", "ABC@'DEF GHI'@ JKL@,MN"); >+ doTest1(ceh, "SQL #4.0", "ABC'DEF GHI JKL", "ABC@'DEF GHI JKL"); >+ doTest1(ceh, "SQL #4.1", "MNO PQ' RS,TUV", "MNO PQ'@ RS@,TUV"); >+ doTest1(ceh, "SQL #5", "ABC\"DEF GHI\" JKL,MN", > "ABC@\"DEF GHI\"@ JKL@,MN"); >- doTest1(ce, "SQL #6", "ABC\"DEF GHI JKL", "ABC@\"DEF GHI JKL"); >- doTest1(ce, "SQL #7", "ABC/*DEF GHI*/ JKL,MN", >+ doTest1(ceh, "SQL #6", "ABC\"DEF GHI JKL", "ABC@\"DEF GHI JKL"); >+ doTest1(ceh, "SQL #7", "ABC/*DEF GHI*/ JKL,MN", > "ABC@/*DEF GHI@*/ JKL@,MN"); >- doTest1(ce, "SQL #8.0", "ABC/*DEF GHI JKL", "ABC@/*DEF GHI JKL"); >- doTest1(ce, "SQL #8.1", "MNO PQ*/RS,TUV", "MNO PQ@*/RS@,TUV"); >- doTest1(ce, "SQL #9", "ABC--DEF GHI JKL", "ABC@--DEF GHI JKL"); >- doTest1(ce, "SQL #10", "ABC--DEF--GHI,JKL", "ABC@--DEF--GHI,JKL"); >- doTest1(ce, "SQL #11", "ABC'DEF '' G I' JKL,MN", >+ doTest1(ceh, "SQL #8.0", "ABC/*DEF GHI JKL", "ABC@/*DEF GHI JKL"); >+ doTest1(ceh, "SQL #8.1", "MNO PQ*/RS,TUV", "MNO PQ@*/RS@,TUV"); >+ doTest1(ceh, "SQL #9", "ABC--DEF GHI JKL", "ABC@--DEF GHI JKL"); >+ doTest1(ceh, "SQL #10", "ABC--DEF--GHI,JKL", "ABC@--DEF--GHI,JKL"); >+ doTest1(ceh, "SQL #11", "ABC'DEF '' G I' JKL,MN", > "ABC@'DEF '' G I'@ JKL@,MN"); >- doTest1(ce, "SQL #12", "ABC\"DEF \"\" G I\" JKL,MN", >+ doTest1(ceh, "SQL #12", "ABC\"DEF \"\" G I\" JKL,MN", > "ABC@\"DEF \"\" G I\"@ JKL@,MN"); >- doTest1(ce, "SQL #13", "ABC--DEF GHI`|JKL MN", "ABC@--DEF GHI`|JKL@ MN"); >+ doTest1(ceh, "SQL #13", "ABC--DEF GHI`|JKL MN", "ABC@--DEF GHI`|JKL@ MN"); > >- ce = StringProcessor.getProcessor(IBiDiProcessor.SYSTEM_USER); >- assertNotNull(ce); >- ce.assumeOrientation(IComplExpProcessor.ORIENT_LTR); >- state = IComplExpProcessor.STATE_NOTHING_GOING; >- doTest1(ce, "System #1", "HOST(JACK)", "HOST@(JACK)"); >- >- ce = StringProcessor.getProcessor(IBiDiProcessor.UNDERSCORE); >- assertNotNull(ce); >- ce.assumeOrientation(IComplExpProcessor.ORIENT_LTR); >- state = IComplExpProcessor.STATE_NOTHING_GOING; >- doTest1(ce, "Underscore #1", "A_B_C_d_e_F_G", "A@_B@_C_d_e_F@_G"); >- >- ce = StringProcessor.getProcessor(IBiDiProcessor.URL); >- assertNotNull(ce); >- state = IComplExpProcessor.STATE_NOTHING_GOING; >- ce.assumeOrientation(IComplExpProcessor.ORIENT_LTR); >- doTest1(ce, "URL #1", "WWW.DOMAIN.COM/DIR1/DIR2/dir3/DIR4", >+ ceh = new CxpHelper(IProcessorTypes.SYSTEM_USER); >+ assertNotNull(ceh); >+ state = CxpHelper.STATE_NOTHING_GOING; >+ doTest1(ceh, "System #1", "HOST(JACK)", "HOST@(JACK)"); >+ >+ ceh = new CxpHelper(IProcessorTypes.UNDERSCORE); >+ assertNotNull(ceh); >+ state = CxpHelper.STATE_NOTHING_GOING; >+ doTest1(ceh, "Underscore #1", "A_B_C_d_e_F_G", "A@_B@_C_d_e_F@_G"); >+ >+ ceh = new CxpHelper(IProcessorTypes.URL); >+ assertNotNull(ceh); >+ state = CxpHelper.STATE_NOTHING_GOING; >+ doTest1(ceh, "URL #1", "WWW.DOMAIN.COM/DIR1/DIR2/dir3/DIR4", > "WWW@.DOMAIN@.COM@/DIR1@/DIR2/dir3/DIR4"); > >- ce = StringProcessor.getProcessor(IBiDiProcessor.XPATH); >- assertNotNull(ce); >- ce.assumeOrientation(IComplExpProcessor.ORIENT_LTR); >- state = IComplExpProcessor.STATE_NOTHING_GOING; >- doTest1(ce, "Xpath #1", "abc(DEF)GHI", "abc(DEF@)GHI"); >- doTest1(ce, "Xpath #2", "DEF.GHI \"A.B\":JK ", "DEF@.GHI@ \"A.B\"@:JK "); >- doTest1(ce, "Xpath #3", "DEF!GHI 'A!B'=JK ", "DEF@!GHI@ 'A!B'@=JK "); >- doTest1(ce, "Xpath #4", "DEF.GHI 'A.B :JK ", "DEF@.GHI@ 'A.B :JK "); >- >- ce = StringProcessor.getProcessor(IBiDiProcessor.EMAIL); >- state = IComplExpProcessor.STATE_NOTHING_GOING; >- String operators = ce.getOperators(); >- assertEquals("<>.:,;@", operators); >- ce.setOperators("+-*/"); >- doTest1(ce, "DelimsEsc #1", "abc+DEF-GHI", "abc+DEF@-GHI"); >- doTest1(ce, "DelimsEsc #2", "DEF-GHI (A*B)/JK ", "DEF@-GHI @(A*B)@/JK "); >- doTest1(ce, "DelimsEsc #3", "DEF-GHI (A*B)/JK ", "DEF@-GHI @(A*B)@/JK "); >- doTest1(ce, "DelimsEsc #4", "DEF-GHI (A*B\\)*C) /JK ", >+ ceh = new CxpHelper(IProcessorTypes.XPATH); >+ assertNotNull(ceh); >+ state = CxpHelper.STATE_NOTHING_GOING; >+ doTest1(ceh, "Xpath #1", "abc(DEF)GHI", "abc(DEF@)GHI"); >+ doTest1(ceh, "Xpath #2", "DEF.GHI \"A.B\":JK ", "DEF@.GHI@ \"A.B\"@:JK "); >+ doTest1(ceh, "Xpath #3", "DEF!GHI 'A!B'=JK ", "DEF@!GHI@ 'A!B'@=JK "); >+ doTest1(ceh, "Xpath #4", "DEF.GHI 'A.B :JK ", "DEF@.GHI@ 'A.B :JK "); >+ >+ ceh = new CxpHelper(IProcessorTypes.EMAIL); >+ state = CxpHelper.STATE_NOTHING_GOING; >+ CxpFeatures f1 = ceh.getFeatures(); >+ assertEquals("<>.:,;@", f1.operators); >+ CxpFeatures f2 = new CxpFeatures("+-*/", f1.specialsCount, f1.dirArabic, f1.dirHebrew, f1.ignoreArabic, f1.ignoreHebrew); >+ ceh.setFeatures(f2); >+ doTest1(ceh, "DelimsEsc #1", "abc+DEF-GHI", "abc+DEF@-GHI"); >+ doTest1(ceh, "DelimsEsc #2", "DEF-GHI (A*B)/JK ", "DEF@-GHI @(A*B)@/JK "); >+ doTest1(ceh, "DelimsEsc #3", "DEF-GHI (A*B)/JK ", "DEF@-GHI @(A*B)@/JK "); >+ doTest1(ceh, "DelimsEsc #4", "DEF-GHI (A*B\\)*C) /JK ", > "DEF@-GHI @(A*B\\)*C) @/JK "); >- doTest1(ce, "DelimsEsc #5", "DEF-GHI (A\\\\\\)*C) /JK ", >+ doTest1(ceh, "DelimsEsc #5", "DEF-GHI (A\\\\\\)*C) /JK ", > "DEF@-GHI @(A\\\\\\)*C) @/JK "); >- doTest1(ce, "DelimsEsc #6", "DEF-GHI (A\\\\)*C /JK ", >+ doTest1(ceh, "DelimsEsc #6", "DEF-GHI (A\\\\)*C /JK ", > "DEF@-GHI @(A\\\\)@*C @/JK "); >- doTest1(ce, "DelimsEsc #7", "DEF-GHI (A\\)*C /JK ", >+ doTest1(ceh, "DelimsEsc #7", "DEF-GHI (A\\)*C /JK ", > "DEF@-GHI @(A\\)*C /JK "); > } > } >Index: src/org/eclipse/equinox/bidi/internal/tests/FullToLeanTest.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/components/bundles/org.eclipse.equinox.bidi.tests/src/org/eclipse/equinox/bidi/internal/tests/FullToLeanTest.java,v >retrieving revision 1.2 >diff -u -r1.2 FullToLeanTest.java >--- src/org/eclipse/equinox/bidi/internal/tests/FullToLeanTest.java 17 Mar 2010 17:53:44 -0000 1.2 >+++ src/org/eclipse/equinox/bidi/internal/tests/FullToLeanTest.java 4 Jan 2011 21:41:38 -0000 >@@ -11,25 +11,24 @@ > > package org.eclipse.equinox.bidi.internal.tests; > >-import org.eclipse.equinox.bidi.complexp.IComplExpProcessor; >-import org.eclipse.equinox.bidi.complexp.StringProcessor; >-import org.eclipse.equinox.bidi.complexp.IBiDiProcessor; >+import org.eclipse.equinox.bidi.complexp.*; > > /** > * Tests fullToLean method > */ > >-public class FullToLeanTest extends ComplExpTestBase { >+public class FullToLeanTest extends CxpTestBase { > >- private IComplExpProcessor processor; >+ static final CxpEnv envLTR = new CxpEnv(null, false, CxpEnv.ORIENT_LTR); >+ static final CxpEnv envRTL = new CxpEnv(null, false, CxpEnv.ORIENT_RTL); >+ private CxpHelper helper; > > protected void setUp() throws Exception { > super.setUp(); >- processor = StringProcessor >- .getProcessor(IBiDiProcessor.COMMA_DELIMITED); >+ helper = new CxpHelper(IProcessorTypes.COMMA_DELIMITED); > } > >- static int[] getpos(IComplExpProcessor complexp, boolean leanToFull) { >+ static int[] getpos(CxpHelper complexp, boolean leanToFull) { > int[] pos = new int[5]; > > if (leanToFull) { >@@ -55,29 +54,29 @@ > int[] pos; > > text = toUT16(data); >- processor.assumeOrientation(IComplExpProcessor.ORIENT_LTR); >- lean = processor.fullToLeanText(text); >+ helper.setEnvironment(envLTR); >+ lean = helper.fullToLeanText(text); > assertEquals(msg + "LTR lean", leanLTR, toPseudo(lean)); >- full = processor.leanToFullText(lean); >+ full = helper.leanToFullText(lean); > assertEquals(msg + "LTR full", fullLTR, toPseudo(full)); >- pos = getpos(processor, true); >+ pos = getpos(helper, true); > label = msg + "leanToFullPos() LTR, expected=" > + array_display(l2fPosLTR) + " result=" + array_display(pos); > assertTrue(label, arrays_equal(l2fPosLTR, pos)); >- pos = getpos(processor, false); >+ pos = getpos(helper, false); > label = msg + "fullToLeanPos() LTR, expected=" > + array_display(f2lPosLTR) + " result=" + array_display(pos); > assertTrue(label, arrays_equal(f2lPosLTR, pos)); >- processor.assumeOrientation(IComplExpProcessor.ORIENT_RTL); >- lean = processor.fullToLeanText(text); >+ helper.setEnvironment(envRTL); >+ lean = helper.fullToLeanText(text); > assertEquals(msg + "RTL lean", leanRTL, toPseudo(lean)); >- full = processor.leanToFullText(lean); >+ full = helper.leanToFullText(lean); > assertEquals(msg + "RTL full", fullRTL, toPseudo(full)); >- pos = getpos(processor, true); >+ pos = getpos(helper, true); > label = msg + "leanToFullPos() RTL, expected=" > + array_display(l2fPosRTL) + " result=" + array_display(pos); > assertTrue(label, arrays_equal(l2fPosRTL, pos)); >- pos = getpos(processor, false); >+ pos = getpos(helper, false); > label = msg + "fullToLeanPos() RTL, expected=" > + array_display(f2lPosRTL) + " result=" + array_display(pos); > assertTrue(label, arrays_equal(f2lPosRTL, pos)); >@@ -87,37 +86,37 @@ > String text, data, full, lean, model; > int state, state2, state3; > >- processor = StringProcessor.getProcessor(IBiDiProcessor.SQL); >- processor.assumeOrientation(IComplExpProcessor.ORIENT_LTR); >+ helper = new CxpHelper(IProcessorTypes.SQL); >+ helper.setEnvironment(envLTR); > data = "update \"AB_CDE\" set \"COL1\"@='01', \"COL2\"@='02' /* GH IJK"; > text = toUT16(data); >- lean = processor.fullToLeanText(text); >- state = processor.getFinalState(); >+ lean = helper.fullToLeanText(text); >+ state = helper.getFinalState(); > model = "update \"AB_CDE\" set \"COL1\"='01', \"COL2\"='02' /* GH IJK"; > assertEquals(msg + "LTR lean", model, toPseudo(lean)); >- full = processor.leanToFullText(lean); >+ full = helper.leanToFullText(lean); > assertEquals(msg + "LTR full", data, toPseudo(full)); >- assertEquals(msg + "state from leanToFullText", processor >+ assertEquals(msg + "state from leanToFullText", helper > .getFinalState(), state); > data = "THIS IS A COMMENT LINE"; > text = toUT16(data); >- lean = processor.fullToLeanText(text, state); >- state2 = processor.getFinalState(); >+ lean = helper.fullToLeanText(text, state); >+ state2 = helper.getFinalState(); > model = "THIS IS A COMMENT LINE"; > assertEquals(msg + "LTR lean2", model, toPseudo(lean)); >- full = processor.leanToFullText(lean, state); >+ full = helper.leanToFullText(lean, state); > assertEquals(msg + "LTR full2", data, toPseudo(full)); >- assertEquals(msg + "state from leanToFullText2", processor >+ assertEquals(msg + "state from leanToFullText2", helper > .getFinalState(), state2); > data = "SOME MORE */ where \"COL3\"@=123"; > text = toUT16(data); >- lean = processor.fullToLeanText(text, state2); >- state3 = processor.getFinalState(); >+ lean = helper.fullToLeanText(text, state2); >+ state3 = helper.getFinalState(); > model = "SOME MORE */ where \"COL3\"=123"; > assertEquals(msg + "LTR lean3", model, toPseudo(lean)); >- full = processor.leanToFullText(lean, state2); >+ full = helper.leanToFullText(lean, state2); > assertEquals(msg + "LTR full3", data, toPseudo(full)); >- assertEquals(msg + "state from leanToFullText3", processor >+ assertEquals(msg + "state from leanToFullText3", helper > .getFinalState(), state3); > } > >Index: src/org/eclipse/equinox/bidi/internal/tests/MethodsTest.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/components/bundles/org.eclipse.equinox.bidi.tests/src/org/eclipse/equinox/bidi/internal/tests/MethodsTest.java,v >retrieving revision 1.2 >diff -u -r1.2 MethodsTest.java >--- src/org/eclipse/equinox/bidi/internal/tests/MethodsTest.java 17 Mar 2010 17:53:44 -0000 1.2 >+++ src/org/eclipse/equinox/bidi/internal/tests/MethodsTest.java 4 Jan 2011 21:41:38 -0000 >@@ -11,428 +11,366 @@ > > package org.eclipse.equinox.bidi.internal.tests; > >-import org.eclipse.equinox.bidi.complexp.IComplExpProcessor; >-import org.eclipse.equinox.bidi.complexp.IBiDiProcessor; >-import org.eclipse.equinox.bidi.complexp.StringProcessor; >-import org.eclipse.equinox.bidi.complexp.ComplExpUtil; >+import org.eclipse.equinox.bidi.complexp.*; > > /** >- * Tests most public methods of ComplExpBasic >+ * Tests most public methods of CxpHelper > */ > >-public class MethodsTest extends ComplExpTestBase { >+public class MethodsTest extends CxpTestBase { > >- final static int LTR = IComplExpProcessor.DIRECTION_LTR; >- final static int RTL = IComplExpProcessor.DIRECTION_RTL; >- >- IComplExpProcessor processor; >- >- private void doTestTools() { >- >- // This method tests utility methods used by the JUnits >- String data = "56789ABCDEFGHIJKLMNOPQRSTUVWXYZ~#@&><^|`"; >- String text = toUT16(data); >- String dat2 = toPseudo(text); >- assertEquals(data, dat2); >- >- text = toPseudo(data); >- assertEquals("56789abcdefghijklmnopqrstuvwxyz~#@&><^|`", text); >- >- int[] arA = new int[] { 1, 2 }; >- int[] arB = new int[] { 3, 4, 5 }; >- assertFalse(arrays_equal(arA, arB)); >- >- assertTrue(arrays_equal(arA, arA)); >- >- arB = new int[] { 3, 4 }; >- assertFalse(arrays_equal(arA, arB)); >- >- int[][] ar2A = new int[][] { { 1 }, { 1, 2 }, { 1, 2, 3 } }; >- int[][] ar2B = new int[][] { { 1 }, { 1, 2 } }; >- assertTrue(arrays2_equal(ar2A, ar2A)); >- >- assertFalse(arrays2_equal(ar2A, ar2B)); >- >- ar2B = new int[][] { { 1 }, { 1, 2 }, { 1, 2, 3, 4 } }; >- assertFalse(arrays2_equal(ar2A, ar2B)); >- >- ar2B = new int[][] { { 1 }, { 1, 2 }, { 1, 2, 4 } }; >- assertFalse(arrays2_equal(ar2A, ar2B)); >- >- text = array_display(null); >- assertEquals("null", text); >- >- text = array2_display(null); >- assertEquals("null", text); >- } >- >- private void doTestState() { >- String data, lean, full, model; >- int state; >- >- data = "A=B+C;/* D=E+F;"; >- lean = toUT16(data); >- full = processor.leanToFullText(lean); >- model = "A@=B@+C@;/* D=E+F;"; >- assertEquals("full1", model, toPseudo(full)); >- state = processor.getFinalState(); >- data = "A=B+C; D=E+F;"; >- lean = toUT16(data); >- full = processor.leanToFullText(lean, state); >- model = "A=B+C; D=E+F;"; >- assertEquals("full2", model, toPseudo(full)); >- state = processor.getFinalState(); >- data = "A=B+C;*/ D=E+F;"; >- lean = toUT16(data); >- full = processor.leanToFullText(lean, state); >- model = "A=B+C;*/@ D@=E@+F;"; >- assertEquals("full3", model, toPseudo(full)); >- } >- >- private void doTestOrientation() { >- int orient; >- >- processor = StringProcessor >- .getProcessor(IBiDiProcessor.COMMA_DELIMITED); >- orient = processor.recallOrientation(); >- // TBD: the following test cannot succeed with the current >- // implementation. >- // it will need allocating separate data for each processor use. >- // assertEquals("orient #1", IComplExpProcessor.ORIENT_LTR, orient); >- >- processor.assumeOrientation(IComplExpProcessor.ORIENT_IGNORE); >- orient = processor.recallOrientation(); >- assertEquals("orient #2", IComplExpProcessor.ORIENT_IGNORE, orient); >- >- processor.assumeOrientation(IComplExpProcessor.ORIENT_CONTEXTUAL_RTL); >- orient = processor.recallOrientation(); >- processor.leanToFullText("--!**"); >- assertEquals("orient #3", IComplExpProcessor.ORIENT_CONTEXTUAL_RTL, >- orient); >- >- processor.assumeOrientation(9999); >- orient = processor.recallOrientation(); >- processor.leanToFullText("--!**"); >- assertEquals("orient #4", IComplExpProcessor.ORIENT_UNKNOWN, orient); >- } >- >- private void doTestOrient(String label, String data, String resLTR, >- String resRTL, String resCon) { >- String full, lean; >- >- lean = toUT16(data); >- processor.assumeOrientation(IComplExpProcessor.ORIENT_LTR); >- full = processor.leanToFullText(lean); >- assertEquals(label + "LTR full", resLTR, toPseudo(full)); >- processor.assumeOrientation(IComplExpProcessor.ORIENT_RTL); >- full = processor.leanToFullText(lean); >- assertEquals("label + RTL full", resRTL, toPseudo(full)); >- processor.assumeOrientation(IComplExpProcessor.ORIENT_CONTEXTUAL_RTL); >- full = processor.leanToFullText(lean); >- assertEquals(label + "CON full", resCon, toPseudo(full)); >- } >- >- private void doTestScripts() { >- boolean flag; >- flag = processor.handlesArabicScript(); >- assertTrue("Handles Arabic 1", flag); >- flag = processor.handlesHebrewScript(); >- assertTrue("Handles Hebrew 1", flag); >- >- processor.selectBidiScript(false, false); >- flag = processor.handlesArabicScript(); >- assertFalse("Handles Arabic 2", flag); >- flag = processor.handlesHebrewScript(); >- assertFalse("Handles Hebrew 2", flag); >- doTestOrient("Scripts #1 ", "BCD,EF", "BCD,EF", ">@BCD,EF@^", "@BCD,EF"); >- processor.selectBidiScript(true, false); >- flag = processor.handlesArabicScript(); >- assertTrue("Handles Arabic 3", flag); >- flag = processor.handlesHebrewScript(); >- assertFalse("Handles Hebrew 3", flag); >- doTestOrient("Scripts #2 ", "d,EF", "d,EF", ">@d,EF@^", "d,EF"); >- doTestOrient("Scripts #3 ", "#,eF", "#,eF", ">@#,eF@^", "@#,eF"); >- doTestOrient("Scripts #4 ", "#,12", "#@,12", ">@#@,12@^", "@#@,12"); >- doTestOrient("Scripts #5 ", "#,##", "#@,##", ">@#@,##@^", "@#@,##"); >- doTestOrient("Scripts #6 ", "#,89", "#@,89", ">@#@,89@^", "@#@,89"); >- doTestOrient("Scripts #7 ", "#,ef", "#,ef", ">@#,ef@^", "@#,ef"); >- doTestOrient("Scripts #8 ", "#,", "#,", ">@#,@^", "@#,"); >- doTestOrient("Scripts #9 ", "9,ef", "9,ef", ">@9,ef@^", "9,ef"); >- doTestOrient("Scripts #10 ", "9,##", "9@,##", ">@9@,##@^", "9@,##"); >- doTestOrient("Scripts #11 ", "7,89", "7@,89", ">@7@,89@^", "7@,89"); >- doTestOrient("Scripts #12 ", "7,EF", "7,EF", ">@7,EF@^", "@7,EF"); >- doTestOrient("Scripts #13 ", "BCD,EF", "BCD,EF", ">@BCD,EF@^", >- "@BCD,EF"); >- >- processor.selectBidiScript(false, true); >- flag = processor.handlesArabicScript(); >- assertFalse("Handles Arabic 4", flag); >- flag = processor.handlesHebrewScript(); >- assertTrue("Handles Hebrew 4", flag); >- doTestOrient("Scripts #14 ", "BCd,EF", "BCd,EF", ">@BCd,EF@^", >- "@BCd,EF"); >- doTestOrient("Scripts #15 ", "BCD,eF", "BCD,eF", ">@BCD,eF@^", >- "@BCD,eF"); >- doTestOrient("Scripts #16 ", "BCD,EF", "BCD@,EF", ">@BCD@,EF@^", >- "@BCD@,EF"); >- doTestOrient("Scripts #17 ", "BCD,12", "BCD@,12", ">@BCD@,12@^", >- "@BCD@,12"); >- doTestOrient("Scripts #18 ", "BCD,", "BCD,", ">@BCD,@^", "@BCD,"); >- >- processor.selectBidiScript(true, true); >- doTestOrient("Scripts #19 ", "123,45|67", "123,45|67", ">@123,45|67@^", >- "@123,45|67"); >- doTestOrient("Scripts #20 ", "5,e", "5,e", ">@5,e@^", "5,e"); >- doTestOrient("Scripts #21 ", "5,#", "5@,#", ">@5@,#@^", "5@,#"); >- doTestOrient("Scripts #22 ", "5,6", "5@,6", ">@5@,6@^", "5@,6"); >- doTestOrient("Scripts #23 ", "5,D", "5@,D", ">@5@,D@^", "5@,D"); >- doTestOrient("Scripts #24 ", "5,--", "5,--", ">@5,--@^", "@5,--"); >- } >- >- private void doTestLeanOffsets() { >- String lean, data, label; >- int state; >- int[] offsets; >- int[] model; >- >- data = "A=B+C;/* D=E+F;"; >- lean = toUT16(data); >- offsets = processor.leanBidiCharOffsets(lean); >- model = new int[] { 1, 3, 5 }; >- label = "leanBidiCharOffsets() #1 expected=" + array_display(model) >- + " result=" + array_display(offsets); >- assertTrue(label, arrays_equal(model, offsets)); >- state = processor.getFinalState(); >- data = "A=B+C;*/ D=E+F;"; >- lean = toUT16(data); >- offsets = processor.leanBidiCharOffsets(lean, state); >- model = new int[] { 8, 10, 12 }; >- label = "leanBidiCharOffsets() #2 expected=" + array_display(model) >- + " result=" + array_display(offsets); >- assertTrue(label, arrays_equal(model, offsets)); >- offsets = processor.leanBidiCharOffsets(); >- model = new int[] { 8, 10, 12 }; >- label = "leanBidiCharOffsets() #3 expected=" + array_display(model) >- + " result=" + array_display(offsets); >- assertTrue(label, arrays_equal(model, offsets)); >- } >- >- private void doTestFullOffsets(String label, String data, int[] resLTR, >- int[] resRTL, int[] resCon) { >- String full, lean, msg; >- int[] offsets; >- >- lean = toUT16(data); >- processor.assumeOrientation(IComplExpProcessor.ORIENT_LTR); >- full = processor.leanToFullText(lean); >- // the following line avoids a compiler warning about full never being >- // read >- full += ""; >- offsets = processor.fullBidiCharOffsets(); >- msg = label + "LTR expected=" + array_display(resLTR) + " result=" >- + array_display(offsets); >- assertTrue(msg, arrays_equal(resLTR, offsets)); >- processor.assumeOrientation(IComplExpProcessor.ORIENT_RTL); >- full = processor.leanToFullText(lean); >- offsets = processor.fullBidiCharOffsets(); >- msg = label + "RTL expected=" + array_display(resRTL) + " result=" >- + array_display(offsets); >- assertTrue(msg, arrays_equal(resRTL, offsets)); >- processor.assumeOrientation(IComplExpProcessor.ORIENT_CONTEXTUAL_LTR); >- full = processor.leanToFullText(lean); >- offsets = processor.fullBidiCharOffsets(); >- msg = label + "CON expected=" + array_display(resCon) + " result=" >- + array_display(offsets); >- assertTrue(msg, arrays_equal(resCon, offsets)); >- } >- >- private void doTestMirrored() { >- boolean mirrored; >- >- mirrored = ComplExpUtil.isMirroredDefault(); >- assertFalse("mirrored #1", mirrored); >- processor = StringProcessor >- .getProcessor(IBiDiProcessor.COMMA_DELIMITED); >- mirrored = processor.isMirrored(); >- assertFalse("mirrored #2", mirrored); >- ComplExpUtil.assumeMirroredDefault(true); >- mirrored = ComplExpUtil.isMirroredDefault(); >- assertTrue("mirrored #3", mirrored); >- processor = StringProcessor >- .getProcessor(IBiDiProcessor.COMMA_DELIMITED); >- mirrored = processor.isMirrored(); >- // TBD: the following test cannot succeed with the current >- // implementation. >- // it will need allocating separate data for each processor use. >- // assertTrue("mirrored #4", mirrored); >- processor.assumeMirrored(false); >- mirrored = processor.isMirrored(); >- assertFalse("mirrored #5", mirrored); >- } >- >- private void doTestDirection() { >- int[][] dir; >- int[][] modir; >- String data, lean, full, model, msg; >- >- processor = StringProcessor >- .getProcessor(IBiDiProcessor.COMMA_DELIMITED); >- dir = processor.getDirection(); >- modir = new int[][] { { LTR, LTR }, { LTR, LTR } }; >- msg = "TestDirection #1 expected=" + array2_display(modir) + " result=" >- + array2_display(dir); >- assertTrue(msg, arrays2_equal(modir, dir)); >- >- processor.setDirection(RTL); >- dir = processor.getDirection(); >- modir = new int[][] { { RTL, RTL }, { RTL, RTL } }; >- msg = "TestDirection #2 expected=" + array2_display(modir) + " result=" >- + array2_display(dir); >- assertTrue(msg, arrays2_equal(modir, dir)); >- >- processor.setDirection(LTR, RTL); >- dir = processor.getDirection(); >- modir = new int[][] { { LTR, RTL }, { LTR, RTL } }; >- msg = "TestDirection #3 expected=" + array2_display(modir) + " result=" >- + array2_display(dir); >- assertTrue(msg, arrays2_equal(modir, dir)); >- >- processor.setArabicDirection(RTL); >- dir = processor.getDirection(); >- modir = new int[][] { { RTL, RTL }, { LTR, RTL } }; >- msg = "TestDirection #4 expected=" + array2_display(modir) + " result=" >- + array2_display(dir); >- assertTrue(msg, arrays2_equal(modir, dir)); >- >- processor.setArabicDirection(RTL, LTR); >- dir = processor.getDirection(); >- modir = new int[][] { { RTL, LTR }, { LTR, RTL } }; >- msg = "TestDirection #5 expected=" + array2_display(modir) + " result=" >- + array2_display(dir); >- assertTrue(msg, arrays2_equal(modir, dir)); >- >- processor.setHebrewDirection(RTL); >- dir = processor.getDirection(); >- modir = new int[][] { { RTL, LTR }, { RTL, RTL } }; >- msg = "TestDirection #6 expected=" + array2_display(modir) + " result=" >- + array2_display(dir); >- assertTrue(msg, arrays2_equal(modir, dir)); >- >- processor.setHebrewDirection(RTL, LTR); >- dir = processor.getDirection(); >- modir = new int[][] { { RTL, LTR }, { RTL, LTR } }; >- msg = "TestDirection #7 expected=" + array2_display(modir) + " result=" >- + array2_display(dir); >- assertTrue(msg, arrays2_equal(modir, dir)); >- >- processor = StringProcessor.getProcessor(IBiDiProcessor.EMAIL); >- processor.assumeMirrored(false); >- processor.setArabicDirection(LTR, RTL); >- processor.setHebrewDirection(LTR, LTR); >- data = "#ABC.#DEF:HOST.com"; >- lean = toUT16(data); >- full = processor.leanToFullText(lean); >- model = "#ABC@.#DEF@:HOST.com"; >- assertEquals("TestDirection #9 full", model, toPseudo(full)); >- >- data = "ABC.DEF:HOST.com"; >- lean = toUT16(data); >- full = processor.leanToFullText(lean); >- model = "ABC@.DEF@:HOST.com"; >- assertEquals("TestDirection #10 full", model, toPseudo(full)); >- >- processor.assumeMirrored(true); >- data = "#ABC.#DEF:HOST.com"; >- lean = toUT16(data); >- full = processor.leanToFullText(lean); >- model = "<&#ABC.#DEF:HOST.com&^"; >- assertEquals("TestDirection #11 full", model, toPseudo(full)); >- >- data = "#ABc.#DEF:HOSt.COM"; >- lean = toUT16(data); >- full = processor.leanToFullText(lean); >- model = "<&#ABc.#DEF:HOSt.COM&^"; >- assertEquals("TestDirection #12 full", model, toPseudo(full)); >- >- data = "#ABc.#DEF:HOSt."; >- lean = toUT16(data); >- full = processor.leanToFullText(lean); >- model = "<&#ABc.#DEF:HOSt.&^"; >- assertEquals("TestDirection #13 full", model, toPseudo(full)); >- >- data = "ABC.DEF:HOST.com"; >- lean = toUT16(data); >- full = processor.leanToFullText(lean); >- model = "ABC@.DEF@:HOST.com"; >- assertEquals("TestDirection #14 full", model, toPseudo(full)); >- >- data = "--.---:----"; >- lean = toUT16(data); >- full = processor.leanToFullText(lean); >- model = "--.---:----"; >- assertEquals("TestDirection #15 full", model, toPseudo(full)); >- >- data = "ABC.|DEF:HOST.com"; >- lean = toUT16(data); >- full = processor.leanToFullText(lean); >- model = "ABC.|DEF@:HOST.com"; >- assertEquals("TestDirection #16 full", model, toPseudo(full)); >- >- processor.assumeOrientation(IComplExpProcessor.ORIENT_RTL); >- data = "#ABc.|#DEF:HOST.com"; >- lean = toUT16(data); >- full = processor.leanToFullText(lean); >- model = "#ABc.|#DEF:HOST.com"; >- assertEquals("TestDirection #17 full", model, toPseudo(full)); >- } >- >- public void testMethods() { >- >- doTestTools(); >- >- processor = StringProcessor.getProcessor(IBiDiProcessor.JAVA); >- doTestState(); >- >- doTestOrientation(); >- >- processor = StringProcessor >- .getProcessor(IBiDiProcessor.COMMA_DELIMITED); >- doTestOrient("Methods #1 ", "", "", "", ""); >- doTestOrient("Methods #2 ", "abc", "abc", ">@abc@^", "abc"); >- doTestOrient("Methods #3 ", "ABC", "ABC", ">@ABC@^", "@ABC"); >- doTestOrient("Methods #4 ", "bcd,ef", "bcd,ef", ">@bcd,ef@^", "bcd,ef"); >- doTestOrient("Methods #5 ", "BCD,EF", "BCD@,EF", ">@BCD@,EF@^", >- "@BCD@,EF"); >- doTestOrient("Methods #6 ", "cde,FG", "cde,FG", ">@cde,FG@^", "cde,FG"); >- doTestOrient("Methods #7 ", "CDE,fg", "CDE,fg", ">@CDE,fg@^", "@CDE,fg"); >- doTestOrient("Methods #8 ", "12..def,GH", "12..def,GH", >- ">@12..def,GH@^", "12..def,GH"); >- doTestOrient("Methods #9 ", "34..DEF,gh", "34..DEF,gh", >- ">@34..DEF,gh@^", "@34..DEF,gh"); >- >- doTestScripts(); >- >- processor = StringProcessor.getProcessor(IBiDiProcessor.JAVA); >- doTestLeanOffsets(); >- >- processor = StringProcessor >- .getProcessor(IBiDiProcessor.COMMA_DELIMITED); >- doTestFullOffsets("TestFullOffsets ", "BCD,EF,G", new int[] { 3, 7 }, >- new int[] { 0, 1, 5, 9, 12, 13 }, new int[] { 0, 4, 8 }); >- >- doTestMirrored(); >- >- doTestDirection(); >- >- processor = StringProcessor >- .getProcessor(IBiDiProcessor.COMMA_DELIMITED); >- processor.assumeOrientation(IComplExpProcessor.ORIENT_LTR); >- processor.setDirection(LTR); >- String data = "A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z"; >- String lean = toUT16(data); >- String full = processor.leanToFullText(lean); >- String model = "A@,B@,C@,D@,E@,F@,G@,H@,I@,J@,K@,L@,M@,N@,O@,P@,Q@,R@,S@,T@,U@,V@,W@,X@,Y@,Z"; >- assertEquals("many inserts", model, toPseudo(full)); >- >- } >+ final static int LTR = CxpFeatures.DIR_LTR; >+ final static int RTL = CxpFeatures.DIR_RTL; >+ final static CxpEnv envLTR = new CxpEnv(null, false, CxpEnv.ORIENT_LTR); >+ final static CxpEnv envRTL = new CxpEnv(null, false, CxpEnv.ORIENT_RTL); >+ final static CxpEnv envRTLMIR = new CxpEnv(null, true, CxpEnv.ORIENT_RTL); >+ final static CxpEnv envIGN = new CxpEnv(null, false, CxpEnv.ORIENT_IGNORE); >+ final static CxpEnv envCLR = new CxpEnv(null, false, CxpEnv.ORIENT_CONTEXTUAL_LTR); >+ final static CxpEnv envCRL = new CxpEnv(null, false, CxpEnv.ORIENT_CONTEXTUAL_RTL); >+ final static CxpEnv envERR = new CxpEnv(null, false, 9999); >+ >+ CxpHelper helper; >+ >+ private void doTestTools() { >+ >+ // This method tests utility methods used by the JUnits >+ String data = "56789ABCDEFGHIJKLMNOPQRSTUVWXYZ~#@&><^|`"; >+ String text = toUT16(data); >+ String dat2 = toPseudo(text); >+ assertEquals(data, dat2); >+ >+ text = toPseudo(data); >+ assertEquals("56789abcdefghijklmnopqrstuvwxyz~#@&><^|`", text); >+ >+ int[] arA = new int[] { 1, 2 }; >+ int[] arB = new int[] { 3, 4, 5 }; >+ assertFalse(arrays_equal(arA, arB)); >+ >+ assertTrue(arrays_equal(arA, arA)); >+ >+ arB = new int[] { 3, 4 }; >+ assertFalse(arrays_equal(arA, arB)); >+ >+ text = array_display(null); >+ assertEquals("null", text); >+ } >+ >+ private void doTestState() { >+ String data, lean, full, model; >+ int state; >+ >+ data = "A=B+C;/* D=E+F;"; >+ lean = toUT16(data); >+ full = helper.leanToFullText(lean); >+ model = "A@=B@+C@;/* D=E+F;"; >+ assertEquals("full1", model, toPseudo(full)); >+ state = helper.getFinalState(); >+ data = "A=B+C; D=E+F;"; >+ lean = toUT16(data); >+ full = helper.leanToFullText(lean, state); >+ model = "A=B+C; D=E+F;"; >+ assertEquals("full2", model, toPseudo(full)); >+ state = helper.getFinalState(); >+ data = "A=B+C;*/ D=E+F;"; >+ lean = toUT16(data); >+ full = helper.leanToFullText(lean, state); >+ model = "A=B+C;*/@ D@=E@+F;"; >+ assertEquals("full3", model, toPseudo(full)); >+ } >+ >+ private void doTestOrientation() { >+ int orient; >+ >+ helper = new CxpHelper(IProcessorTypes.COMMA_DELIMITED); >+ orient = helper.getEnvironment().orientation; >+ assertEquals("orient #1", CxpEnv.ORIENT_LTR, orient); >+ >+ helper.setEnvironment(envIGN); >+ orient = helper.getEnvironment().orientation; >+ assertEquals("orient #2", CxpEnv.ORIENT_IGNORE, orient); >+ >+ helper.setEnvironment(envCRL); >+ orient = helper.getEnvironment().orientation; >+ helper.leanToFullText("--!**"); >+ assertEquals("orient #3", CxpEnv.ORIENT_CONTEXTUAL_RTL, orient); >+ >+ helper.setEnvironment(envERR); >+ orient = helper.getEnvironment().orientation; >+ helper.leanToFullText("--!**"); >+ assertEquals("orient #4", CxpEnv.ORIENT_UNKNOWN, orient); >+ } >+ >+ private void doTestOrient(CxpFeatures f, String label, String data, String resLTR, >+ String resRTL, String resCon) { >+ String full, lean; >+ >+ lean = toUT16(data); >+ helper.setEnvironment(envLTR); >+ helper.setFeatures(f); >+ full = helper.leanToFullText(lean); >+ assertEquals(label + "LTR full", resLTR, toPseudo(full)); >+ helper.setEnvironment(envRTL); >+ helper.setFeatures(f); >+ full = helper.leanToFullText(lean); >+ assertEquals("label + RTL full", resRTL, toPseudo(full)); >+ helper.setEnvironment(envCRL); >+ helper.setFeatures(f); >+ full = helper.leanToFullText(lean); >+ assertEquals(label + "CON full", resCon, toPseudo(full)); >+ } >+ >+ private void doTestScripts() { >+ CxpFeatures f2, f1 = helper.getFeatures(); >+ boolean flag; >+ flag = f1.ignoreArabic; >+ assertFalse("Ignores Arabic 1", flag); >+ flag = f1.ignoreHebrew; >+ assertFalse("Ignores Hebrew 1", flag); >+ >+ f2 = new CxpFeatures(f1.operators, 0, -1, -1, true, true); >+ flag = f2.ignoreArabic; >+ assertTrue("Ignores Arabic 2", flag); >+ flag = f2.ignoreHebrew; >+ assertTrue("Ignores Hebrew 2", flag); >+ doTestOrient(f2, "Scripts #1 ", "BCD,EF", "BCD,EF", ">@BCD,EF@^", "@BCD,EF"); >+ f2 = new CxpFeatures(f1.operators, 0, -1, -1, false, true); >+ flag = f2.ignoreArabic; >+ assertFalse("Ignores Arabic 3", flag); >+ flag = f2.ignoreHebrew; >+ assertTrue("Ignores Hebrew 3", flag); >+ doTestOrient(f2, "Scripts #2 ", "d,EF", "d,EF", ">@d,EF@^", "d,EF"); >+ doTestOrient(f2, "Scripts #3 ", "#,eF", "#,eF", ">@#,eF@^", "@#,eF"); >+ doTestOrient(f2, "Scripts #4 ", "#,12", "#@,12", ">@#@,12@^", "@#@,12"); >+ doTestOrient(f2, "Scripts #5 ", "#,##", "#@,##", ">@#@,##@^", "@#@,##"); >+ doTestOrient(f2, "Scripts #6 ", "#,89", "#@,89", ">@#@,89@^", "@#@,89"); >+ doTestOrient(f2, "Scripts #7 ", "#,ef", "#,ef", ">@#,ef@^", "@#,ef"); >+ doTestOrient(f2, "Scripts #8 ", "#,", "#,", ">@#,@^", "@#,"); >+ doTestOrient(f2, "Scripts #9 ", "9,ef", "9,ef", ">@9,ef@^", "9,ef"); >+ doTestOrient(f2, "Scripts #10 ", "9,##", "9@,##", ">@9@,##@^", "9@,##"); >+ doTestOrient(f2, "Scripts #11 ", "7,89", "7@,89", ">@7@,89@^", "7@,89"); >+ doTestOrient(f2, "Scripts #12 ", "7,EF", "7,EF", ">@7,EF@^", "@7,EF"); >+ doTestOrient(f2, "Scripts #13 ", "BCD,EF", "BCD,EF", ">@BCD,EF@^", >+ "@BCD,EF"); >+ >+ f2 = new CxpFeatures(f1.operators, 0, -1, -1, true, false); >+ flag = f2.ignoreArabic; >+ assertTrue("Ignores Arabic 4", flag); >+ flag = f2.ignoreHebrew; >+ assertFalse("Ignores Hebrew 4", flag); >+ doTestOrient(f2, "Scripts #14 ", "BCd,EF", "BCd,EF", ">@BCd,EF@^", >+ "@BCd,EF"); >+ doTestOrient(f2, "Scripts #15 ", "BCD,eF", "BCD,eF", ">@BCD,eF@^", >+ "@BCD,eF"); >+ doTestOrient(f2, "Scripts #16 ", "BCD,EF", "BCD@,EF", ">@BCD@,EF@^", >+ "@BCD@,EF"); >+ doTestOrient(f2, "Scripts #17 ", "BCD,12", "BCD@,12", ">@BCD@,12@^", >+ "@BCD@,12"); >+ doTestOrient(f2, "Scripts #18 ", "BCD,", "BCD,", ">@BCD,@^", "@BCD,"); >+ >+ f2 = new CxpFeatures(f1.operators, 0, -1, -1, false, false); >+ doTestOrient(f2, "Scripts #19 ", "123,45|67", "123,45|67", ">@123,45|67@^", >+ "@123,45|67"); >+ doTestOrient(f2, "Scripts #20 ", "5,e", "5,e", ">@5,e@^", "5,e"); >+ doTestOrient(f2, "Scripts #21 ", "5,#", "5@,#", ">@5@,#@^", "5@,#"); >+ doTestOrient(f2, "Scripts #22 ", "5,6", "5@,6", ">@5@,6@^", "5@,6"); >+ doTestOrient(f2, "Scripts #23 ", "5,D", "5@,D", ">@5@,D@^", "5@,D"); >+ doTestOrient(f2, "Scripts #24 ", "5,--", "5,--", ">@5,--@^", "@5,--"); >+ } >+ >+ private void doTestLeanOffsets() { >+ String lean, data, label; >+ int state; >+ int[] offsets; >+ int[] model; >+ >+ data = "A=B+C;/* D=E+F;"; >+ lean = toUT16(data); >+ helper.leanToFullText(lean); >+ offsets = helper.leanBidiCharOffsets(); >+ model = new int[] { 1, 3, 5 }; >+ label = "leanBidiCharOffsets() #1 expected=" + array_display(model) >+ + " result=" + array_display(offsets); >+ assertTrue(label, arrays_equal(model, offsets)); >+ state = helper.getFinalState(); >+ data = "A=B+C;*/ D=E+F;"; >+ lean = toUT16(data); >+ helper.leanToFullText(lean, state); >+ offsets = helper.leanBidiCharOffsets(); >+ model = new int[] { 8, 10, 12 }; >+ label = "leanBidiCharOffsets() #2 expected=" + array_display(model) >+ + " result=" + array_display(offsets); >+ assertTrue(label, arrays_equal(model, offsets)); >+ offsets = helper.leanBidiCharOffsets(); >+ model = new int[] { 8, 10, 12 }; >+ label = "leanBidiCharOffsets() #3 expected=" + array_display(model) >+ + " result=" + array_display(offsets); >+ assertTrue(label, arrays_equal(model, offsets)); >+ } >+ >+ private void doTestFullOffsets(String label, String data, int[] resLTR, >+ int[] resRTL, int[] resCon) { >+ String full, lean, msg; >+ int[] offsets; >+ >+ lean = toUT16(data); >+ helper.setEnvironment(envLTR); >+ full = helper.leanToFullText(lean); >+ // the following line avoids a compiler warning about full never being >+ // read >+ full += ""; >+ offsets = helper.fullBidiCharOffsets(); >+ msg = label + "LTR expected=" + array_display(resLTR) + " result=" >+ + array_display(offsets); >+ assertTrue(msg, arrays_equal(resLTR, offsets)); >+ helper.setEnvironment(envRTL); >+ full = helper.leanToFullText(lean); >+ offsets = helper.fullBidiCharOffsets(); >+ msg = label + "RTL expected=" + array_display(resRTL) + " result=" >+ + array_display(offsets); >+ assertTrue(msg, arrays_equal(resRTL, offsets)); >+ helper.setEnvironment(envCLR); >+ full = helper.leanToFullText(lean); >+ offsets = helper.fullBidiCharOffsets(); >+ msg = label + "CON expected=" + array_display(resCon) + " result=" >+ + array_display(offsets); >+ assertTrue(msg, arrays_equal(resCon, offsets)); >+ } >+ >+ private void doTestMirrored() { >+ boolean mirrored; >+ >+ helper = new CxpHelper(IProcessorTypes.COMMA_DELIMITED); >+ mirrored = helper.getEnvironment().mirrored; >+ assertFalse("mirrored #1", mirrored); >+ CxpEnv env = new CxpEnv(null, true, CxpEnv.ORIENT_LTR); >+ helper = new CxpHelper(IProcessorTypes.COMMA_DELIMITED, env); >+ mirrored = helper.getEnvironment().mirrored; >+ assertTrue("mirrored #2", mirrored); >+ } >+ >+ private void doTestDirection() { >+ String data, lean, full, model, msg; >+ >+ helper = new CxpHelper(IProcessorTypes.COMMA_DELIMITED); >+ CxpFeatures f1 = helper.getFeatures(); >+ msg = "TestDirection #1"; >+ assertTrue(msg, f1.dirArabic == LTR && f1.dirHebrew == LTR); >+ >+ CxpFeatures f2 = new CxpFeatures(f1.operators, 0, RTL, RTL, false, false); >+ helper.setFeatures(f2); >+ f1 = helper.getFeatures(); >+ msg = "TestDirection #2"; >+ assertTrue(msg, f1.dirArabic == RTL && f1.dirHebrew == RTL); >+ >+ CxpEnv env = new CxpEnv(null, false, CxpEnv.ORIENT_LTR); >+ helper = new CxpHelper(IProcessorTypes.EMAIL, env); >+ f1 = helper.getFeatures(); >+ msg = "TestDirection #3"; >+ assertTrue(msg, f1.dirArabic == LTR && f1.dirHebrew == LTR); >+ data = "#ABC.#DEF:HOST.com"; >+ lean = toUT16(data); >+ full = helper.leanToFullText(lean); >+ model = "#ABC@.#DEF@:HOST.com"; >+ assertEquals("TestDirection #9 full", model, toPseudo(full)); >+ >+ data = "ABC.DEF:HOST.com"; >+ lean = toUT16(data); >+ full = helper.leanToFullText(lean); >+ model = "ABC@.DEF@:HOST.com"; >+ assertEquals("TestDirection #10 full", model, toPseudo(full)); >+ >+ env = new CxpEnv(null, true, CxpEnv.ORIENT_LTR); >+ helper.setEnvironment(env); >+ f1 = helper.getFeatures(); >+ msg = "TestDirection #10.5"; >+ assertTrue(msg, f1.dirArabic == RTL && f1.dirHebrew == LTR); >+ data = "#ABC.#DEF:HOST.com"; >+ lean = toUT16(data); >+ full = helper.leanToFullText(lean); >+ model = "<&#ABC.#DEF:HOST.com&^"; >+ assertEquals("TestDirection #11 full", model, toPseudo(full)); >+ >+ data = "#ABc.#DEF:HOSt.COM"; >+ lean = toUT16(data); >+ full = helper.leanToFullText(lean); >+ model = "<&#ABc.#DEF:HOSt.COM&^"; >+ assertEquals("TestDirection #12 full", model, toPseudo(full)); >+ >+ data = "#ABc.#DEF:HOSt."; >+ lean = toUT16(data); >+ full = helper.leanToFullText(lean); >+ model = "<&#ABc.#DEF:HOSt.&^"; >+ assertEquals("TestDirection #13 full", model, toPseudo(full)); >+ >+ data = "ABC.DEF:HOST.com"; >+ lean = toUT16(data); >+ full = helper.leanToFullText(lean); >+ model = "ABC@.DEF@:HOST.com"; >+ assertEquals("TestDirection #14 full", model, toPseudo(full)); >+ >+ data = "--.---:----"; >+ lean = toUT16(data); >+ full = helper.leanToFullText(lean); >+ model = "--.---:----"; >+ assertEquals("TestDirection #15 full", model, toPseudo(full)); >+ >+ data = "ABC.|DEF:HOST.com"; >+ lean = toUT16(data); >+ full = helper.leanToFullText(lean); >+ model = "ABC.|DEF@:HOST.com"; >+ assertEquals("TestDirection #16 full", model, toPseudo(full)); >+ >+ helper.setEnvironment(envRTLMIR); >+ data = "#ABc.|#DEF:HOST.com"; >+ lean = toUT16(data); >+ full = helper.leanToFullText(lean); >+ model = "#ABc.|#DEF:HOST.com"; >+ assertEquals("TestDirection #17 full", model, toPseudo(full)); >+ assertEquals("Test curDirection", RTL, helper.getCurDirection()); >+ } >+ >+ public void testMethods() { >+ >+ doTestTools(); >+ >+ helper = new CxpHelper(IProcessorTypes.JAVA); >+ doTestState(); >+ >+ doTestOrientation(); >+ >+ helper = new CxpHelper(IProcessorTypes.COMMA_DELIMITED); >+ CxpFeatures f2 = helper.getFeatures(); >+ doTestOrient(f2, "Methods #1 ", "", "", "", ""); >+ doTestOrient(f2, "Methods #2 ", "abc", "abc", ">@abc@^", "abc"); >+ doTestOrient(f2, "Methods #3 ", "ABC", "ABC", ">@ABC@^", "@ABC"); >+ doTestOrient(f2, "Methods #4 ", "bcd,ef", "bcd,ef", ">@bcd,ef@^", "bcd,ef"); >+ doTestOrient(f2, "Methods #5 ", "BCD,EF", "BCD@,EF", ">@BCD@,EF@^", >+ "@BCD@,EF"); >+ doTestOrient(f2, "Methods #6 ", "cde,FG", "cde,FG", ">@cde,FG@^", "cde,FG"); >+ doTestOrient(f2, "Methods #7 ", "CDE,fg", "CDE,fg", ">@CDE,fg@^", "@CDE,fg"); >+ doTestOrient(f2, "Methods #8 ", "12..def,GH", "12..def,GH", >+ ">@12..def,GH@^", "12..def,GH"); >+ doTestOrient(f2, "Methods #9 ", "34..DEF,gh", "34..DEF,gh", >+ ">@34..DEF,gh@^", "@34..DEF,gh"); >+ >+ doTestScripts(); >+ >+ helper = new CxpHelper(IProcessorTypes.JAVA); >+ doTestLeanOffsets(); >+ >+ helper = new CxpHelper(IProcessorTypes.COMMA_DELIMITED); >+ doTestFullOffsets("TestFullOffsets ", "BCD,EF,G", new int[] { 3, 7 }, >+ new int[] { 0, 1, 5, 9, 12, 13 }, new int[] { 0, 4, 8 }); >+ >+ doTestMirrored(); >+ >+ doTestDirection(); >+ >+ helper = new CxpHelper(IProcessorTypes.COMMA_DELIMITED); >+ String data = "A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z"; >+ String lean = toUT16(data); >+ String full = helper.leanToFullText(lean); >+ String model = "A@,B@,C@,D@,E@,F@,G@,H@,I@,J@,K@,L@,M@,N@,O@,P@,Q@,R@,S@,T@,U@,V@,W@,X@,Y@,Z"; >+ assertEquals("many inserts", model, toPseudo(full)); >+ } > } >Index: src/org/eclipse/equinox/bidi/internal/tests/NullProcessorTest.java >=================================================================== >RCS file: src/org/eclipse/equinox/bidi/internal/tests/NullProcessorTest.java >diff -N src/org/eclipse/equinox/bidi/internal/tests/NullProcessorTest.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/equinox/bidi/internal/tests/NullProcessorTest.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,60 @@ >+/******************************************************************************* >+ * Copyright (c) 2010 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ ******************************************************************************/ >+ >+package org.eclipse.equinox.bidi.internal.tests; >+ >+import org.eclipse.equinox.bidi.complexp.*; >+ >+/** >+ * Tests RTL arithmetic >+ */ >+public class NullProcessorTest extends CxpTestBase { >+ >+ static final int[] EMPTY_INT_ARRAY = new int[0]; >+ >+ private CxpHelper helper; >+ >+ protected void setUp() throws Exception { >+ super.setUp(); >+ helper = new CxpHelper(); >+ } >+ >+ public void testNullProcessor() { >+ String full = helper.leanToFullText("abc"); >+ assertEquals("leanToFullText", "abc", full); >+ full = helper.leanToFullText("abc", 3); >+ assertEquals("leanToFullText with state", "abc", full); >+ int[] offsets = helper.leanBidiCharOffsets(); >+ assertTrue("leanBidiCharOffsets", arrays_equal(offsets, EMPTY_INT_ARRAY)); >+ offsets = helper.fullBidiCharOffsets(); >+ assertTrue("fullBidiCharOffsets", arrays_equal(offsets, EMPTY_INT_ARRAY)); >+ String lean = helper.fullToLeanText("abc"); >+ assertEquals("fullToLeanText", "abc", lean); >+ lean = helper.fullToLeanText("abc", 3); >+ assertEquals("fullToLeanText with state", "abc", lean); >+ int state = helper.getFinalState(); >+ assertEquals("getFinalState", CxpHelper.STATE_NOTHING_GOING, state); >+ int pos = helper.leanToFullPos(13); >+ assertEquals("leanToFullPos", 13, pos); >+ pos = helper.fullToLeanPos(15); >+ assertEquals("fullToLeanPos", 15, pos); >+ assertEquals("getDirProp", Character.DIRECTIONALITY_UNDEFINED, >+ helper.getDirProp(123)); >+ int direction = helper.getCurDirection(); >+ assertEquals("getCurDirection", CxpFeatures.DIR_LTR, direction); >+ CxpEnv env = helper.getEnvironment(); >+ assertEquals("getEnvironment", CxpEnv.DEFAULT, env); >+ helper.setEnvironment(env); >+ CxpFeatures features = helper.getFeatures(); >+ assertEquals("getFeatures", CxpFeatures.DEFAULT, features); >+ helper.setFeatures(features); >+ } >+} >Index: src/org/eclipse/equinox/bidi/internal/tests/SomeMoreTest.java >=================================================================== >RCS file: src/org/eclipse/equinox/bidi/internal/tests/SomeMoreTest.java >diff -N src/org/eclipse/equinox/bidi/internal/tests/SomeMoreTest.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/equinox/bidi/internal/tests/SomeMoreTest.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,93 @@ >+/******************************************************************************* >+ * Copyright (c) 2010 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ ******************************************************************************/ >+ >+package org.eclipse.equinox.bidi.internal.tests; >+ >+import org.eclipse.equinox.bidi.complexp.*; >+ >+/** >+ * Tests some weird cases >+ */ >+ >+public class SomeMoreTest extends CxpTestBase { >+ >+ final static CxpEnv env1 = new CxpEnv("en_US", false, CxpEnv.ORIENT_LTR); >+ final static CxpEnv env2 = new CxpEnv("he", false, CxpEnv.ORIENT_LTR); >+ final static CxpFeatures features1 = new CxpFeatures(null, 1, -1, -1, false, false); >+ >+ CxpHelper helper; >+ >+ class Proc1 extends CxpProcessor { >+ >+ public CxpFeatures init(CxpHelper ceh, CxpEnv env) { >+ return features1; >+ } >+ public int indexOfSpecial(CxpHelper ceh, int whichSpecial, String srcText, int fromIndex) { >+ return fromIndex; >+ } >+ public int processSpecial(CxpHelper ceh, int whichSpecial, String srcText, int operLocation) { >+ int len = srcText.length(); >+ for (int i = len - 1; i >= 0; i--) { >+ ceh.insertMark(i); >+ ceh.insertMark(i); >+ } >+ return len; >+ } >+ } >+ >+ class Proc2 extends CxpProcessor { >+ >+ public CxpFeatures init(CxpHelper ceh, CxpEnv env) { >+ return features1; >+ } >+ } >+ >+ class Proc3 extends CxpProcessor { >+ >+ public CxpFeatures init(CxpHelper ceh, CxpEnv env) { >+ return features1; >+ } >+ public int indexOfSpecial(CxpHelper ceh, int whichSpecial, String srcText, int fromIndex) { >+ return 0; >+ } >+ } >+ >+ public void testSomeMore() { >+ assertFalse(env1.isBidi()); >+ assertTrue(env2.isBidi()); >+ >+ ICxpProcessor proc = new Proc1(); >+ helper = new CxpHelper(proc, env1); >+ String full = toPseudo(helper.leanToFullText("abcd")); >+ assertEquals("@a@b@c@d", full); >+ >+ proc = new Proc2(); >+ helper = new CxpHelper(proc, env1); >+ boolean catchFlag = false; >+ try { >+ full = toPseudo(helper.leanToFullText("abcd")); >+ } catch(IllegalStateException e) { >+ catchFlag = true; >+ } >+ assertTrue("Catch missing indexOfSpecial", catchFlag); >+ >+ proc = new Proc3(); >+ helper = new CxpHelper(proc, env1); >+ catchFlag = false; >+ try { >+ full = toPseudo(helper.leanToFullText("abcd")); >+ } catch(IllegalStateException e) { >+ catchFlag = true; >+ } >+ assertTrue("Catch missing processSpecial", catchFlag); >+ } >+ >+} >Index: src/org/eclipse/equinox/bidi/tests/BiDiTestSuite.java >=================================================================== >RCS file: src/org/eclipse/equinox/bidi/tests/BiDiTestSuite.java >diff -N src/org/eclipse/equinox/bidi/tests/BiDiTestSuite.java >--- src/org/eclipse/equinox/bidi/tests/BiDiTestSuite.java 17 Mar 2010 17:53:43 -0000 1.3 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,34 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2010 IBM Corporation and others. >- * All rights reserved. This program and the accompanying materials >- * are made available under the terms of the Eclipse Public License v1.0 >- * which accompanies this distribution, and is available at >- * http://www.eclipse.org/legal/epl-v10.html >- * >- * Contributors: >- * IBM Corporation - initial API and implementation >- ******************************************************************************/ >- >-package org.eclipse.equinox.bidi.tests; >- >-import org.eclipse.equinox.bidi.internal.tests.*; >- >-import junit.framework.Test; >-import junit.framework.TestSuite; >- >-public class BiDiTestSuite extends TestSuite { >- public static Test suite() { >- return new BiDiTestSuite(); >- } >- >- public BiDiTestSuite() { >- addTestSuite(ExtensibilityTest.class); >- addTestSuite(MethodsTest.class); >- // addTestSuite(TestDoNothing.class); >- addTestSuite(FullToLeanTest.class); >- addTestSuite(ComplExpMathTest.class); >- // TBD: TestSubclass >- addTestSuite(ExtensionsTest.class); >- addTestSuite(ComplExpUtilTest.class); >- } >-} >Index: src/org/eclipse/equinox/bidi/tests/CxpTestSuite.java >=================================================================== >RCS file: src/org/eclipse/equinox/bidi/tests/CxpTestSuite.java >diff -N src/org/eclipse/equinox/bidi/tests/CxpTestSuite.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/equinox/bidi/tests/CxpTestSuite.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,34 @@ >+/******************************************************************************* >+ * Copyright (c) 2010 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ ******************************************************************************/ >+ >+package org.eclipse.equinox.bidi.tests; >+ >+import org.eclipse.equinox.bidi.internal.tests.*; >+ >+import junit.framework.Test; >+import junit.framework.TestSuite; >+ >+public class CxpTestSuite extends TestSuite { >+ public static Test suite() { >+ return new CxpTestSuite(); >+ } >+ >+ public CxpTestSuite() { >+ addTestSuite(ExtensibilityTest.class); >+ addTestSuite(MethodsTest.class); >+ addTestSuite(NullProcessorTest.class); >+ addTestSuite(FullToLeanTest.class); >+ addTestSuite(ExtensionsTest.class); >+ addTestSuite(CxpMathTest.class); >+ addTestSuite(SomeMoreTest.class); >+ addTestSuite(CxpUtilTest.class); >+ } >+} >\ No newline at end of file
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 183164
:
148967
|
157821
|
158092
|
158531
|
160015
|
160017
|
160081
|
160698
|
160858
|
162228
|
162229
|
164476
|
186038
|
186054
|
186488
|
186490
|
188406
|
188407
|
188408
|
188627
|
194078
|
194079
|
195082
|
195084
|
196575
|
196576
|
199068
|
199070
|
199113
|
199855
|
200008
|
200389
|
200629
|
200630
|
200631
|
200742
|
200743
|
200803
|
200805
|
200905
|
200907
|
201464
|
201465
|
201467
|
201468
|
201469
|
201470
|
201676
|
201677
|
201785
|
201787
|
202172
|
202173
|
205767
|
205768
|
206588
|
210657