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 194079 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]
new version for bidi complex expression tests
patch_bidi_tests_20110426.txt (text/plain), 84.02 KB, created by
Matitiahu Allouche
on 2011-04-26 12:51:57 EDT
(
hide
)
Description:
new version for bidi complex expression tests
Filename:
MIME Type:
Creator:
Matitiahu Allouche
Created:
2011-04-26 12:51:57 EDT
Size:
84.02 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.equinox.bidi.tests >Index: .classpath >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/components/bundles/org.eclipse.equinox.bidi.tests/.classpath,v >retrieving revision 1.1 >diff -u -r1.1 .classpath >--- .classpath 3 Feb 2010 20:08:12 -0000 1.1 >+++ .classpath 26 Apr 2011 07:02:41 -0000 >@@ -3,5 +3,6 @@ > <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.4"/> > <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> > <classpathentry kind="src" path="src"/> >+ <classpathentry combineaccessrules="false" kind="src" path="/org.eclipse.equinox.bidi"/> > <classpathentry kind="output" path="bin"/> > </classpath> >Index: src/org/eclipse/equinox/bidi/internal/tests/BidiComplexExtensibilityTest.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/components/bundles/org.eclipse.equinox.bidi.tests/src/org/eclipse/equinox/bidi/internal/tests/BidiComplexExtensibilityTest.java,v >retrieving revision 1.1 >diff -u -r1.1 BidiComplexExtensibilityTest.java >--- src/org/eclipse/equinox/bidi/internal/tests/BidiComplexExtensibilityTest.java 9 Feb 2011 21:28:56 -0000 1.1 >+++ src/org/eclipse/equinox/bidi/internal/tests/BidiComplexExtensibilityTest.java 26 Apr 2011 07:02:41 -0000 >@@ -11,7 +11,7 @@ > > package org.eclipse.equinox.bidi.internal.tests; > >-import org.eclipse.equinox.bidi.BidiComplexHelper; >+import org.eclipse.equinox.bidi.BidiComplexEngine; > import org.eclipse.equinox.bidi.custom.BidiComplexStringProcessor; > import org.eclipse.equinox.bidi.custom.IBidiComplexProcessor; > >@@ -46,11 +46,10 @@ > processor = BidiComplexStringProcessor.getProcessor("badtest"); > assertNull(processor); > >- BidiComplexHelper helper = new BidiComplexHelper("test"); > String data, lean, full, model; > data = "ABC.DEF:HOST-COM=HELLO"; > lean = toUT16(data); >- full = helper.leanToFullText(lean); >+ full = BidiComplexEngine.leanToFullText("test", null, null, lean, null); > model = "ABC@.DEF@:HOST@-COM@=HELLO"; > assertEquals("Test 'test' plugin", model, toPseudo(full)); > } >Index: src/org/eclipse/equinox/bidi/internal/tests/BidiComplexExtensionsTest.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/components/bundles/org.eclipse.equinox.bidi.tests/src/org/eclipse/equinox/bidi/internal/tests/BidiComplexExtensionsTest.java,v >retrieving revision 1.1 >diff -u -r1.1 BidiComplexExtensionsTest.java >--- src/org/eclipse/equinox/bidi/internal/tests/BidiComplexExtensionsTest.java 9 Feb 2011 21:28:56 -0000 1.1 >+++ src/org/eclipse/equinox/bidi/internal/tests/BidiComplexExtensionsTest.java 26 Apr 2011 07:02:41 -0000 >@@ -11,7 +11,9 @@ > > package org.eclipse.equinox.bidi.internal.tests; > >-import org.eclipse.equinox.bidi.*; >+import org.eclipse.equinox.bidi.BidiComplexEngine; >+import org.eclipse.equinox.bidi.IBidiComplexExpressionTypes; >+import org.eclipse.equinox.bidi.custom.*; > > /** > * Tests all plug-in extensions >@@ -19,168 +21,162 @@ > > public class BidiComplexExtensionsTest extends BidiComplexTestBase { > >- static int state = BidiComplexHelper.STATE_NOTHING_GOING; >+ IBidiComplexProcessor processor; >+ BidiComplexFeatures f1, f2; >+ int[] state = new int[1]; >+ String type; > >- private void doTest1(BidiComplexHelper complexp, String label, String data, String result) { >+ private void doTest1(String label, String data, String result) { > String full; >- full = complexp.leanToFullText(toUT16(data), state); >- state = complexp.getFinalState(); >+ full = BidiComplexEngine.leanToFullText(type, null, null, toUT16(data), state); > assertEquals(label + " data = " + data, result, toPseudo(full)); > } > >- private void doTest2(BidiComplexHelper complexp, String label, String data, String result) { >+ private void doTest2(String label, String data, String result) { > String full; >- full = complexp.leanToFullText(data, state); >- state = complexp.getFinalState(); >+ full = BidiComplexEngine.leanToFullText(type, null, null, data, state); > assertEquals(label + " data = " + data, result, toPseudo(full)); > } > >- public void testExtensions() { >+ private void doTest3(String label, String data, String result) { >+ String full; >+ full = BidiComplexEngine.leanToFullText(processor, f2, null, toUT16(data), state); >+ assertEquals(label + " data = " + data, result, toPseudo(full)); >+ } > >- BidiComplexHelper helper; >+ public void testExtensions() { > >- helper = new BidiComplexHelper(IBidiComplexExpressionTypes.COMMA_DELIMITED); >- assertNotNull(helper); >- state = BidiComplexHelper.STATE_NOTHING_GOING; >- doTest1(helper, "Comma #1", "ab,cd, AB, CD, EFG", "ab,cd, AB@, CD@, EFG"); >- >- helper = new BidiComplexHelper(IBidiComplexExpressionTypes.EMAIL); >- assertNotNull(helper); >- state = BidiComplexHelper.STATE_NOTHING_GOING; >- doTest1(helper, "Email #1", "abc.DEF:GHI", "abc.DEF@:GHI"); >- doTest1(helper, "Email #2", "DEF.GHI \"A.B\":JK ", "DEF@.GHI @\"A.B\"@:JK "); >- doTest1(helper, "Email #3", "DEF,GHI (A,B);JK ", "DEF@,GHI @(A,B)@;JK "); >- doTest1(helper, "Email #4", "DEF.GHI (A.B :JK ", "DEF@.GHI @(A.B :JK "); >- >- helper = new BidiComplexHelper(IBidiComplexExpressionTypes.FILE); >- assertNotNull(helper); >- state = BidiComplexHelper.STATE_NOTHING_GOING; >- doTest1(helper, "File #1", "c:\\A\\B\\FILE.EXT", "c:\\A@\\B@\\FILE@.EXT"); >- >- helper = new BidiComplexHelper(IBidiComplexExpressionTypes.JAVA); >- assertNotNull(helper); >- state = BidiComplexHelper.STATE_NOTHING_GOING; >- doTest1(helper, "Java #1", "A = B + C;", "A@ = B@ + C;"); >- doTest1(helper, "Java #2", "A = B + C;", "A@ = B@ + C;"); >- doTest1(helper, "Java #3", "A = \"B+C\"+D;", "A@ = \"B+C\"@+D;"); >- doTest1(helper, "Java #4", "A = \"B+C+D;", "A@ = \"B+C+D;"); >- doTest1(helper, "Java #5", "A = \"B\\\"C\"+D;", "A@ = \"B\\\"C\"@+D;"); >- doTest1(helper, "Java #6", "A = /*B+C*/ D;", "A@ = /*B+C*/@ D;"); >- doTest1(helper, "Java #7", "A = /*B+C* D;", "A@ = /*B+C* D;"); >- doTest1(helper, "Java #8", "X+Y+Z */ B; ", "X+Y+Z */@ B; "); >- doTest1(helper, "Java #9", "A = //B+C* D;", "A@ = //B+C* D;"); >- doTest1(helper, "Java #10", "A = //B+C`|D+E;", "A@ = //B+C`|D@+E;"); >- >- helper = new BidiComplexHelper(IBidiComplexExpressionTypes.PROPERTY); >- assertNotNull(helper); >- state = BidiComplexHelper.STATE_NOTHING_GOING; >- doTest1(helper, "Property #0", "NAME,VAL1,VAL2", "NAME,VAL1,VAL2"); >- doTest1(helper, "Property #1", "NAME=VAL1,VAL2", "NAME@=VAL1,VAL2"); >- doTest1(helper, "Property #2", "NAME=VAL1,VAL2=VAL3", "NAME@=VAL1,VAL2=VAL3"); >+ type = IBidiComplexExpressionTypes.COMMA_DELIMITED; >+ state[0] = BidiComplexEngine.STATE_INITIAL; >+ doTest1("Comma #1", "ab,cd, AB, CD, EFG", "ab,cd, AB@, CD@, EFG"); >+ >+ type = IBidiComplexExpressionTypes.EMAIL; >+ state[0] = BidiComplexEngine.STATE_INITIAL; >+ doTest1("Email #1", "abc.DEF:GHI", "abc.DEF@:GHI"); >+ doTest1("Email #2", "DEF.GHI \"A.B\":JK ", "DEF@.GHI @\"A.B\"@:JK "); >+ doTest1("Email #3", "DEF,GHI (A,B);JK ", "DEF@,GHI @(A,B)@;JK "); >+ doTest1("Email #4", "DEF.GHI (A.B :JK ", "DEF@.GHI @(A.B :JK "); >+ >+ type = IBidiComplexExpressionTypes.FILE; >+ state[0] = BidiComplexEngine.STATE_INITIAL; >+ doTest1("File #1", "c:\\A\\B\\FILE.EXT", "c:\\A@\\B@\\FILE@.EXT"); >+ >+ type = IBidiComplexExpressionTypes.JAVA; >+ state[0] = BidiComplexEngine.STATE_INITIAL; >+ doTest1("Java #1", "A = B + C;", "A@ = B@ + C;"); >+ doTest1("Java #2", "A = B + C;", "A@ = B@ + C;"); >+ doTest1("Java #3", "A = \"B+C\"+D;", "A@ = \"B+C\"@+D;"); >+ doTest1("Java #4", "A = \"B+C+D;", "A@ = \"B+C+D;"); >+ doTest1("Java #5", "A = \"B\\\"C\"+D;", "A@ = \"B\\\"C\"@+D;"); >+ doTest1("Java #6", "A = /*B+C*/ D;", "A@ = /*B+C@*/ D;"); >+ doTest1("Java #7", "A = /*B+C* D;", "A@ = /*B+C* D;"); >+ doTest1("Java #8", "X+Y+Z */ B; ", "X+Y+Z @*/ B; "); >+ doTest1("Java #9", "A = //B+C* D;", "A@ = //B+C* D;"); >+ doTest1("Java #10", "A = //B+C`|D+E;", "A@ = //B+C`|D@+E;"); >+ >+ type = IBidiComplexExpressionTypes.PROPERTY; >+ state[0] = BidiComplexEngine.STATE_INITIAL; >+ doTest1("Property #0", "NAME,VAL1,VAL2", "NAME,VAL1,VAL2"); >+ doTest1("Property #1", "NAME=VAL1,VAL2", "NAME@=VAL1,VAL2"); >+ doTest1("Property #2", "NAME=VAL1,VAL2=VAL3", "NAME@=VAL1,VAL2=VAL3"); > > String data; >- helper = new BidiComplexHelper(IBidiComplexExpressionTypes.REGEXP); >- assertNotNull(helper); >- state = BidiComplexHelper.STATE_NOTHING_GOING; >+ type = IBidiComplexExpressionTypes.REGEXP; >+ state[0] = BidiComplexEngine.STATE_INITIAL; > data = toUT16("ABC(?") + "#" + toUT16("DEF)GHI"); >- doTest2(helper, "Regex #0.0", data, "A@B@C@(?#DEF)@G@H@I"); >+ doTest2("Regex #0.0", data, "A@B@C@(?#DEF)@G@H@I"); > data = toUT16("ABC(?") + "#" + toUT16("DEF"); >- doTest2(helper, "Regex #0.1", data, "A@B@C@(?#DEF"); >- doTest1(helper, "Regex #0.2", "GHI)JKL", "GHI)@J@K@L"); >+ doTest2("Regex #0.1", data, "A@B@C@(?#DEF"); >+ doTest1("Regex #0.2", "GHI)JKL", "GHI)@J@K@L"); > data = toUT16("ABC(?") + "<" + toUT16("DEF") + ">" + toUT16("GHI"); >- doTest2(helper, "Regex #1", data, "A@B@C@(?<DEF>@G@H@I"); >- doTest1(helper, "Regex #2.0", "ABC(?'DEF'GHI", "A@B@C@(?'DEF'@G@H@I"); >- doTest1(helper, "Regex #2.1", "ABC(?'DEFGHI", "A@B@C@(?'DEFGHI"); >+ doTest2("Regex #1", data, "A@B@C@(?<DEF>@G@H@I"); >+ doTest1("Regex #2.0", "ABC(?'DEF'GHI", "A@B@C@(?'DEF'@G@H@I"); >+ doTest1("Regex #2.1", "ABC(?'DEFGHI", "A@B@C@(?'DEFGHI"); > data = toUT16("ABC(?(") + "<" + toUT16("DEF") + ">" + toUT16(")GHI"); >- doTest2(helper, "Regex #3", data, "A@B@C@(?(<DEF>)@G@H@I"); >- doTest1(helper, "Regex #4", "ABC(?('DEF')GHI", "A@B@C@(?('DEF')@G@H@I"); >- doTest1(helper, "Regex #5", "ABC(?(DEF)GHI", "A@B@C@(?(DEF)@G@H@I"); >+ doTest2("Regex #3", data, "A@B@C@(?(<DEF>)@G@H@I"); >+ doTest1("Regex #4", "ABC(?('DEF')GHI", "A@B@C@(?('DEF')@G@H@I"); >+ doTest1("Regex #5", "ABC(?(DEF)GHI", "A@B@C@(?(DEF)@G@H@I"); > data = toUT16("ABC(?") + "&" + toUT16("DEF)GHI"); >- doTest2(helper, "Regex #6", data, "A@B@C@(?&DEF)@G@H@I"); >+ doTest2("Regex #6", data, "A@B@C@(?&DEF)@G@H@I"); > data = toUT16("ABC(?") + "P<" + toUT16("DEF") + ">" + toUT16("GHI"); >- doTest2(helper, "Regex #7", data, "A@B@C(?p<DEF>@G@H@I"); >+ doTest2("Regex #7", data, "A@B@C(?p<DEF>@G@H@I"); > data = toUT16("ABC\\k") + "<" + toUT16("DEF") + ">" + toUT16("GHI"); >- doTest2(helper, "Regex #8", data, "A@B@C\\k<DEF>@G@H@I"); >- doTest1(helper, "Regex #9", "ABC\\k'DEF'GHI", "A@B@C\\k'DEF'@G@H@I"); >- doTest1(helper, "Regex #10", "ABC\\k{DEF}GHI", "A@B@C\\k{DEF}@G@H@I"); >+ doTest2("Regex #8", data, "A@B@C\\k<DEF>@G@H@I"); >+ doTest1("Regex #9", "ABC\\k'DEF'GHI", "A@B@C\\k'DEF'@G@H@I"); >+ doTest1("Regex #10", "ABC\\k{DEF}GHI", "A@B@C\\k{DEF}@G@H@I"); > data = toUT16("ABC(?") + "P=" + toUT16("DEF)GHI"); >- doTest2(helper, "Regex #11", data, "A@B@C(?p=DEF)@G@H@I"); >- doTest1(helper, "Regex #12", "ABC\\g{DEF}GHI", "A@B@C\\g{DEF}@G@H@I"); >+ doTest2("Regex #11", data, "A@B@C(?p=DEF)@G@H@I"); >+ doTest1("Regex #12", "ABC\\g{DEF}GHI", "A@B@C\\g{DEF}@G@H@I"); > data = toUT16("ABC\\g") + "<" + toUT16("DEF") + ">" + toUT16("GHI"); >- doTest2(helper, "Regex #13", data, "A@B@C\\g<DEF>@G@H@I"); >- doTest1(helper, "Regex #14", "ABC\\g'DEF'GHI", "A@B@C\\g'DEF'@G@H@I"); >+ doTest2("Regex #13", data, "A@B@C\\g<DEF>@G@H@I"); >+ doTest1("Regex #14", "ABC\\g'DEF'GHI", "A@B@C\\g'DEF'@G@H@I"); > data = toUT16("ABC(?(") + "R&" + toUT16("DEF)GHI"); >- doTest2(helper, "Regex #15", data, "A@B@C(?(r&DEF)@G@H@I"); >+ doTest2("Regex #15", data, "A@B@C(?(r&DEF)@G@H@I"); > data = toUT16("ABC") + "\\Q" + toUT16("DEF") + "\\E" + toUT16("GHI"); >- doTest2(helper, "Regex #16.0", data, "A@B@C\\qDEF\\eG@H@I"); >+ doTest2("Regex #16.0", data, "A@B@C\\qDEF\\eG@H@I"); > data = toUT16("ABC") + "\\Q" + toUT16("DEF"); >- doTest2(helper, "Regex #16.1", data, "A@B@C\\qDEF"); >+ doTest2("Regex #16.1", data, "A@B@C\\qDEF"); > data = toUT16("GHI") + "\\E" + toUT16("JKL"); >- doTest2(helper, "Regex #16.2", data, "GHI\\eJ@K@L"); >- doTest1(helper, "Regex #17.0", "abc[d-h]ijk", "abc[d-h]ijk"); >- doTest1(helper, "Regex #17.1", "aBc[d-H]iJk", "aBc[d-H]iJk"); >- doTest1(helper, "Regex #17.2", "aB*[!-H]iJ2", "aB*[!-@H]iJ@2"); >- doTest1(helper, "Regex #17.3", "aB*[1-2]J3", "aB*[@1-2]J@3"); >- doTest1(helper, "Regex #17.4", "aB*[5-6]J3", "aB*[@5-@6]@J@3"); >- doTest1(helper, "Regex #17.5", "a*[5-6]J3", "a*[5-@6]@J@3"); >- doTest1(helper, "Regex #17.6", "aB*123", "aB*@123"); >- doTest1(helper, "Regex #17.7", "aB*567", "aB*@567"); >- >- helper = new BidiComplexHelper(IBidiComplexExpressionTypes.SQL); >- assertNotNull(helper); >- state = BidiComplexHelper.STATE_NOTHING_GOING; >- doTest1(helper, "SQL #0", "abc GHI", "abc GHI"); >- doTest1(helper, "SQL #1", "abc DEF GHI", "abc DEF@ GHI"); >- doTest1(helper, "SQL #2", "ABC, DEF, GHI", "ABC@, DEF@, GHI"); >- doTest1(helper, "SQL #3", "ABC'DEF GHI' JKL,MN", "ABC@'DEF GHI'@ JKL@,MN"); >- doTest1(helper, "SQL #4.0", "ABC'DEF GHI JKL", "ABC@'DEF GHI JKL"); >- doTest1(helper, "SQL #4.1", "MNO PQ' RS,TUV", "MNO PQ'@ RS@,TUV"); >- doTest1(helper, "SQL #5", "ABC\"DEF GHI\" JKL,MN", "ABC@\"DEF GHI\"@ JKL@,MN"); >- doTest1(helper, "SQL #6", "ABC\"DEF GHI JKL", "ABC@\"DEF GHI JKL"); >- doTest1(helper, "SQL #7", "ABC/*DEF GHI*/ JKL,MN", "ABC@/*DEF GHI@*/ JKL@,MN"); >- doTest1(helper, "SQL #8.0", "ABC/*DEF GHI JKL", "ABC@/*DEF GHI JKL"); >- doTest1(helper, "SQL #8.1", "MNO PQ*/RS,TUV", "MNO PQ@*/RS@,TUV"); >- doTest1(helper, "SQL #9", "ABC--DEF GHI JKL", "ABC@--DEF GHI JKL"); >- doTest1(helper, "SQL #10", "ABC--DEF--GHI,JKL", "ABC@--DEF--GHI,JKL"); >- doTest1(helper, "SQL #11", "ABC'DEF '' G I' JKL,MN", "ABC@'DEF '' G I'@ JKL@,MN"); >- doTest1(helper, "SQL #12", "ABC\"DEF \"\" G I\" JKL,MN", "ABC@\"DEF \"\" G I\"@ JKL@,MN"); >- doTest1(helper, "SQL #13", "ABC--DEF GHI`|JKL MN", "ABC@--DEF GHI`|JKL@ MN"); >- >- helper = new BidiComplexHelper(IBidiComplexExpressionTypes.SYSTEM_USER); >- assertNotNull(helper); >- state = BidiComplexHelper.STATE_NOTHING_GOING; >- doTest1(helper, "System #1", "HOST(JACK)", "HOST@(JACK)"); >- >- helper = new BidiComplexHelper(IBidiComplexExpressionTypes.UNDERSCORE); >- assertNotNull(helper); >- state = BidiComplexHelper.STATE_NOTHING_GOING; >- doTest1(helper, "Underscore #1", "A_B_C_d_e_F_G", "A@_B@_C_d_e_F@_G"); >- >- helper = new BidiComplexHelper(IBidiComplexExpressionTypes.URL); >- assertNotNull(helper); >- state = BidiComplexHelper.STATE_NOTHING_GOING; >- doTest1(helper, "URL #1", "WWW.DOMAIN.COM/DIR1/DIR2/dir3/DIR4", "WWW@.DOMAIN@.COM@/DIR1@/DIR2/dir3/DIR4"); >- >- helper = new BidiComplexHelper(IBidiComplexExpressionTypes.XPATH); >- assertNotNull(helper); >- state = BidiComplexHelper.STATE_NOTHING_GOING; >- doTest1(helper, "Xpath #1", "abc(DEF)GHI", "abc(DEF@)GHI"); >- doTest1(helper, "Xpath #2", "DEF.GHI \"A.B\":JK ", "DEF@.GHI@ \"A.B\"@:JK "); >- doTest1(helper, "Xpath #3", "DEF!GHI 'A!B'=JK ", "DEF@!GHI@ 'A!B'@=JK "); >- doTest1(helper, "Xpath #4", "DEF.GHI 'A.B :JK ", "DEF@.GHI@ 'A.B :JK "); >- >- helper = new BidiComplexHelper(IBidiComplexExpressionTypes.EMAIL); >- state = BidiComplexHelper.STATE_NOTHING_GOING; >- BidiComplexFeatures f1 = helper.getFeatures(); >- assertEquals("<>.:,;@", f1.operators); >- BidiComplexFeatures f2 = new BidiComplexFeatures("+-*/", f1.specialsCount, f1.dirArabic, f1.dirHebrew, f1.ignoreArabic, f1.ignoreHebrew); >- helper.setFeatures(f2); >- doTest1(helper, "DelimsEsc #1", "abc+DEF-GHI", "abc+DEF@-GHI"); >- doTest1(helper, "DelimsEsc #2", "DEF-GHI (A*B)/JK ", "DEF@-GHI @(A*B)@/JK "); >- doTest1(helper, "DelimsEsc #3", "DEF-GHI (A*B)/JK ", "DEF@-GHI @(A*B)@/JK "); >- doTest1(helper, "DelimsEsc #4", "DEF-GHI (A*B\\)*C) /JK ", "DEF@-GHI @(A*B\\)*C) @/JK "); >- doTest1(helper, "DelimsEsc #5", "DEF-GHI (A\\\\\\)*C) /JK ", "DEF@-GHI @(A\\\\\\)*C) @/JK "); >- doTest1(helper, "DelimsEsc #6", "DEF-GHI (A\\\\)*C /JK ", "DEF@-GHI @(A\\\\)@*C @/JK "); >- doTest1(helper, "DelimsEsc #7", "DEF-GHI (A\\)*C /JK ", "DEF@-GHI @(A\\)*C /JK "); >+ doTest2("Regex #16.2", data, "GHI\\eJ@K@L"); >+ doTest1("Regex #17.0", "abc[d-h]ijk", "abc[d-h]ijk"); >+ doTest1("Regex #17.1", "aBc[d-H]iJk", "aBc[d-H]iJk"); >+ doTest1("Regex #17.2", "aB*[!-H]iJ2", "aB*[!-@H]iJ@2"); >+ doTest1("Regex #17.3", "aB*[1-2]J3", "aB*[@1-2]J@3"); >+ doTest1("Regex #17.4", "aB*[5-6]J3", "aB*[@5-@6]@J@3"); >+ doTest1("Regex #17.5", "a*[5-6]J3", "a*[5-@6]@J@3"); >+ doTest1("Regex #17.6", "aB*123", "aB*@123"); >+ doTest1("Regex #17.7", "aB*567", "aB*@567"); >+ >+ type = IBidiComplexExpressionTypes.SQL; >+ state[0] = BidiComplexEngine.STATE_INITIAL; >+ doTest1("SQL #0", "abc GHI", "abc GHI"); >+ doTest1("SQL #1", "abc DEF GHI", "abc DEF@ GHI"); >+ doTest1("SQL #2", "ABC, DEF, GHI", "ABC@, DEF@, GHI"); >+ doTest1("SQL #3", "ABC'DEF GHI' JKL,MN", "ABC@'DEF GHI'@ JKL@,MN"); >+ doTest1("SQL #4.0", "ABC'DEF GHI JKL", "ABC@'DEF GHI JKL"); >+ doTest1("SQL #4.1", "MNO PQ' RS,TUV", "MNO PQ'@ RS@,TUV"); >+ doTest1("SQL #5", "ABC\"DEF GHI\" JKL,MN", "ABC@\"DEF GHI\"@ JKL@,MN"); >+ doTest1("SQL #6", "ABC\"DEF GHI JKL", "ABC@\"DEF GHI JKL"); >+ doTest1("SQL #7", "ABC/*DEF GHI*/ JKL,MN", "ABC@/*DEF GHI@*/ JKL@,MN"); >+ doTest1("SQL #8.0", "ABC/*DEF GHI JKL", "ABC@/*DEF GHI JKL"); >+ doTest1("SQL #8.1", "MNO PQ*/RS,TUV", "MNO PQ@*/RS@,TUV"); >+ doTest1("SQL #9", "ABC--DEF GHI JKL", "ABC@--DEF GHI JKL"); >+ doTest1("SQL #10", "ABC--DEF--GHI,JKL", "ABC@--DEF--GHI,JKL"); >+ doTest1("SQL #11", "ABC'DEF '' G I' JKL,MN", "ABC@'DEF '' G I'@ JKL@,MN"); >+ doTest1("SQL #12", "ABC\"DEF \"\" G I\" JKL,MN", "ABC@\"DEF \"\" G I\"@ JKL@,MN"); >+ doTest1("SQL #13", "ABC--DEF GHI`|JKL MN", "ABC@--DEF GHI`|JKL@ MN"); >+ >+ type = IBidiComplexExpressionTypes.SYSTEM_USER; >+ state[0] = BidiComplexEngine.STATE_INITIAL; >+ doTest1("System #1", "HOST(JACK)", "HOST@(JACK)"); >+ >+ type = IBidiComplexExpressionTypes.UNDERSCORE; >+ state[0] = BidiComplexEngine.STATE_INITIAL; >+ doTest1("Underscore #1", "A_B_C_d_e_F_G", "A@_B@_C_d_e_F@_G"); >+ >+ type = IBidiComplexExpressionTypes.URL; >+ state[0] = BidiComplexEngine.STATE_INITIAL; >+ doTest1("URL #1", "WWW.DOMAIN.COM/DIR1/DIR2/dir3/DIR4", "WWW@.DOMAIN@.COM@/DIR1@/DIR2/dir3/DIR4"); >+ >+ type = IBidiComplexExpressionTypes.XPATH; >+ state[0] = BidiComplexEngine.STATE_INITIAL; >+ doTest1("Xpath #1", "abc(DEF)GHI", "abc(DEF@)GHI"); >+ doTest1("Xpath #2", "DEF.GHI \"A.B\":JK ", "DEF@.GHI@ \"A.B\"@:JK "); >+ doTest1("Xpath #3", "DEF!GHI 'A!B'=JK ", "DEF@!GHI@ 'A!B'@=JK "); >+ doTest1("Xpath #4", "DEF.GHI 'A.B :JK ", "DEF@.GHI@ 'A.B :JK "); >+ >+ type = IBidiComplexExpressionTypes.EMAIL; >+ processor = BidiComplexStringProcessor.getProcessor(type); >+ state[0] = BidiComplexEngine.STATE_INITIAL; >+ f1 = processor.getFeatures(null); >+ assertEquals("<>.:,;@", f1.getOperators()); >+ f2 = new BidiComplexFeatures("+-*/", f1.getSpecialsCount(), f1.getDirArabic(), f1.getDirHebrew(), f1.getIgnoreArabic(), f1.getIgnoreHebrew()); >+ doTest3("DelimsEsc #1", "abc+DEF-GHI", "abc+DEF@-GHI"); >+ doTest3("DelimsEsc #2", "DEF-GHI (A*B)/JK ", "DEF@-GHI @(A*B)@/JK "); >+ doTest3("DelimsEsc #3", "DEF-GHI (A*B)/JK ", "DEF@-GHI @(A*B)@/JK "); >+ doTest3("DelimsEsc #4", "DEF-GHI (A*B\\)*C) /JK ", "DEF@-GHI @(A*B\\)*C) @/JK "); >+ doTest3("DelimsEsc #5", "DEF-GHI (A\\\\\\)*C) /JK ", "DEF@-GHI @(A\\\\\\)*C) @/JK "); >+ doTest3("DelimsEsc #6", "DEF-GHI (A\\\\)*C /JK ", "DEF@-GHI @(A\\\\)@*C @/JK "); >+ doTest3("DelimsEsc #7", "DEF-GHI (A\\)*C /JK ", "DEF@-GHI @(A\\)*C /JK "); > } > } >Index: src/org/eclipse/equinox/bidi/internal/tests/BidiComplexFullToLeanTest.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/components/bundles/org.eclipse.equinox.bidi.tests/src/org/eclipse/equinox/bidi/internal/tests/BidiComplexFullToLeanTest.java,v >retrieving revision 1.1 >diff -u -r1.1 BidiComplexFullToLeanTest.java >--- src/org/eclipse/equinox/bidi/internal/tests/BidiComplexFullToLeanTest.java 9 Feb 2011 21:28:56 -0000 1.1 >+++ src/org/eclipse/equinox/bidi/internal/tests/BidiComplexFullToLeanTest.java 26 Apr 2011 07:02:41 -0000 >@@ -20,141 +20,228 @@ > public class BidiComplexFullToLeanTest extends BidiComplexTestBase { > > static final BidiComplexEnvironment envLTR = new BidiComplexEnvironment(null, false, BidiComplexEnvironment.ORIENT_LTR); >- > static final BidiComplexEnvironment envRTL = new BidiComplexEnvironment(null, false, BidiComplexEnvironment.ORIENT_RTL); > >- private BidiComplexHelper helper; >- >- protected void setUp() throws Exception { >- super.setUp(); >- helper = new BidiComplexHelper(IBidiComplexExpressionTypes.COMMA_DELIMITED); >- } >- >- static int[] getpos(BidiComplexHelper complexp, boolean leanToFull) { >- int[] pos = new int[5]; >+ String type; > >- if (leanToFull) { >- pos[0] = complexp.leanToFullPos(0); >- pos[1] = complexp.leanToFullPos(4); >- pos[2] = complexp.leanToFullPos(7); >- pos[3] = complexp.leanToFullPos(10); >- pos[4] = complexp.leanToFullPos(30); >- } else { >- pos[0] = complexp.fullToLeanPos(0); >- pos[1] = complexp.fullToLeanPos(4); >- pos[2] = complexp.fullToLeanPos(7); >- pos[3] = complexp.fullToLeanPos(10); >- pos[4] = complexp.fullToLeanPos(30); >- } >- return pos; >- } >- >- private void doTest1(String msg, String data, String leanLTR, String fullLTR, int[] l2fPosLTR, int[] f2lPosLTR, String leanRTL, String fullRTL, int[] l2fPosRTL, int[] f2lPosRTL) { >+ private void doTest1(String msg, String data, String leanLTR, String fullLTR, int[] l2fMapLTR, int[] f2lMapLTR, String leanRTL, String fullRTL, int[] l2fMapRTL, int[] f2lMapRTL) { > String text, full, lean, label; >- int[] pos; >+ int[] map; > > text = toUT16(data); >- helper.setEnvironment(envLTR); >- lean = helper.fullToLeanText(text); >+ lean = BidiComplexEngine.fullToLeanText(type, null, envLTR, text, null); > assertEquals(msg + "LTR lean", leanLTR, toPseudo(lean)); >- full = helper.leanToFullText(lean); >+ full = BidiComplexEngine.leanToFullText(type, null, envLTR, lean, null); > assertEquals(msg + "LTR full", fullLTR, toPseudo(full)); >- pos = getpos(helper, true); >- label = msg + "leanToFullPos() LTR, expected=" + array_display(l2fPosLTR) + " result=" + array_display(pos); >- assertTrue(label, arrays_equal(l2fPosLTR, pos)); >- pos = getpos(helper, false); >- label = msg + "fullToLeanPos() LTR, expected=" + array_display(f2lPosLTR) + " result=" + array_display(pos); >- assertTrue(label, arrays_equal(f2lPosLTR, pos)); >- helper.setEnvironment(envRTL); >- lean = helper.fullToLeanText(text); >+ map = BidiComplexEngine.leanToFullMap(type, null, envLTR, lean, null); >+ label = msg + "leanToFullMap() LTR"; >+ assertEquals(label, array_display(l2fMapLTR), array_display(map)); >+ map = BidiComplexEngine.fullToLeanMap(type, null, envLTR, text, null); >+ label = msg + "fullToLeanMap() LTR"; >+ assertEquals(label, array_display(f2lMapLTR), array_display(map)); >+ >+ lean = BidiComplexEngine.fullToLeanText(type, null, envRTL, text, null); > assertEquals(msg + "RTL lean", leanRTL, toPseudo(lean)); >- full = helper.leanToFullText(lean); >+ full = BidiComplexEngine.leanToFullText(type, null, envRTL, lean, null); > assertEquals(msg + "RTL full", fullRTL, toPseudo(full)); >- pos = getpos(helper, true); >- label = msg + "leanToFullPos() RTL, expected=" + array_display(l2fPosRTL) + " result=" + array_display(pos); >- assertTrue(label, arrays_equal(l2fPosRTL, pos)); >- pos = getpos(helper, false); >- label = msg + "fullToLeanPos() RTL, expected=" + array_display(f2lPosRTL) + " result=" + array_display(pos); >- assertTrue(label, arrays_equal(f2lPosRTL, pos)); >+ map = BidiComplexEngine.leanToFullMap(type, null, envRTL, lean, null); >+ label = msg + "leanToFullMap() RTL"; >+ assertEquals(label, array_display(l2fMapRTL), array_display(map)); >+ map = BidiComplexEngine.fullToLeanMap(type, null, envRTL, text, null); >+ label = msg + "fullToLeanMap() RTL"; >+ assertEquals(label, array_display(f2lMapRTL), array_display(map)); > } > > private void doTest2(String msg) { > String text, data, full, lean, model; >- int state, state2, state3; >+ int[] state = new int[1]; >+ int state1, state2, state3; > >- helper = new BidiComplexHelper(IBidiComplexExpressionTypes.SQL); >- helper.setEnvironment(envLTR); > data = "update \"AB_CDE\" set \"COL1\"@='01', \"COL2\"@='02' /* GH IJK"; > text = toUT16(data); >- lean = helper.fullToLeanText(text); >- state = helper.getFinalState(); >+ state[0] = -1; >+ lean = BidiComplexEngine.fullToLeanText(type, null, envLTR, text, state); >+ state1 = state[0]; > model = "update \"AB_CDE\" set \"COL1\"='01', \"COL2\"='02' /* GH IJK"; > assertEquals(msg + "LTR lean", model, toPseudo(lean)); >- full = helper.leanToFullText(lean); >+ state[0] = -1; >+ full = BidiComplexEngine.leanToFullText(type, null, envLTR, lean, state); > assertEquals(msg + "LTR full", data, toPseudo(full)); >- assertEquals(msg + "state from leanToFullText", helper.getFinalState(), state); >+ assertEquals(msg + "state from leanToFullText", state1, state[0]); > data = "THIS IS A COMMENT LINE"; > text = toUT16(data); >- lean = helper.fullToLeanText(text, state); >- state2 = helper.getFinalState(); >+ state[0] = state1; >+ lean = BidiComplexEngine.fullToLeanText(type, null, envLTR, text, state); >+ state2 = state[0]; > model = "THIS IS A COMMENT LINE"; > assertEquals(msg + "LTR lean2", model, toPseudo(lean)); >- full = helper.leanToFullText(lean, state); >+ state[0] = state1; >+ full = BidiComplexEngine.leanToFullText(type, null, envLTR, lean, state); > assertEquals(msg + "LTR full2", data, toPseudo(full)); >- assertEquals(msg + "state from leanToFullText2", helper.getFinalState(), state2); >+ assertEquals(msg + "state from leanToFullText2", state2, state[0]); > data = "SOME MORE */ where \"COL3\"@=123"; > text = toUT16(data); >- lean = helper.fullToLeanText(text, state2); >- state3 = helper.getFinalState(); >+ state[0] = state2; >+ lean = BidiComplexEngine.fullToLeanText(type, null, envLTR, text, state); >+ state3 = state[0]; > model = "SOME MORE */ where \"COL3\"=123"; > assertEquals(msg + "LTR lean3", model, toPseudo(lean)); >- full = helper.leanToFullText(lean, state2); >+ state[0] = state2; >+ full = BidiComplexEngine.leanToFullText(type, null, envLTR, lean, state); > assertEquals(msg + "LTR full3", data, toPseudo(full)); >- assertEquals(msg + "state from leanToFullText3", helper.getFinalState(), state3); >+ assertEquals(msg + "state from leanToFullText3", state3, state[0]); > } > > public void testFullToLean() { > >- doTest1("testFullToLean #1 - ", "", "", "", new int[] {0, 4, 7, 10, 30}, new int[] {0, 0, 0, 0, 0}, "", "", new int[] {0, 4, 7, 10, 30}, new int[] {0, 0, 0, 0, 0}); >- doTest1("testFullToLean #01 - ", "1.abc", "1.abc", "1.abc", new int[] {0, 4, 7, 10, 30}, new int[] {0, 4, 5, 5, 5}, "1.abc", ">@1.abc@^", new int[] {2, 6, 9, 12, 32}, new int[] {0, 2, 5, 5, 5}); >- doTest1("testFullToLean #02 - ", "2.abc,def", "2.abc,def", "2.abc,def", new int[] {0, 4, 7, 10, 30}, new int[] {0, 4, 7, 9, 9}, "2.abc,def", ">@2.abc,def@^", new int[] {2, 6, 9, 12, 32}, new int[] {0, 2, 5, 8, 9}); >- doTest1("testFullToLean #03 - ", "@a.3.bc,def", "a.3.bc,def", "a.3.bc,def", new int[] {0, 4, 7, 10, 30}, new int[] {0, 4, 7, 10, 10}, "a.3.bc,def", ">@a.3.bc,def@^", new int[] {2, 6, 9, 12, 32}, new int[] {0, 2, 5, 8, 10}); >- doTest1("testFullToLean #04 - ", "@@a.4.bc,def", "a.4.bc,def", "a.4.bc,def", new int[] {0, 4, 7, 10, 30}, new int[] {0, 4, 7, 10, 10}, "a.4.bc,def", ">@a.4.bc,def@^", new int[] {2, 6, 9, 12, 32}, new int[] {0, 2, 5, 8, 10}); >- doTest1("testFullToLean #05 - ", "@5.abc,def", "5.abc,def", "5.abc,def", new int[] {0, 4, 7, 10, 30}, new int[] {0, 4, 7, 9, 9}, "5.abc,def", ">@5.abc,def@^", new int[] {2, 6, 9, 12, 32}, new int[] {0, 2, 5, 8, 9}); >- doTest1("testFullToLean #06 - ", "@@6.abc,def", "6.abc,def", "6.abc,def", new int[] {0, 4, 7, 10, 30}, new int[] {0, 4, 7, 9, 9}, "6.abc,def", ">@6.abc,def@^", new int[] {2, 6, 9, 12, 32}, new int[] {0, 2, 5, 8, 9}); >- doTest1("testFullToLean #07 - ", "7abc,@def", "7abc,@def", "7abc,@def", new int[] {0, 4, 7, 10, 30}, new int[] {0, 4, 7, 9, 9}, "7abc,@def", ">@7abc,@def@^", new int[] {2, 6, 9, 12, 32}, new int[] {0, 2, 5, 8, 9}); >- doTest1("testFullToLean #08 - ", "8abc,@@def", "8abc,@def", "8abc,@def", new int[] {0, 4, 7, 10, 30}, new int[] {0, 4, 7, 9, 9}, "8abc,@def", ">@8abc,@def@^", new int[] {2, 6, 9, 12, 32}, new int[] {0, 2, 5, 8, 9}); >- doTest1("testFullToLean #09 - ", "9abc,def@", "9abc,def", "9abc,def", new int[] {0, 4, 7, 10, 30}, new int[] {0, 4, 7, 8, 8}, "9abc,def", ">@9abc,def@^", new int[] {2, 6, 9, 12, 32}, new int[] {0, 2, 5, 8, 8}); >- doTest1("testFullToLean #10 - ", "10abc,def@@", "10abc,def", "10abc,def", new int[] {0, 4, 7, 10, 30}, new int[] {0, 4, 7, 9, 9}, "10abc,def", ">@10abc,def@^", new int[] {2, 6, 9, 12, 32}, new int[] {0, 2, 5, 8, 9}); >- doTest1("testFullToLean #11 - ", "@a.11.bc,@def@", "a.11.bc,@def", "a.11.bc,@def", new int[] {0, 4, 7, 10, 30}, new int[] {0, 4, 7, 10, 12}, "a.11.bc,@def", ">@a.11.bc,@def@^", new int[] {2, 6, 9, 12, 32}, new int[] {0, 2, 5, 8, 12}); >- doTest1("testFullToLean #12 - ", "@@a.12.bc,@@def@@", "a.12.bc,@def", "a.12.bc,@def", new int[] {0, 4, 7, 10, 30}, new int[] {0, 4, 7, 10, 12}, "a.12.bc,@def", ">@a.12.bc,@def@^", new int[] {2, 6, 9, 12, 32}, new int[] {0, 2, 5, 8, 12}); >- doTest1("testFullToLean #13 - ", "13ABC", "13ABC", "13ABC", new int[] {0, 4, 7, 10, 30}, new int[] {0, 4, 5, 5, 5}, "13ABC", ">@13ABC@^", new int[] {2, 6, 9, 12, 32}, new int[] {0, 2, 5, 5, 5}); >- doTest1("testFullToLean #14 - ", "14ABC,DE", "14ABC,DE", "14ABC@,DE", new int[] {0, 4, 8, 11, 31}, new int[] {0, 4, 6, 8, 8}, "14ABC,DE", ">@14ABC@,DE@^", new int[] {2, 6, 10, 13, 33}, new int[] {0, 2, 5, 7, 8}); >- doTest1("testFullToLean #15 - ", "15ABC@,DE", "15ABC,DE", "15ABC@,DE", new int[] {0, 4, 8, 11, 31}, new int[] {0, 4, 6, 8, 8}, "15ABC,DE", ">@15ABC@,DE@^", new int[] {2, 6, 10, 13, 33}, new int[] {0, 2, 5, 7, 8}); >- doTest1("testFullToLean #16 - ", "16ABC@@,DE", "16ABC,DE", "16ABC@,DE", new int[] {0, 4, 8, 11, 31}, new int[] {0, 4, 6, 8, 8}, "16ABC,DE", ">@16ABC@,DE@^", new int[] {2, 6, 10, 13, 33}, new int[] {0, 2, 5, 7, 8}); >- doTest1("testFullToLean #17 - ", "17ABC,@@DE", "17ABC,@DE", "17ABC,@DE", new int[] {0, 4, 7, 10, 30}, new int[] {0, 4, 7, 9, 9}, "17ABC,@DE", ">@17ABC,@DE@^", new int[] {2, 6, 9, 12, 32}, new int[] {0, 2, 5, 8, 9}); >- doTest1("testFullToLean #18 - ", "18ABC,DE,FGH", "18ABC,DE,FGH", "18ABC@,DE@,FGH", new int[] {0, 4, 8, 12, 32}, new int[] {0, 4, 6, 8, 12}, "18ABC,DE,FGH", ">@18ABC@,DE@,FGH@^", new int[] {2, 6, 10, 14, 34}, new int[] {0, 2, 5, 7, 12}); >- doTest1("testFullToLean #19 - ", "19ABC@,DE@,FGH", "19ABC,DE,FGH", "19ABC@,DE@,FGH", new int[] {0, 4, 8, 12, 32}, new int[] {0, 4, 6, 8, 12}, "19ABC,DE,FGH", ">@19ABC@,DE@,FGH@^", new int[] {2, 6, 10, 14, 34}, new int[] {0, 2, 5, 7, 12}); >- doTest1("testFullToLean #20 - ", "20ABC,@DE,@FGH", "20ABC,@DE,@FGH", "20ABC,@DE,@FGH", new int[] {0, 4, 7, 10, 30}, new int[] {0, 4, 7, 10, 14}, "20ABC,@DE,@FGH", ">@20ABC,@DE,@FGH@^", new int[] {2, 6, 9, 12, 32}, new int[] {0, 2, 5, 8, 14}); >- doTest1("testFullToLean #21 - ", "21ABC@@,DE@@,FGH", "21ABC,DE,FGH", "21ABC@,DE@,FGH", new int[] {0, 4, 8, 12, 32}, new int[] {0, 4, 6, 8, 12}, "21ABC,DE,FGH", ">@21ABC@,DE@,FGH@^", new int[] {2, 6, 10, 14, 34}, new int[] {0, 2, 5, 7, 12}); >- doTest1("testFullToLean #22 - ", "22ABC,@@DE,@@FGH", "22ABC,@DE,@FGH", "22ABC,@DE,@FGH", new int[] {0, 4, 7, 10, 30}, new int[] {0, 4, 7, 10, 14}, "22ABC,@DE,@FGH", ">@22ABC,@DE,@FGH@^", new int[] {2, 6, 9, 12, 32}, new int[] {0, 2, 5, 8, 14}); >- doTest1("testFullToLean #23 - ", ">@23abc@^", "23abc", "23abc", new int[] {0, 4, 7, 10, 30}, new int[] {0, 4, 5, 5, 5}, "23abc", ">@23abc@^", new int[] {2, 6, 9, 12, 32}, new int[] {0, 2, 5, 5, 5}); >- doTest1("testFullToLean #24 - ", "24abc@^", "24abc", "24abc", new int[] {0, 4, 7, 10, 30}, new int[] {0, 4, 5, 5, 5}, "24abc", ">@24abc@^", new int[] {2, 6, 9, 12, 32}, new int[] {0, 2, 5, 5, 5}); >- doTest1("testFullToLean #25 - ", ">@25abc", "25abc", "25abc", new int[] {0, 4, 7, 10, 30}, new int[] {0, 4, 5, 5, 5}, "25abc", ">@25abc@^", new int[] {2, 6, 9, 12, 32}, new int[] {0, 2, 5, 5, 5}); >- doTest1("testFullToLean #26 - ", "26AB,CD@EF,GHI", "26AB,CD@EF,GHI", "26AB@,CD@EF@,GHI", new int[] {0, 5, 8, 12, 32}, new int[] {0, 4, 6, 9, 14}, "26AB,CD@EF,GHI", ">@26AB@,CD@EF@,GHI@^", new int[] {2, 7, 10, 14, 34}, new int[] {0, 2, 4, 7, 14}); >- doTest1("testFullToLean #27 - ", "27AB,CD@123ef,GHI", "27AB,CD@123ef,GHI", "27AB@,CD@123ef,GHI", new int[] {0, 5, 8, 11, 31}, new int[] {0, 4, 6, 9, 17}, "27AB,CD@123ef,GHI", ">@27AB@,CD@123ef,GHI@^", new int[] {2, 7, 10, 13, 33}, new int[] {0, 2, 4, 7, 17}); >- doTest1("testFullToLean #28 - ", ">28ABC@,DE@,FGH^", "28ABC,DE,FGH", "28ABC@,DE@,FGH", new int[] {0, 4, 8, 12, 32}, new int[] {0, 4, 6, 8, 12}, "28ABC,DE,FGH", ">@28ABC@,DE@,FGH@^", new int[] {2, 6, 10, 14, 34}, new int[] {0, 2, 5, 7, 12}); >- doTest1("testFullToLean #29 - ", ">>29ABC@,DE@,FGH^^", "29ABC,DE,FGH", "29ABC@,DE@,FGH", new int[] {0, 4, 8, 12, 32}, new int[] {0, 4, 6, 8, 12}, "29ABC,DE,FGH", ">@29ABC@,DE@,FGH@^", new int[] {2, 6, 10, 14, 34}, new int[] {0, 2, 5, 7, 12}); >- doTest1("testFullToLean #30 - ", ">30AB>C^@,DE@,FGH^", "30AB>C^,DE,FGH", "30AB>C^@,DE@,FGH", new int[] {0, 4, 8, 12, 32}, new int[] {0, 4, 7, 9, 14}, "30AB>C^,DE,FGH", ">@30AB>C^@,DE@,FGH@^", new int[] {2, 6, 10, 14, 34}, new int[] {0, 2, 5, 7, 14}); >- doTest1("testFullToLean #31 - ", ">31AB>C@,DE@,FGH^^", "31AB>C,DE,FGH", "31AB>C@,DE@,FGH", new int[] {0, 4, 8, 12, 32}, new int[] {0, 4, 6, 9, 13}, "31AB>C,DE,FGH", ">@31AB>C@,DE@,FGH@^", new int[] {2, 6, 10, 14, 34}, new int[] {0, 2, 5, 7, 13}); >- doTest1("testFullToLean #32 - ", ">@32ABC@,DE@,FGH@^", "32ABC,DE,FGH", "32ABC@,DE@,FGH", new int[] {0, 4, 8, 12, 32}, new int[] {0, 4, 6, 8, 12}, "32ABC,DE,FGH", ">@32ABC@,DE@,FGH@^", new int[] {2, 6, 10, 14, 34}, new int[] {0, 2, 5, 7, 12}); >- doTest1("testFullToLean #33 - ", "@33ABC@,DE@,FGH@^", "33ABC,DE,FGH", "33ABC@,DE@,FGH", new int[] {0, 4, 8, 12, 32}, new int[] {0, 4, 6, 8, 12}, "33ABC,DE,FGH", ">@33ABC@,DE@,FGH@^", new int[] {2, 6, 10, 14, 34}, new int[] {0, 2, 5, 7, 12}); >- doTest1("testFullToLean #34 - ", ">@34ABC@,DE@,FGH@", "34ABC,DE,FGH", "34ABC@,DE@,FGH", new int[] {0, 4, 8, 12, 32}, new int[] {0, 4, 6, 8, 12}, "34ABC,DE,FGH", ">@34ABC@,DE@,FGH@^", new int[] {2, 6, 10, 14, 34}, new int[] {0, 2, 5, 7, 12}); >- doTest1("testFullToLean #35 - ", "35ABC@@DE@@@GH@", "35ABC@DE@GH", "35ABC@DE@GH", new int[] {0, 4, 7, 10, 30}, new int[] {0, 4, 7, 10, 11}, "35ABC@DE@GH", ">@35ABC@DE@GH@^", new int[] {2, 6, 9, 12, 32}, new int[] {0, 2, 5, 8, 11}); >- doTest1("testFullToLean #36 - ", "36ABC@@DE@@@@@@", "36ABC@DE", "36ABC@DE", new int[] {0, 4, 7, 10, 30}, new int[] {0, 4, 7, 8, 8}, "36ABC@DE", ">@36ABC@DE@^", new int[] {2, 6, 9, 12, 32}, new int[] {0, 2, 5, 8, 8}); >- doTest1("testFullToLean #37 - ", ">>>@@@@@^^^", "", "", new int[] {0, 4, 7, 10, 30}, new int[] {0, 0, 0, 0, 0}, "", "", new int[] {0, 4, 7, 10, 30}, new int[] {0, 0, 0, 0, 0}); >+ type = IBidiComplexExpressionTypes.COMMA_DELIMITED; >+ doTest1("testFullToLean #1 - ", "", "", "", new int[0], new int[0], "", "", new int[0], new int[0]); >+ int[] map1 = new int[] {0, 1, 2, 3, 4}; >+ int[] map2 = new int[] {2, 3, 4, 5, 6}; >+ int[] map3; >+ doTest1("testFullToLean #01 - ", "1.abc", "1.abc", "1.abc", map1, map1, "1.abc", ">@1.abc@^", map2, map1); >+ map1 = new int[] {0, 1, 2, 3, 4, 5, 6, 7, 8}; >+ map2 = new int[] {2, 3, 4, 5, 6, 7, 8, 9, 10}; >+ doTest1("testFullToLean #02 - ", "2.abc,def", "2.abc,def", "2.abc,def", map1, map1, "2.abc,def", ">@2.abc,def@^", map2, map1); >+ map1 = new int[] {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; >+ map2 = new int[] {-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; >+ map3 = new int[] {2, 3, 4, 5, 6, 7, 8, 9, 10, 11}; >+ doTest1("testFullToLean #03 - ", "@a.3.bc,def", "a.3.bc,def", "a.3.bc,def", map1, map2, "a.3.bc,def", ">@a.3.bc,def@^", map3, map2); >+ map1 = new int[] {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; >+ map2 = new int[] {-1, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; >+ map3 = new int[] {2, 3, 4, 5, 6, 7, 8, 9, 10, 11}; >+ doTest1("testFullToLean #04 - ", "@@a.4.bc,def", "a.4.bc,def", "a.4.bc,def", map1, map2, "a.4.bc,def", ">@a.4.bc,def@^", map3, map2); >+ map1 = new int[] {0, 1, 2, 3, 4, 5, 6, 7, 8}; >+ map2 = new int[] {-1, 0, 1, 2, 3, 4, 5, 6, 7, 8}; >+ map3 = new int[] {2, 3, 4, 5, 6, 7, 8, 9, 10}; >+ doTest1("testFullToLean #05 - ", "@5.abc,def", "5.abc,def", "5.abc,def", map1, map2, "5.abc,def", ">@5.abc,def@^", map3, map2); >+ map1 = new int[] {0, 1, 2, 3, 4, 5, 6, 7, 8}; >+ map2 = new int[] {-1, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8}; >+ map3 = new int[] {2, 3, 4, 5, 6, 7, 8, 9, 10}; >+ doTest1("testFullToLean #06 - ", "@@6.abc,def", "6.abc,def", "6.abc,def", map1, map2, "6.abc,def", ">@6.abc,def@^", map3, map2); >+ map1 = new int[] {0, 1, 2, 3, 4, 5, 6, 7, 8}; >+ map2 = new int[] {2, 3, 4, 5, 6, 7, 8, 9, 10}; >+ doTest1("testFullToLean #07 - ", "7abc,@def", "7abc,@def", "7abc,@def", map1, map1, "7abc,@def", ">@7abc,@def@^", map2, map1); >+ map1 = new int[] {0, 1, 2, 3, 4, 5, 6, 7, 8}; >+ map2 = new int[] {0, 1, 2, 3, 4, 5, -1, 6, 7, 8}; >+ map3 = new int[] {2, 3, 4, 5, 6, 7, 8, 9, 10}; >+ doTest1("testFullToLean #08 - ", "8abc,@@def", "8abc,@def", "8abc,@def", map1, map2, "8abc,@def", ">@8abc,@def@^", map3, map2); >+ map1 = new int[] {0, 1, 2, 3, 4, 5, 6, 7}; >+ map2 = new int[] {0, 1, 2, 3, 4, 5, 6, 7, -1}; >+ map3 = new int[] {2, 3, 4, 5, 6, 7, 8, 9}; >+ doTest1("testFullToLean #09 - ", "9abc,def@", "9abc,def", "9abc,def", map1, map2, "9abc,def", ">@9abc,def@^", map3, map2); >+ map1 = new int[] {0, 1, 2, 3, 4, 5, 6, 7, 8}; >+ map2 = new int[] {0, 1, 2, 3, 4, 5, 6, 7, 8, -1, -1}; >+ map3 = new int[] {2, 3, 4, 5, 6, 7, 8, 9, 10}; >+ doTest1("testFullToLean #10 - ", "10abc,def@@", "10abc,def", "10abc,def", map1, map2, "10abc,def", ">@10abc,def@^", map3, map2); >+ map1 = new int[] {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}; >+ map2 = new int[] {-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, -1}; >+ map3 = new int[] {2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13}; >+ doTest1("testFullToLean #11 - ", "@a.11.bc,@def@", "a.11.bc,@def", "a.11.bc,@def", map1, map2, "a.11.bc,@def", ">@a.11.bc,@def@^", map3, map2); >+ map1 = new int[] {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}; >+ map2 = new int[] {-1, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, -1, 9, 10, 11, -1, -1}; >+ map3 = new int[] {2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13}; >+ doTest1("testFullToLean #12 - ", "@@a.12.bc,@@def@@", "a.12.bc,@def", "a.12.bc,@def", map1, map2, "a.12.bc,@def", ">@a.12.bc,@def@^", map3, map2); >+ map1 = new int[] {0, 1, 2, 3, 4}; >+ map2 = new int[] {2, 3, 4, 5, 6}; >+ doTest1("testFullToLean #13 - ", "13ABC", "13ABC", "13ABC", map1, map1, "13ABC", ">@13ABC@^", map2, map1); >+ map1 = new int[] {0, 1, 2, 3, 4, 6, 7, 8}; >+ map2 = new int[] {0, 1, 2, 3, 4, 5, 6, 7}; >+ map3 = new int[] {2, 3, 4, 5, 6, 8, 9, 10}; >+ doTest1("testFullToLean #14 - ", "14ABC,DE", "14ABC,DE", "14ABC@,DE", map1, map2, "14ABC,DE", ">@14ABC@,DE@^", map3, map2); >+ map1 = new int[] {0, 1, 2, 3, 4, 6, 7, 8}; >+ map2 = new int[] {0, 1, 2, 3, 4, -1, 5, 6, 7}; >+ map3 = new int[] {2, 3, 4, 5, 6, 8, 9, 10}; >+ doTest1("testFullToLean #15 - ", "15ABC@,DE", "15ABC,DE", "15ABC@,DE", map1, map2, "15ABC,DE", ">@15ABC@,DE@^", map3, map2); >+ map1 = new int[] {0, 1, 2, 3, 4, 6, 7, 8}; >+ map2 = new int[] {0, 1, 2, 3, 4, -1, -1, 5, 6, 7}; >+ map3 = new int[] {2, 3, 4, 5, 6, 8, 9, 10}; >+ doTest1("testFullToLean #16 - ", "16ABC@@,DE", "16ABC,DE", "16ABC@,DE", map1, map2, "16ABC,DE", ">@16ABC@,DE@^", map3, map2); >+ map1 = new int[] {0, 1, 2, 3, 4, 5, 6, 7, 8}; >+ map2 = new int[] {0, 1, 2, 3, 4, 5, 6, -1, 7, 8}; >+ map3 = new int[] {2, 3, 4, 5, 6, 7, 8, 9, 10}; >+ doTest1("testFullToLean #17 - ", "17ABC,@@DE", "17ABC,@DE", "17ABC,@DE", map1, map2, "17ABC,@DE", ">@17ABC,@DE@^", map3, map2); >+ map1 = new int[] {0, 1, 2, 3, 4, 6, 7, 8, 10, 11, 12, 13}; >+ map2 = new int[] {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}; >+ map3 = new int[] {2, 3, 4, 5, 6, 8, 9, 10, 12, 13, 14, 15}; >+ doTest1("testFullToLean #18 - ", "18ABC,DE,FGH", "18ABC,DE,FGH", "18ABC@,DE@,FGH", map1, map2, "18ABC,DE,FGH", ">@18ABC@,DE@,FGH@^", map3, map2); >+ map1 = new int[] {0, 1, 2, 3, 4, 6, 7, 8, 10, 11, 12, 13}; >+ map2 = new int[] {0, 1, 2, 3, 4, -1, 5, 6, 7, -1, 8, 9, 10, 11}; >+ map3 = new int[] {2, 3, 4, 5, 6, 8, 9, 10, 12, 13, 14, 15}; >+ doTest1("testFullToLean #19 - ", "19ABC@,DE@,FGH", "19ABC,DE,FGH", "19ABC@,DE@,FGH", map1, map2, "19ABC,DE,FGH", ">@19ABC@,DE@,FGH@^", map3, map2); >+ map1 = new int[] {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13}; >+ map2 = new int[] {2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}; >+ doTest1("testFullToLean #20 - ", "20ABC,@DE,@FGH", "20ABC,@DE,@FGH", "20ABC,@DE,@FGH", map1, map1, "20ABC,@DE,@FGH", ">@20ABC,@DE,@FGH@^", map2, map1); >+ map1 = new int[] {0, 1, 2, 3, 4, 6, 7, 8, 10, 11, 12, 13}; >+ map2 = new int[] {0, 1, 2, 3, 4, -1, -1, 5, 6, 7, -1, -1, 8, 9, 10, 11}; >+ map3 = new int[] {2, 3, 4, 5, 6, 8, 9, 10, 12, 13, 14, 15}; >+ doTest1("testFullToLean #21 - ", "21ABC@@,DE@@,FGH", "21ABC,DE,FGH", "21ABC@,DE@,FGH", map1, map2, "21ABC,DE,FGH", ">@21ABC@,DE@,FGH@^", map3, map2); >+ map1 = new int[] {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13}; >+ map2 = new int[] {0, 1, 2, 3, 4, 5, 6, -1, 7, 8, 9, 10, -1, 11, 12, 13}; >+ map3 = new int[] {2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}; >+ doTest1("testFullToLean #22 - ", "22ABC,@@DE,@@FGH", "22ABC,@DE,@FGH", "22ABC,@DE,@FGH", map1, map2, "22ABC,@DE,@FGH", ">@22ABC,@DE,@FGH@^", map3, map2); >+ map1 = new int[] {0, 1, 2, 3, 4}; >+ map2 = new int[] {-1, -1, 0, 1, 2, 3, 4, -1, -1}; >+ map3 = new int[] {2, 3, 4, 5, 6}; >+ doTest1("testFullToLean #23 - ", ">@23abc@^", "23abc", "23abc", map1, map2, "23abc", ">@23abc@^", map3, map2); >+ map1 = new int[] {0, 1, 2, 3, 4}; >+ map2 = new int[] {0, 1, 2, 3, 4, -1, -1}; >+ map3 = new int[] {2, 3, 4, 5, 6}; >+ doTest1("testFullToLean #24 - ", "24abc@^", "24abc", "24abc", map1, map2, "24abc", ">@24abc@^", map3, map2); >+ map1 = new int[] {0, 1, 2, 3, 4}; >+ map2 = new int[] {-1, -1, 0, 1, 2, 3, 4}; >+ map3 = new int[] {2, 3, 4, 5, 6}; >+ doTest1("testFullToLean #25 - ", ">@25abc", "25abc", "25abc", map1, map2, "25abc", ">@25abc@^", map3, map2); >+ map1 = new int[] {0, 1, 2, 3, 5, 6, 7, 8, 9, 10, 12, 13, 14, 15}; >+ map2 = new int[] {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13}; >+ map3 = new int[] {2, 3, 4, 5, 7, 8, 9, 10, 11, 12, 14, 15, 16, 17}; >+ doTest1("testFullToLean #26 - ", "26AB,CD@EF,GHI", "26AB,CD@EF,GHI", "26AB@,CD@EF@,GHI", map1, map2, "26AB,CD@EF,GHI", ">@26AB@,CD@EF@,GHI@^", map3, map2); >+ map1 = new int[] {0, 1, 2, 3, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17}; >+ map2 = new int[] {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; >+ map3 = new int[] {2, 3, 4, 5, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19}; >+ doTest1("testFullToLean #27 - ", "27AB,CD@123ef,GHI", "27AB,CD@123ef,GHI", "27AB@,CD@123ef,GHI", map1, map2, "27AB,CD@123ef,GHI", ">@27AB@,CD@123ef,GHI@^", map3, map2); >+ map1 = new int[] {0, 1, 2, 3, 4, 6, 7, 8, 10, 11, 12, 13}; >+ map2 = new int[] {-1, 0, 1, 2, 3, 4, -1, 5, 6, 7, -1, 8, 9, 10, 11, -1}; >+ map3 = new int[] {2, 3, 4, 5, 6, 8, 9, 10, 12, 13, 14, 15}; >+ doTest1("testFullToLean #28 - ", ">28ABC@,DE@,FGH^", "28ABC,DE,FGH", "28ABC@,DE@,FGH", map1, map2, "28ABC,DE,FGH", ">@28ABC@,DE@,FGH@^", map3, map2); >+ map1 = new int[] {0, 1, 2, 3, 4, 6, 7, 8, 10, 11, 12, 13}; >+ map2 = new int[] {-1, -1, 0, 1, 2, 3, 4, -1, 5, 6, 7, -1, 8, 9, 10, 11, -1, -1}; >+ map3 = new int[] {2, 3, 4, 5, 6, 8, 9, 10, 12, 13, 14, 15}; >+ doTest1("testFullToLean #29 - ", ">>29ABC@,DE@,FGH^^", "29ABC,DE,FGH", "29ABC@,DE@,FGH", map1, map2, "29ABC,DE,FGH", ">@29ABC@,DE@,FGH@^", map3, map2); >+ map1 = new int[] {0, 1, 2, 3, 4, 5, 6, 8, 9, 10, 12, 13, 14, 15}; >+ map2 = new int[] {-1, 0, 1, 2, 3, 4, 5, 6, -1, 7, 8, 9, -1, 10, 11, 12, 13, -1}; >+ map3 = new int[] {2, 3, 4, 5, 6, 7, 8, 10, 11, 12, 14, 15, 16, 17}; >+ doTest1("testFullToLean #30 - ", ">30AB>C^@,DE@,FGH^", "30AB>C^,DE,FGH", "30AB>C^@,DE@,FGH", map1, map2, "30AB>C^,DE,FGH", ">@30AB>C^@,DE@,FGH@^", map3, map2); >+ map1 = new int[] {0, 1, 2, 3, 4, 5, 7, 8, 9, 11, 12, 13, 14}; >+ map2 = new int[] {-1, 0, 1, 2, 3, 4, 5, -1, 6, 7, 8, -1, 9, 10, 11, 12, -1, -1}; >+ map3 = new int[] {2, 3, 4, 5, 6, 7, 9, 10, 11, 13, 14, 15, 16}; >+ doTest1("testFullToLean #31 - ", ">31AB>C@,DE@,FGH^^", "31AB>C,DE,FGH", "31AB>C@,DE@,FGH", map1, map2, "31AB>C,DE,FGH", ">@31AB>C@,DE@,FGH@^", map3, map2); >+ map1 = new int[] {0, 1, 2, 3, 4, 6, 7, 8, 10, 11, 12, 13}; >+ map2 = new int[] {-1, -1, 0, 1, 2, 3, 4, -1, 5, 6, 7, -1, 8, 9, 10, 11, -1, -1}; >+ map3 = new int[] {2, 3, 4, 5, 6, 8, 9, 10, 12, 13, 14, 15}; >+ doTest1("testFullToLean #32 - ", ">@32ABC@,DE@,FGH@^", "32ABC,DE,FGH", "32ABC@,DE@,FGH", map1, map2, "32ABC,DE,FGH", ">@32ABC@,DE@,FGH@^", map3, map2); >+ map1 = new int[] {0, 1, 2, 3, 4, 6, 7, 8, 10, 11, 12, 13}; >+ map2 = new int[] {-1, 0, 1, 2, 3, 4, -1, 5, 6, 7, -1, 8, 9, 10, 11, -1, -1}; >+ map3 = new int[] {2, 3, 4, 5, 6, 8, 9, 10, 12, 13, 14, 15}; >+ doTest1("testFullToLean #33 - ", "@33ABC@,DE@,FGH@^", "33ABC,DE,FGH", "33ABC@,DE@,FGH", map1, map2, "33ABC,DE,FGH", ">@33ABC@,DE@,FGH@^", map3, map2); >+ map1 = new int[] {0, 1, 2, 3, 4, 6, 7, 8, 10, 11, 12, 13}; >+ map2 = new int[] {-1, -1, 0, 1, 2, 3, 4, -1, 5, 6, 7, -1, 8, 9, 10, 11, -1}; >+ map3 = new int[] {2, 3, 4, 5, 6, 8, 9, 10, 12, 13, 14, 15}; >+ doTest1("testFullToLean #34 - ", ">@34ABC@,DE@,FGH@", "34ABC,DE,FGH", "34ABC@,DE@,FGH", map1, map2, "34ABC,DE,FGH", ">@34ABC@,DE@,FGH@^", map3, map2); >+ map1 = new int[] {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; >+ map2 = new int[] {0, 1, 2, 3, 4, 5, -1, 6, 7, 8, -1, -1, 9, 10, -1}; >+ map3 = new int[] {2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}; >+ doTest1("testFullToLean #35 - ", "35ABC@@DE@@@GH@", "35ABC@DE@GH", "35ABC@DE@GH", map1, map2, "35ABC@DE@GH", ">@35ABC@DE@GH@^", map3, map2); >+ map1 = new int[] {0, 1, 2, 3, 4, 5, 6, 7}; >+ map2 = new int[] {0, 1, 2, 3, 4, 5, -1, 6, 7, -1, -1, -1, -1, -1, -1}; >+ map3 = new int[] {2, 3, 4, 5, 6, 7, 8, 9}; >+ doTest1("testFullToLean #36 - ", "36ABC@@DE@@@@@@", "36ABC@DE", "36ABC@DE", map1, map2, "36ABC@DE", ">@36ABC@DE@^", map3, map2); >+ map1 = new int[0]; >+ map2 = new int[] {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}; >+ doTest1("testFullToLean #37 - ", ">>>@@@@@^^^", "", "", map1, map2, "", "", map1, map2); > > // test fullToLeanText with initial state >+ type = IBidiComplexExpressionTypes.SQL; > doTest2("testFullToLean #38 - "); > } > } >Index: src/org/eclipse/equinox/bidi/internal/tests/BidiComplexMathTest.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/components/bundles/org.eclipse.equinox.bidi.tests/src/org/eclipse/equinox/bidi/internal/tests/BidiComplexMathTest.java,v >retrieving revision 1.1 >diff -u -r1.1 BidiComplexMathTest.java >--- src/org/eclipse/equinox/bidi/internal/tests/BidiComplexMathTest.java 9 Feb 2011 21:28:56 -0000 1.1 >+++ src/org/eclipse/equinox/bidi/internal/tests/BidiComplexMathTest.java 26 Apr 2011 07:02:42 -0000 >@@ -19,24 +19,15 @@ > public class BidiComplexMathTest extends BidiComplexTestBase { > > static final BidiComplexEnvironment envLTR = new BidiComplexEnvironment(null, false, BidiComplexEnvironment.ORIENT_LTR); >- > static final BidiComplexEnvironment envRTL = new BidiComplexEnvironment(null, false, BidiComplexEnvironment.ORIENT_RTL); > >- private BidiComplexHelper helper; >- >- protected void setUp() throws Exception { >- super.setUp(); >- helper = new BidiComplexHelper(IBidiComplexExpressionTypes.RTL_ARITHMETIC); >- } >+ String type = IBidiComplexExpressionTypes.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); >+ String fullLTR = BidiComplexEngine.leanToFullText(type, null, envLTR, lean, null); > assertEquals(msg + " LTR - ", resLTR, toPseudo(fullLTR)); >- >- helper.setEnvironment(envRTL); >- String fullRTL = helper.leanToFullText(lean); >+ String fullRTL = BidiComplexEngine.leanToFullText(type, null, envRTL, lean, null); > assertEquals(msg + " RTL - ", resRTL, toPseudo(fullRTL)); > } > >Index: src/org/eclipse/equinox/bidi/internal/tests/BidiComplexMethodsTest.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/components/bundles/org.eclipse.equinox.bidi.tests/src/org/eclipse/equinox/bidi/internal/tests/BidiComplexMethodsTest.java,v >retrieving revision 1.1 >diff -u -r1.1 BidiComplexMethodsTest.java >--- src/org/eclipse/equinox/bidi/internal/tests/BidiComplexMethodsTest.java 9 Feb 2011 21:28:56 -0000 1.1 >+++ src/org/eclipse/equinox/bidi/internal/tests/BidiComplexMethodsTest.java 26 Apr 2011 07:02:42 -0000 >@@ -12,33 +12,24 @@ > package org.eclipse.equinox.bidi.internal.tests; > > import org.eclipse.equinox.bidi.*; >+import org.eclipse.equinox.bidi.custom.*; > > /** >- * Tests most public methods of BidiComplexHelper >+ * Tests most public methods of BidiComplexEngine > */ > > public class BidiComplexMethodsTest extends BidiComplexTestBase { > > final static int LTR = BidiComplexFeatures.DIR_LTR; >- > final static int RTL = BidiComplexFeatures.DIR_RTL; >- > final static BidiComplexEnvironment envLTR = new BidiComplexEnvironment(null, false, BidiComplexEnvironment.ORIENT_LTR); >- > final static BidiComplexEnvironment envRTL = new BidiComplexEnvironment(null, false, BidiComplexEnvironment.ORIENT_RTL); >- > final static BidiComplexEnvironment envRTLMIR = new BidiComplexEnvironment(null, true, BidiComplexEnvironment.ORIENT_RTL); >- > final static BidiComplexEnvironment envIGN = new BidiComplexEnvironment(null, false, BidiComplexEnvironment.ORIENT_IGNORE); >- > final static BidiComplexEnvironment envCLR = new BidiComplexEnvironment(null, false, BidiComplexEnvironment.ORIENT_CONTEXTUAL_LTR); >- > final static BidiComplexEnvironment envCRL = new BidiComplexEnvironment(null, false, BidiComplexEnvironment.ORIENT_CONTEXTUAL_RTL); >- > final static BidiComplexEnvironment envERR = new BidiComplexEnvironment(null, false, 9999); > >- BidiComplexHelper helper; >- > private void doTestTools() { > > // This method tests utility methods used by the JUnits >@@ -50,100 +41,78 @@ > text = toPseudo(data); > assertEquals("56789abcdefghijklmnopqrstuvwxyz~#@&><^|`", text); > >- int[] arrayA = new int[] {1, 2}; >- int[] arrayB = new int[] {3, 4, 5}; >- assertFalse(arrays_equal(arrayA, arrayB)); >- >- assertTrue(arrays_equal(arrayA, arrayA)); >- >- arrayB = new int[] {3, 4}; >- assertFalse(arrays_equal(arrayA, arrayB)); >- > text = array_display(null); > assertEquals("null", text); > } > > private void doTestState() { > String data, lean, full, model; >- int state; >- >+ int[] state = new int[1]; >+ state[0] = -1; >+ String type = IBidiComplexExpressionTypes.JAVA; > data = "A=B+C;/* D=E+F;"; > lean = toUT16(data); >- full = helper.leanToFullText(lean); >+ full = BidiComplexEngine.leanToFullText(type, null, null, lean, state); > 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); >+ full = BidiComplexEngine.leanToFullText(type, null, null, 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;"; >+ full = BidiComplexEngine.leanToFullText(type, null, null, lean, state); >+ model = "A=B+C;@*/ D@=E@+F;"; > assertEquals("full3", model, toPseudo(full)); > } > > private void doTestOrientation() { > int orient; >- >- helper = new BidiComplexHelper(IBidiComplexExpressionTypes.COMMA_DELIMITED); >- orient = helper.getEnvironment().orientation; >+ orient = BidiComplexEnvironment.DEFAULT.getOrientation(); > assertEquals("orient #1", BidiComplexEnvironment.ORIENT_LTR, orient); > >- helper.setEnvironment(envIGN); >- orient = helper.getEnvironment().orientation; >+ orient = envIGN.getOrientation(); > assertEquals("orient #2", BidiComplexEnvironment.ORIENT_IGNORE, orient); > >- helper.setEnvironment(envCRL); >- orient = helper.getEnvironment().orientation; >- helper.leanToFullText("--!**"); >+ orient = envCRL.getOrientation(); > assertEquals("orient #3", BidiComplexEnvironment.ORIENT_CONTEXTUAL_RTL, orient); > >- helper.setEnvironment(envERR); >- orient = helper.getEnvironment().orientation; >- helper.leanToFullText("--!**"); >+ orient = envERR.getOrientation(); > assertEquals("orient #4", BidiComplexEnvironment.ORIENT_UNKNOWN, orient); > } > > private void doTestOrient(BidiComplexFeatures f, String label, String data, String resLTR, String resRTL, String resCon) { > String full, lean; >+ String type = IBidiComplexExpressionTypes.COMMA_DELIMITED; > > lean = toUT16(data); >- helper.setEnvironment(envLTR); >- helper.setFeatures(f); >- full = helper.leanToFullText(lean); >+ full = BidiComplexEngine.leanToFullText(type, f, envLTR, lean, null); > assertEquals(label + "LTR full", resLTR, toPseudo(full)); >- helper.setEnvironment(envRTL); >- helper.setFeatures(f); >- full = helper.leanToFullText(lean); >+ full = BidiComplexEngine.leanToFullText(type, f, envRTL, lean, null); > assertEquals("label + RTL full", resRTL, toPseudo(full)); >- helper.setEnvironment(envCRL); >- helper.setFeatures(f); >- full = helper.leanToFullText(lean); >+ full = BidiComplexEngine.leanToFullText(type, f, envCRL, lean, null); > assertEquals(label + "CON full", resCon, toPseudo(full)); > } > >- private void doTestScripts() { >- BidiComplexFeatures f2, f1 = helper.getFeatures(); >+ private void doTestScripts(BidiComplexFeatures f1) { >+ BidiComplexFeatures f2; > boolean flag; >- flag = f1.ignoreArabic; >+ flag = f1.getIgnoreArabic(); > assertFalse("Ignores Arabic 1", flag); >- flag = f1.ignoreHebrew; >+ flag = f1.getIgnoreHebrew(); > assertFalse("Ignores Hebrew 1", flag); > >- f2 = new BidiComplexFeatures(f1.operators, 0, -1, -1, true, true); >- flag = f2.ignoreArabic; >+ f2 = new BidiComplexFeatures(f1.getOperators(), 0, -1, -1, true, true); >+ flag = f2.getIgnoreArabic(); > assertTrue("Ignores Arabic 2", flag); >- flag = f2.ignoreHebrew; >+ flag = f2.getIgnoreHebrew(); > assertTrue("Ignores Hebrew 2", flag); > doTestOrient(f2, "Scripts #1 ", "BCD,EF", "BCD,EF", ">@BCD,EF@^", "@BCD,EF"); >- f2 = new BidiComplexFeatures(f1.operators, 0, -1, -1, false, true); >- flag = f2.ignoreArabic; >+ f2 = new BidiComplexFeatures(f1.getOperators(), 0, -1, -1, false, true); >+ flag = f2.getIgnoreArabic(); > assertFalse("Ignores Arabic 3", flag); >- flag = f2.ignoreHebrew; >+ flag = f2.getIgnoreHebrew(); > 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"); >@@ -158,10 +127,10 @@ > 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 BidiComplexFeatures(f1.operators, 0, -1, -1, true, false); >- flag = f2.ignoreArabic; >+ f2 = new BidiComplexFeatures(f1.getOperators(), 0, -1, -1, true, false); >+ flag = f2.getIgnoreArabic(); > assertTrue("Ignores Arabic 4", flag); >- flag = f2.ignoreHebrew; >+ flag = f2.getIgnoreHebrew(); > 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"); >@@ -169,7 +138,7 @@ > doTestOrient(f2, "Scripts #17 ", "BCD,12", "BCD@,12", ">@BCD@,12@^", "@BCD@,12"); > doTestOrient(f2, "Scripts #18 ", "BCD,", "BCD,", ">@BCD,@^", "@BCD,"); > >- f2 = new BidiComplexFeatures(f1.operators, 0, -1, -1, false, false); >+ f2 = new BidiComplexFeatures(f1.getOperators(), 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@,#"); >@@ -180,186 +149,166 @@ > > private void doTestLeanOffsets() { > String lean, data, label; >- int state; >+ int[] state = new int[1]; >+ String type = IBidiComplexExpressionTypes.JAVA; > int[] offsets; > int[] model; > > data = "A=B+C;/* D=E+F;"; > lean = toUT16(data); >- helper.leanToFullText(lean); >- offsets = helper.leanBidiCharOffsets(); >+ state[0] = -1; >+ offsets = BidiComplexEngine.leanBidiCharOffsets(type, null, null, lean, state); > 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(); >+ label = "leanBidiCharOffsets() #1 "; >+ assertEquals(label, array_display(model), array_display(offsets)); > 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)); >+ offsets = BidiComplexEngine.leanBidiCharOffsets(type, null, null, lean, state); >+ model = new int[] {6, 10, 12}; >+ label = "leanBidiCharOffsets() #2 "; >+ assertEquals(label, array_display(model), array_display(offsets)); > } > > private void doTestFullOffsets(String label, String data, int[] resLTR, int[] resRTL, int[] resCon) { > String full, lean, msg; > int[] offsets; >+ String type = IBidiComplexExpressionTypes.COMMA_DELIMITED; > > 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)); >+ full = BidiComplexEngine.leanToFullText(type, null, envLTR, lean, null); >+ offsets = BidiComplexEngine.fullBidiCharOffsets(type, null, envLTR, full, null); >+ msg = label + "LTR "; >+ assertEquals(msg, array_display(resLTR), array_display(offsets)); >+ full = BidiComplexEngine.leanToFullText(type, null, envRTL, lean, null); >+ offsets = BidiComplexEngine.fullBidiCharOffsets(type, null, envRTL, full, null); >+ msg = label + "RTL "; >+ assertEquals(msg, array_display(resRTL), array_display(offsets)); >+ full = BidiComplexEngine.leanToFullText(type, null, envCLR, lean, null); >+ offsets = BidiComplexEngine.fullBidiCharOffsets(type, null, envCLR, full, null); >+ msg = label + "CON "; >+ assertEquals(msg, array_display(resCon), array_display(offsets)); > } > > private void doTestMirrored() { > boolean mirrored; >- >- helper = new BidiComplexHelper(IBidiComplexExpressionTypes.COMMA_DELIMITED); >- mirrored = helper.getEnvironment().mirrored; >+ mirrored = BidiComplexEnvironment.DEFAULT.getMirrored(); > assertFalse("mirrored #1", mirrored); > BidiComplexEnvironment env = new BidiComplexEnvironment(null, true, BidiComplexEnvironment.ORIENT_LTR); >- helper = new BidiComplexHelper(IBidiComplexExpressionTypes.COMMA_DELIMITED, env); >- mirrored = helper.getEnvironment().mirrored; >+ mirrored = env.getMirrored(); > assertTrue("mirrored #2", mirrored); > } > > private void doTestDirection() { > String data, lean, full, model, msg; >- >- helper = new BidiComplexHelper(IBidiComplexExpressionTypes.COMMA_DELIMITED); >- BidiComplexFeatures f1 = helper.getFeatures(); >+ IBidiComplexProcessor processor = BidiComplexStringProcessor.getProcessor(IBidiComplexExpressionTypes.COMMA_DELIMITED); >+ BidiComplexFeatures f1 = processor.getFeatures(null); > msg = "TestDirection #1"; >- assertTrue(msg, f1.dirArabic == LTR && f1.dirHebrew == LTR); >+ assertTrue(msg, f1.getDirArabic() == LTR && f1.getDirHebrew() == LTR); > >- BidiComplexFeatures f2 = new BidiComplexFeatures(f1.operators, 0, RTL, RTL, false, false); >- helper.setFeatures(f2); >- f1 = helper.getFeatures(); >+ BidiComplexFeatures f2 = new BidiComplexFeatures(f1.getOperators(), 0, RTL, RTL, false, false); >+ f1 = f2; > msg = "TestDirection #2"; >- assertTrue(msg, f1.dirArabic == RTL && f1.dirHebrew == RTL); >+ assertTrue(msg, f1.getDirArabic() == RTL && f1.getDirHebrew() == RTL); > > BidiComplexEnvironment environment = new BidiComplexEnvironment(null, false, BidiComplexEnvironment.ORIENT_LTR); >- helper = new BidiComplexHelper(IBidiComplexExpressionTypes.EMAIL, environment); >- f1 = helper.getFeatures(); >+ processor = BidiComplexStringProcessor.getProcessor(IBidiComplexExpressionTypes.EMAIL); >+ f1 = processor.getFeatures(environment); > msg = "TestDirection #3"; >- assertTrue(msg, f1.dirArabic == LTR && f1.dirHebrew == LTR); >+ assertTrue(msg, f1.getDirArabic() == LTR && f1.getDirHebrew() == LTR); > data = "#ABC.#DEF:HOST.com"; > lean = toUT16(data); >- full = helper.leanToFullText(lean); >+ full = BidiComplexEngine.leanToFullText(processor, null, environment, lean, null); > model = "#ABC@.#DEF@:HOST.com"; > assertEquals("TestDirection #9 full", model, toPseudo(full)); > > data = "ABC.DEF:HOST.com"; > lean = toUT16(data); >- full = helper.leanToFullText(lean); >+ full = BidiComplexEngine.leanToFullText(processor, null, environment, lean, null); > model = "ABC@.DEF@:HOST.com"; > assertEquals("TestDirection #10 full", model, toPseudo(full)); > > environment = new BidiComplexEnvironment(null, true, BidiComplexEnvironment.ORIENT_LTR); >- helper.setEnvironment(environment); >- f1 = helper.getFeatures(); >+ f1 = processor.getFeatures(environment); > msg = "TestDirection #10.5"; >- assertTrue(msg, f1.dirArabic == RTL && f1.dirHebrew == LTR); >+ assertTrue(msg, f1.getDirArabic() == RTL && f1.getDirHebrew() == LTR); > data = "#ABC.#DEF:HOST.com"; > lean = toUT16(data); >- full = helper.leanToFullText(lean); >+ full = BidiComplexEngine.leanToFullText(processor, null, environment, lean, null); > model = "<&#ABC.#DEF:HOST.com&^"; > assertEquals("TestDirection #11 full", model, toPseudo(full)); > > data = "#ABc.#DEF:HOSt.COM"; > lean = toUT16(data); >- full = helper.leanToFullText(lean); >+ full = BidiComplexEngine.leanToFullText(processor, null, environment, lean, null); > model = "<&#ABc.#DEF:HOSt.COM&^"; > assertEquals("TestDirection #12 full", model, toPseudo(full)); > > data = "#ABc.#DEF:HOSt."; > lean = toUT16(data); >- full = helper.leanToFullText(lean); >+ full = BidiComplexEngine.leanToFullText(processor, null, environment, lean, null); > model = "<&#ABc.#DEF:HOSt.&^"; > assertEquals("TestDirection #13 full", model, toPseudo(full)); > > data = "ABC.DEF:HOST.com"; > lean = toUT16(data); >- full = helper.leanToFullText(lean); >+ full = BidiComplexEngine.leanToFullText(processor, null, environment, lean, null); > model = "ABC@.DEF@:HOST.com"; > assertEquals("TestDirection #14 full", model, toPseudo(full)); > > data = "--.---:----"; > lean = toUT16(data); >- full = helper.leanToFullText(lean); >+ full = BidiComplexEngine.leanToFullText(processor, null, environment, lean, null); > model = "--.---:----"; > assertEquals("TestDirection #15 full", model, toPseudo(full)); > > data = "ABC.|DEF:HOST.com"; > lean = toUT16(data); >- full = helper.leanToFullText(lean); >+ full = BidiComplexEngine.leanToFullText(processor, null, environment, lean, null); > 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); >+ full = BidiComplexEngine.leanToFullText(processor, null, envRTLMIR, lean, null); > model = "#ABc.|#DEF:HOST.com"; > assertEquals("TestDirection #17 full", model, toPseudo(full)); >- assertEquals("Test curDirection", RTL, helper.getCurDirection()); >+ assertEquals("Test curDirection", RTL, BidiComplexEngine.getCurDirection(processor, null, envRTLMIR, lean)); > } > > public void testMethods() { > > doTestTools(); > >- helper = new BidiComplexHelper(IBidiComplexExpressionTypes.JAVA); > doTestState(); > > doTestOrientation(); > >- helper = new BidiComplexHelper(IBidiComplexExpressionTypes.COMMA_DELIMITED); >- BidiComplexFeatures 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"); >+ IBidiComplexProcessor processor = BidiComplexStringProcessor.getProcessor(IBidiComplexExpressionTypes.COMMA_DELIMITED); >+ BidiComplexFeatures f = processor.getFeatures(null); >+ doTestOrient(f, "Methods #1 ", "", "", "", ""); >+ doTestOrient(f, "Methods #2 ", "abc", "abc", ">@abc@^", "abc"); >+ doTestOrient(f, "Methods #3 ", "ABC", "ABC", ">@ABC@^", "@ABC"); >+ doTestOrient(f, "Methods #4 ", "bcd,ef", "bcd,ef", ">@bcd,ef@^", "bcd,ef"); >+ doTestOrient(f, "Methods #5 ", "BCD,EF", "BCD@,EF", ">@BCD@,EF@^", "@BCD@,EF"); >+ doTestOrient(f, "Methods #6 ", "cde,FG", "cde,FG", ">@cde,FG@^", "cde,FG"); >+ doTestOrient(f, "Methods #7 ", "CDE,fg", "CDE,fg", ">@CDE,fg@^", "@CDE,fg"); >+ doTestOrient(f, "Methods #8 ", "12..def,GH", "12..def,GH", ">@12..def,GH@^", "12..def,GH"); >+ doTestOrient(f, "Methods #9 ", "34..DEF,gh", "34..DEF,gh", ">@34..DEF,gh@^", "@34..DEF,gh"); > >- doTestScripts(); >+ doTestScripts(f); > >- helper = new BidiComplexHelper(IBidiComplexExpressionTypes.JAVA); > doTestLeanOffsets(); > >- helper = new BidiComplexHelper(IBidiComplexExpressionTypes.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 BidiComplexHelper(IBidiComplexExpressionTypes.COMMA_DELIMITED); >+ String type = IBidiComplexExpressionTypes.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 full = BidiComplexEngine.leanToFullText(type, null, null, lean, null); > 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/BidiComplexNullProcessorTest.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/components/bundles/org.eclipse.equinox.bidi.tests/src/org/eclipse/equinox/bidi/internal/tests/BidiComplexNullProcessorTest.java,v >retrieving revision 1.1 >diff -u -r1.1 BidiComplexNullProcessorTest.java >--- src/org/eclipse/equinox/bidi/internal/tests/BidiComplexNullProcessorTest.java 9 Feb 2011 21:28:56 -0000 1.1 >+++ src/org/eclipse/equinox/bidi/internal/tests/BidiComplexNullProcessorTest.java 26 Apr 2011 07:02:42 -0000 >@@ -11,7 +11,8 @@ > > package org.eclipse.equinox.bidi.internal.tests; > >-import org.eclipse.equinox.bidi.*; >+import org.eclipse.equinox.bidi.BidiComplexEngine; >+import org.eclipse.equinox.bidi.custom.BidiComplexFeatures; > > /** > * Tests RTL arithmetic >@@ -20,40 +21,27 @@ > > static final int[] EMPTY_INT_ARRAY = new int[0]; > >- private BidiComplexHelper helper; >- >- protected void setUp() throws Exception { >- super.setUp(); >- helper = new BidiComplexHelper(); >- } >- > public void testNullProcessor() { >- String full = helper.leanToFullText("abc"); >+ String full = BidiComplexEngine.leanToFullText(null, null, null, "abc", null); > assertEquals("leanToFullText", "abc", full); >- full = helper.leanToFullText("abc", 3); >+ int[] state = new int[1]; >+ state[0] = 3; >+ full = BidiComplexEngine.leanToFullText(null, null, null, "abc", state); > 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"); >+ int[] offsets = BidiComplexEngine.leanBidiCharOffsets(null, null, null, "abc", null); >+ assertEquals("leanBidiCharOffsets", 0, offsets.length); >+ offsets = BidiComplexEngine.fullBidiCharOffsets(null, null, null, "abc", null); >+ assertEquals("fullBidiCharOffsets", 0, offsets.length); >+ String lean = BidiComplexEngine.fullToLeanText(null, null, null, "abc", null); > assertEquals("fullToLeanText", "abc", lean); >- lean = helper.fullToLeanText("abc", 3); >+ lean = BidiComplexEngine.fullToLeanText(null, null, null, "abc", state); > assertEquals("fullToLeanText with state", "abc", lean); >- int state = helper.getFinalState(); >- assertEquals("getFinalState", BidiComplexHelper.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(); >+ int[] map = BidiComplexEngine.leanToFullMap(null, null, null, "abc", null); >+ int[] model = {0, 1, 2}; >+ assertEquals("leanToFullMap", array_display(model), array_display(map)); >+ map = BidiComplexEngine.fullToLeanMap(null, null, null, "abc", null); >+ assertEquals("fullToLeanMap", array_display(model), array_display(map)); >+ int direction = BidiComplexEngine.getCurDirection(null, null, null, "abc"); > assertEquals("getCurDirection", BidiComplexFeatures.DIR_LTR, direction); >- BidiComplexEnvironment env = helper.getEnvironment(); >- assertEquals("getEnvironment", BidiComplexEnvironment.DEFAULT, env); >- helper.setEnvironment(env); >- BidiComplexFeatures features = helper.getFeatures(); >- assertEquals("getFeatures", BidiComplexFeatures.DEFAULT, features); >- helper.setFeatures(features); > } > } >Index: src/org/eclipse/equinox/bidi/internal/tests/BidiComplexSomeMoreTest.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/components/bundles/org.eclipse.equinox.bidi.tests/src/org/eclipse/equinox/bidi/internal/tests/BidiComplexSomeMoreTest.java,v >retrieving revision 1.1 >diff -u -r1.1 BidiComplexSomeMoreTest.java >--- src/org/eclipse/equinox/bidi/internal/tests/BidiComplexSomeMoreTest.java 9 Feb 2011 21:28:56 -0000 1.1 >+++ src/org/eclipse/equinox/bidi/internal/tests/BidiComplexSomeMoreTest.java 26 Apr 2011 07:02:42 -0000 >@@ -11,9 +11,9 @@ > > package org.eclipse.equinox.bidi.internal.tests; > >-import org.eclipse.equinox.bidi.*; >-import org.eclipse.equinox.bidi.custom.BidiComplexProcessor; >-import org.eclipse.equinox.bidi.custom.IBidiComplexProcessor; >+import org.eclipse.equinox.bidi.BidiComplexEngine; >+import org.eclipse.equinox.bidi.BidiComplexEnvironment; >+import org.eclipse.equinox.bidi.custom.*; > > /** > * Tests some weird cases >@@ -22,28 +22,24 @@ > public class BidiComplexSomeMoreTest extends BidiComplexTestBase { > > final static BidiComplexEnvironment env1 = new BidiComplexEnvironment("en_US", false, BidiComplexEnvironment.ORIENT_LTR); >- > final static BidiComplexEnvironment env2 = new BidiComplexEnvironment("he", false, BidiComplexEnvironment.ORIENT_LTR); >- >- final static BidiComplexFeatures features = new BidiComplexFeatures(null, 1, -1, -1, false, false); >- >- BidiComplexHelper helper; >+ final static BidiComplexFeatures myFeatures = new BidiComplexFeatures(null, 1, -1, -1, false, false); > > class Processor1 extends BidiComplexProcessor { > >- public BidiComplexFeatures init(BidiComplexHelper caller, BidiComplexEnvironment env) { >- return features; >+ public BidiComplexFeatures getFeatures(BidiComplexEnvironment env) { >+ return myFeatures; > } > >- public int indexOfSpecial(BidiComplexHelper caller, int caseNumber, String srcText, int fromIndex) { >+ public int indexOfSpecial(BidiComplexFeatures features, String text, byte[] dirProps, int[] offsets, int caseNumber, int fromIndex) { > return fromIndex; > } > >- public int processSpecial(BidiComplexHelper caller, int caseNumber, String srcText, int operLocation) { >- int len = srcText.length(); >+ public int processSpecial(BidiComplexFeatures features, String text, byte[] dirProps, int[] offsets, int[] state, int caseNumber, int operLocation) { >+ int len = text.length(); > for (int i = len - 1; i >= 0; i--) { >- caller.insertMark(i); >- caller.insertMark(i); >+ BidiComplexProcessor.insertMark(text, dirProps, offsets, i); >+ BidiComplexProcessor.insertMark(text, dirProps, offsets, i); > } > return len; > } >@@ -51,18 +47,18 @@ > > class Processor2 extends BidiComplexProcessor { > >- public BidiComplexFeatures init(BidiComplexHelper caller, BidiComplexEnvironment env) { >- return features; >+ public BidiComplexFeatures getFeatures(BidiComplexEnvironment env) { >+ return myFeatures; > } > } > > class Processor3 extends BidiComplexProcessor { > >- public BidiComplexFeatures init(BidiComplexHelper caller, BidiComplexEnvironment env) { >- return features; >+ public BidiComplexFeatures getFeatures(BidiComplexEnvironment env) { >+ return myFeatures; > } > >- public int indexOfSpecial(BidiComplexHelper caller, int caseNumber, String srcText, int fromIndex) { >+ public int indexOfSpecial(BidiComplexFeatures features, String text, byte[] dirProps, int[] offsets, int caseNumber, int fromIndex) { > return 0; > } > } >@@ -72,25 +68,22 @@ > assertTrue(env2.isBidi()); > > IBidiComplexProcessor processor = new Processor1(); >- helper = new BidiComplexHelper(processor, env1); >- String full = toPseudo(helper.leanToFullText("abcd")); >- assertEquals("@a@b@c@d", full); >+ String full = BidiComplexEngine.leanToFullText(processor, null, env1, "abcd", null); >+ assertEquals("@a@b@c@d", toPseudo(full)); > > processor = new Processor2(); >- helper = new BidiComplexHelper(processor, env1); > boolean catchFlag = false; > try { >- full = toPseudo(helper.leanToFullText("abcd")); >+ full = BidiComplexEngine.leanToFullText(processor, null, env1, "abcd", null); > } catch (IllegalStateException e) { > catchFlag = true; > } > assertTrue("Catch missing indexOfSpecial", catchFlag); > > processor = new Processor3(); >- helper = new BidiComplexHelper(processor, env1); > catchFlag = false; > try { >- full = toPseudo(helper.leanToFullText("abcd")); >+ full = BidiComplexEngine.leanToFullText(processor, null, env1, "abcd", null); > } catch (IllegalStateException e) { > catchFlag = true; > } >Index: src/org/eclipse/equinox/bidi/internal/tests/BidiComplexStringRecordTest.java >=================================================================== >RCS file: src/org/eclipse/equinox/bidi/internal/tests/BidiComplexStringRecordTest.java >diff -N src/org/eclipse/equinox/bidi/internal/tests/BidiComplexStringRecordTest.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/equinox/bidi/internal/tests/BidiComplexStringRecordTest.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,119 @@ >+/******************************************************************************* >+ * Copyright (c) 2010, 2011 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.BidiComplexStringRecord; >+import org.eclipse.equinox.bidi.custom.BidiComplexStringProcessor; >+ >+/** >+ * Tests the StringRecord class >+ */ >+public class BidiComplexStringRecordTest extends BidiComplexTestBase { >+ public void testStringRecord() { >+ BidiComplexStringRecord sr; >+ boolean catchFlag; >+ short[] badTriplet1 = new short[] {0, 0}; >+ short[] badTriplet2 = new short[] {0, 0, -1}; >+ short[] badTriplet3 = new short[] {0, 0, 999}; >+ short[] goodTriplet = new short[] {0, 3, 2}; >+ short[] triplets; >+ short type; >+ String strType; >+ // check handling of invalid arguments >+ catchFlag = false; >+ try { >+ sr = new BidiComplexStringRecord(null, badTriplet1); >+ } catch (IllegalArgumentException e) { >+ catchFlag = true; >+ } >+ assertTrue("Catch null string argument", catchFlag); >+ catchFlag = false; >+ try { >+ sr = new BidiComplexStringRecord("xxx", null); >+ } catch (IllegalArgumentException e) { >+ catchFlag = true; >+ } >+ assertTrue("Catch null triplets argument", catchFlag); >+ catchFlag = false; >+ try { >+ sr = new BidiComplexStringRecord("xxx", badTriplet1); >+ } catch (IllegalArgumentException e) { >+ catchFlag = true; >+ } >+ assertTrue("Catch bad triplet #1 argument", catchFlag); >+ catchFlag = false; >+ try { >+ sr = new BidiComplexStringRecord("xxx", badTriplet2); >+ } catch (IllegalArgumentException e) { >+ catchFlag = true; >+ } >+ assertTrue("Catch bad triplet #2 argument", catchFlag); >+ catchFlag = false; >+ try { >+ sr = new BidiComplexStringRecord("xxx", badTriplet3); >+ } catch (IllegalArgumentException e) { >+ catchFlag = true; >+ } >+ assertTrue("Catch bad triplet #3 argument", catchFlag); >+ >+ String[] types = BidiComplexStringProcessor.getKnownTypes(); >+ for (int i = 0; i < types.length; i++) { >+ type = BidiComplexStringRecord.typeStringToShort(types[i]); >+ assertFalse(type == -1); >+ strType = BidiComplexStringRecord.typeShortToString(type); >+ assertEquals(types[i], strType); >+ } >+ type = BidiComplexStringRecord.typeStringToShort("dummy"); >+ assertEquals(-1, type); >+ strType = BidiComplexStringRecord.typeShortToString((short) 999); >+ assertEquals(null, strType); >+ int poolSize = BidiComplexStringRecord.POOLSIZE; >+ int lim = poolSize / 2; >+ triplets = BidiComplexStringRecord.getTriplets("xxx"); >+ assertEquals(null, triplets); >+ for (int i = 0; i < lim; i++) { >+ String str = Integer.toString(i); >+ sr = new BidiComplexStringRecord(str, goodTriplet); >+ BidiComplexStringRecord.add(sr); >+ } >+ triplets = BidiComplexStringRecord.getTriplets(null); >+ assertEquals(null, triplets); >+ triplets = BidiComplexStringRecord.getTriplets(""); >+ assertEquals(null, triplets); >+ for (int i = 0; i < poolSize; i++) { >+ String str = Integer.toString(i); >+ triplets = BidiComplexStringRecord.getTriplets(str); >+ if (i < lim) >+ assertFalse(null == triplets); >+ else >+ assertTrue(null == triplets); >+ } >+ for (int i = lim; i <= poolSize; i++) { >+ String str = Integer.toString(i); >+ sr = new BidiComplexStringRecord(str, goodTriplet); >+ BidiComplexStringRecord.add(sr); >+ } >+ for (int i = 1; i <= poolSize; i++) { >+ String str = Integer.toString(i); >+ triplets = BidiComplexStringRecord.getTriplets(str); >+ assertFalse(null == triplets); >+ } >+ triplets = BidiComplexStringRecord.getTriplets("0"); >+ assertEquals(null, triplets); >+ BidiComplexStringRecord.clear(); >+ for (int i = 0; i <= poolSize; i++) { >+ String str = Integer.toString(i); >+ triplets = BidiComplexStringRecord.getTriplets(str); >+ assertEquals(null, triplets); >+ } >+ } >+} >Index: src/org/eclipse/equinox/bidi/internal/tests/BidiComplexTest.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/components/bundles/org.eclipse.equinox.bidi.tests/src/org/eclipse/equinox/bidi/internal/tests/BidiComplexTest.java,v >retrieving revision 1.1 >diff -u -r1.1 BidiComplexTest.java >--- src/org/eclipse/equinox/bidi/internal/tests/BidiComplexTest.java 9 Feb 2011 21:28:56 -0000 1.1 >+++ src/org/eclipse/equinox/bidi/internal/tests/BidiComplexTest.java 26 Apr 2011 07:02:50 -0000 >@@ -10,26 +10,23 @@ > ******************************************************************************/ > package org.eclipse.equinox.bidi.internal.tests; > >-import org.eclipse.equinox.bidi.*; >+import org.eclipse.equinox.bidi.BidiComplexEnvironment; >+import org.eclipse.equinox.bidi.custom.BidiComplexFeatures; > import org.eclipse.equinox.bidi.custom.IBidiComplexProcessor; > > public class BidiComplexTest implements IBidiComplexProcessor { > > static final BidiComplexFeatures FEATURES = new BidiComplexFeatures("-=.:", 0, -1, -1, false, false); > >- public BidiComplexFeatures init(BidiComplexHelper caller, BidiComplexEnvironment env) { >+ public BidiComplexFeatures getFeatures(BidiComplexEnvironment env) { > return FEATURES; > } > >- public BidiComplexFeatures updateEnvironment(BidiComplexHelper caller, BidiComplexEnvironment env) { >- return FEATURES; >- } >- >- public int indexOfSpecial(BidiComplexHelper caller, int caseNumber, String srcText, int fromIndex) { >+ public int indexOfSpecial(BidiComplexFeatures features, String text, byte[] dirProps, int[] offsets, int caseNumber, int fromIndex) { > throw new IllegalStateException(); > } > >- public int processSpecial(BidiComplexHelper caller, int caseNumber, String srcText, int operLocation) { >+ public int processSpecial(BidiComplexFeatures features, String text, byte[] dirProps, int[] offsets, int[] state, int caseNumber, int operLocation) { > throw new IllegalStateException(); > } > >Index: src/org/eclipse/equinox/bidi/internal/tests/BidiComplexTestBase.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/components/bundles/org.eclipse.equinox.bidi.tests/src/org/eclipse/equinox/bidi/internal/tests/BidiComplexTestBase.java,v >retrieving revision 1.1 >diff -u -r1.1 BidiComplexTestBase.java >--- src/org/eclipse/equinox/bidi/internal/tests/BidiComplexTestBase.java 9 Feb 2011 21:28:56 -0000 1.1 >+++ src/org/eclipse/equinox/bidi/internal/tests/BidiComplexTestBase.java 26 Apr 2011 07:02:50 -0000 >@@ -107,17 +107,4 @@ > 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/tests/BidiComplexTestSuite.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/components/bundles/org.eclipse.equinox.bidi.tests/src/org/eclipse/equinox/bidi/tests/BidiComplexTestSuite.java,v >retrieving revision 1.1 >diff -u -r1.1 BidiComplexTestSuite.java >--- src/org/eclipse/equinox/bidi/tests/BidiComplexTestSuite.java 9 Feb 2011 21:28:55 -0000 1.1 >+++ src/org/eclipse/equinox/bidi/tests/BidiComplexTestSuite.java 26 Apr 2011 07:02:50 -0000 >@@ -29,5 +29,6 @@ > addTestSuite(BidiComplexMathTest.class); > addTestSuite(BidiComplexSomeMoreTest.class); > addTestSuite(BidiComplexUtilTest.class); >+ addTestSuite(BidiComplexStringRecordTest.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
Flags:
ob1.eclipse
:
iplog+
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