### Eclipse Workspace Patch 1.0 #P org.eclipse.equinox.bidi.tests 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 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ src/org/eclipse/equinox/bidi/internal/tests/ComplExpMathTest.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,70 @@ +/******************************************************************************* + * 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.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; + +import org.eclipse.equinox.bidi.complexp.IComplExpProcessor; +import org.eclipse.equinox.bidi.complexp.StringProcessor; +import org.eclipse.equinox.bidi.complexp.IBiDiProcessor; + +/** + * Tests RTL arithmetic + */ +public class ComplExpMathTest extends TestCase { + public static Test suite() { + return new TestSuite(ComplExpMathTest.class); + } + + public ComplExpMathTest() { + super(); + } + + public ComplExpMathTest(String name) { + super(name); + } + + static void test1(IComplExpProcessor complexp, String data, + String resLTR, String resRTL) + { + String full, lean; + + System.out.println(); + System.out.println(">>> text=" + data); + lean = Tools.toUT16(data); + complexp.assumeOrientation(IComplExpProcessor.ORIENT_LTR); + full = complexp.leanToFullText(lean); + Tools.verify("LTR full", full, resLTR); + complexp.assumeOrientation(IComplExpProcessor.ORIENT_RTL); + full = complexp.leanToFullText(lean); + Tools.verify("RTL full", full, resRTL); + } + + public static void testRTLarithmetic() { + Tools.separ("ComplExpMathTest"); + IComplExpProcessor complexp = StringProcessor.getProcessor(IBiDiProcessor.RTL_ARITHMETIC); + test1(complexp, "", "", ""); + test1(complexp, "1+abc", "<&1+abc&^", "1+abc"); + test1(complexp, "2+abc-def", "<&2+abc&-def&^", "2+abc&-def"); + test1(complexp, "a+3*bc/def", "<&a&+3*bc&/def&^", "a&+3*bc&/def"); + test1(complexp, "4+abc/def", "<&4+abc&/def&^", "4+abc&/def"); + test1(complexp, "13ABC", "<&13ABC&^", "13ABC"); + test1(complexp, "14ABC-DE", "<&14ABC-DE&^", "14ABC-DE"); + test1(complexp, "15ABC+DE", "<&15ABC+DE&^", "15ABC+DE"); + test1(complexp, "16ABC*DE", "<&16ABC*DE&^", "16ABC*DE"); + test1(complexp, "17ABC/DE", "<&17ABC/DE&^", "17ABC/DE"); + + Tools.printStepErrorCount(); + } +} Index: src/org/eclipse/equinox/bidi/internal/tests/ComplExpTest.java =================================================================== RCS file: /cvsroot/rt/org.eclipse.equinox/components/bundles/org.eclipse.equinox.bidi.tests/src/org/eclipse/equinox/bidi/internal/tests/ComplExpTest.java,v retrieving revision 1.1 diff -u -r1.1 ComplExpTest.java --- src/org/eclipse/equinox/bidi/internal/tests/ComplExpTest.java 3 Feb 2010 20:08:12 -0000 1.1 +++ src/org/eclipse/equinox/bidi/internal/tests/ComplExpTest.java 23 Feb 2010 23:46:51 -0000 @@ -21,6 +21,14 @@ return; } + public void setOperators(String operators) { + // empty + } + + public String getOperators() { + return ""; + } + public void selectBidiScript(boolean arabic, boolean hebrew) { // empty } 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 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ src/org/eclipse/equinox/bidi/internal/tests/ComplExpUtilTest.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,123 @@ +/******************************************************************************* + * 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.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; + +import org.eclipse.equinox.bidi.complexp.*; + +/** + * Tests methods in ComplExpUtil + */ + +public class ComplExpUtilTest extends TestCase { + public static Test suite() { + return new TestSuite(ComplExpUtilTest.class); + } + + public ComplExpUtilTest() { + super(); + } + + public ComplExpUtilTest(String name) { + super(name); + } + + static void doTest1(String data, String result) + { + String full = ComplExpUtil.process(Tools.toUT16(data)); + String ful2 = ComplExpUtil.process(Tools.toUT16(data), null); + System.out.println(); + System.out.println(">>> process() text=" + data); + Tools.verify("full", full, result); + Tools.verify("ful2", ful2, result); + String lean = ComplExpUtil.deprocess(full); + Tools.verify("lean", lean, data); + } + + static void doTest2(String data, String result) + { + doTest2(data, result, data); + } + + static void doTest2(String data, String result, String resLean) + { + String full = ComplExpUtil.process(Tools.toUT16(data), "*"); + System.out.println(); + System.out.println(">>> process() ASTERISK text=" + data); + Tools.verify("full", full, result); + String lean = ComplExpUtil.deprocess(full); + Tools.verify("lean", lean, resLean); + } + + static void doTest3(String data, String result) + { + doTest3(data, result, data); + } + + static void doTest3(String data, String result, String resLean) + { + String full = ComplExpUtil.processTyped(Tools.toUT16(data), IBiDiProcessor.COMMA_DELIMITED); + System.out.println(); + System.out.println(">>> process() COMMA text=" + data); + Tools.verify("full", full, result); + String lean = ComplExpUtil.deprocess(full, IBiDiProcessor.COMMA_DELIMITED); + Tools.verify("lean", lean, resLean); + } + + static void doTest4(String data, int[] offsets, int direction, boolean affix, + String result) + { + System.out.println(); + System.out.println(">>> insertMarks() text=" + data); + System.out.println(" offsets=" + Tools.array_display(offsets)); + System.out.print (" direction=" + direction); + System.out.println(" affix=" + affix); + String lean = Tools.toUT16(data); + String full = ComplExpUtil.insertMarks(lean, offsets, direction, affix); + Tools.verify("full", full, result); + } + + public static void testComplExpUtil() { + Tools.separ("ComplExpUtilTest"); + + // Test process() and deprocess() with default delimiters + doTest1("ABC/DEF/G", ">@ABC@/DEF@/G@^"); + // Test process() and deprocess() with specified delimiters + doTest2("", ""); + doTest2(">@ABC@^", ">@ABC@^", "ABC"); + doTest2("abc", "abc"); + doTest2("!abc", ">@!abc@^"); + doTest2("abc!", ">@abc!@^"); + doTest2("ABC*DEF*G", ">@ABC@*DEF@*G@^"); + // Test process() and deprocess() with specified expression type + doTest3("ABC,DEF,G", ">@ABC@,DEF@,G@^"); + doTest3("", ""); + doTest3(">@DEF@^", ">@DEF@^", "DEF"); + String str = ComplExpUtil.deprocess(Tools.toUT16("ABC,DE"), "wrong_type"); + Tools.verify("deprocess(9999)", str, "ABC,DE"); + Tools.verify("invalid type", ComplExpUtil.process("abc", "wrong_type"), "abc"); + // Test insertMarks() + doTest4("ABCDEFG", new int[]{3, 6}, 0, false, "ABC@DEF@G"); + doTest4("ABCDEFG", new int[]{3, 6}, 0, true, ">@ABC@DEF@G@^"); + doTest4("ABCDEFG", new int[]{3, 6}, 1, false, "ABC&DEF&G"); + doTest4("ABCDEFG", new int[]{3, 6}, 1, true, "<&ABC&DEF&G&^"); + doTest4("", new int[]{3, 6}, 0, false, ""); + doTest4("", new int[]{3, 6}, 0, true, ""); + doTest4("ABCDEFG", null, 1, false, "ABCDEFG"); + doTest4("ABCDEFG", null, 1, true, "<&ABCDEFG&^"); + + Tools.printStepErrorCount(); + } +} Index: src/org/eclipse/equinox/bidi/internal/tests/ExtensionsTest.java =================================================================== RCS file: src/org/eclipse/equinox/bidi/internal/tests/ExtensionsTest.java diff -N src/org/eclipse/equinox/bidi/internal/tests/ExtensionsTest.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ src/org/eclipse/equinox/bidi/internal/tests/ExtensionsTest.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,208 @@ +/******************************************************************************* + * 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.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; + +import org.eclipse.equinox.bidi.complexp.IComplExpProcessor; +import org.eclipse.equinox.bidi.complexp.StringProcessor; +import org.eclipse.equinox.bidi.complexp.IBiDiProcessor; + +/** + * Tests all plug-in extensions + */ + +public class ExtensionsTest extends TestCase { + public static Test suite() { + return new TestSuite(ExtensionsTest.class); + } + + public ExtensionsTest() { + super(); + } + + public ExtensionsTest(String name) { + super(name); + } + + static int state = IComplExpProcessor.STATE_NOTHING_GOING; + + static void doTest1(IComplExpProcessor complexp, String label, String data, String result) + { + String full; + full = complexp.leanToFullText(Tools.toUT16(data), state); + state = complexp.getFinalState(); + Tools.verify(label + " data = " + data, full, result); + } + + static void doTest2(IComplExpProcessor complexp, String label, String data, String result) + { + String full; + full = complexp.leanToFullText(data, state); + state = complexp.getFinalState(); + Tools.verify(label + " data = " + data, full, result); + } + + public static void testExtensions() { + Tools.separ("ExtensionsTest"); + IComplExpProcessor ce; + + ce = StringProcessor.getProcessor(IBiDiProcessor.COMMA_DELIMITED); + assertNotNull(ce); + 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); + state = IComplExpProcessor.STATE_NOTHING_GOING; + ce.assumeOrientation(IComplExpProcessor.ORIENT_LTR); + 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); + 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); + 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); + 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", "NAME@=VAL1,VAL2=VAL3"); + + String data; + ce = StringProcessor.getProcessor(IBiDiProcessor.REGEXP); + assertNotNull(ce); + state = IComplExpProcessor.STATE_NOTHING_GOING; + data = Tools.toUT16("ABC(?")+"#"+Tools.toUT16("DEF)GHI"); + doTest2(ce, "Regex #0.0", data, "A@B@C@(?#DEF)@G@H@I"); + data = Tools.toUT16("ABC(?")+"#"+Tools.toUT16("DEF"); + doTest2(ce, "Regex #0.1", data, "A@B@C@(?#DEF"); + doTest1(ce, "Regex #0.2", "GHI)JKL", "GHI)@J@K@L"); + data = Tools.toUT16("ABC(?")+"<"+Tools.toUT16("DEF")+">"+Tools.toUT16("GHI"); + doTest2(ce, "Regex #1", data, "A@B@C@(?@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"); + data = Tools.toUT16("ABC(?(")+"<"+Tools.toUT16("DEF")+">"+Tools.toUT16(")GHI"); + doTest2(ce, "Regex #3", data, "A@B@C@(?()@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"); + data = Tools.toUT16("ABC(?")+"&"+Tools.toUT16("DEF)GHI"); + doTest2(ce, "Regex #6", data, "A@B@C@(?&DEF)@G@H@I"); + data = Tools.toUT16("ABC(?")+"P<"+Tools.toUT16("DEF")+">"+Tools.toUT16("GHI"); + doTest2(ce, "Regex #7", data, "A@B@C(?p@G@H@I"); + data = Tools.toUT16("ABC\\k")+"<"+Tools.toUT16("DEF")+">"+Tools.toUT16("GHI"); + doTest2(ce, "Regex #8", data, "A@B@C\\k@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"); + data = Tools.toUT16("ABC(?")+"P="+Tools.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"); + data = Tools.toUT16("ABC\\g")+"<"+Tools.toUT16("DEF")+">"+Tools.toUT16("GHI"); + doTest2(ce, "Regex #13", data, "A@B@C\\g@G@H@I"); + doTest1(ce, "Regex #14", "ABC\\g'DEF'GHI", "A@B@C\\g'DEF'@G@H@I"); + data = Tools.toUT16("ABC(?(")+"R&"+Tools.toUT16("DEF)GHI"); + doTest2(ce, "Regex #15", data, "A@B@C(?(r&DEF)@G@H@I"); + data = Tools.toUT16("ABC")+"\\Q"+Tools.toUT16("DEF")+"\\E"+Tools.toUT16("GHI"); + doTest2(ce, "Regex #16.0", data, "A@B@C\\qDEF\\eG@H@I"); + data = Tools.toUT16("ABC")+"\\Q"+Tools.toUT16("DEF"); + doTest2(ce, "Regex #16.1", data, "A@B@C\\qDEF"); + data = Tools.toUT16("GHI")+"\\E"+Tools.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); + 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", "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", "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", "ABC@'DEF '' G I'@ JKL@,MN"); + doTest1(ce, "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"); + + ce = StringProcessor.getProcessor(IBiDiProcessor.SYSTEM_USER); + assertNotNull(ce); + state = IComplExpProcessor.STATE_NOTHING_GOING; + doTest1(ce, "System #1", "HOST(JACK)", "HOST@(JACK)"); + + ce = StringProcessor.getProcessor(IBiDiProcessor.UNDERSCORE); + assertNotNull(ce); + 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; + doTest1(ce, "URL #1", "WWW.DOMAIN.COM/DIR1/DIR2/dir3/DIR4", "WWW@.DOMAIN@.COM@/DIR1@/DIR2/dir3/DIR4"); + + ce = StringProcessor.getProcessor(IBiDiProcessor.XPATH); + assertNotNull(ce); + 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 ", "DEF@-GHI @(A*B\\)*C) @/JK "); + doTest1(ce, "DelimsEsc #5", "DEF-GHI (A\\\\\\)*C) /JK ", "DEF@-GHI @(A\\\\\\)*C) @/JK "); + doTest1(ce, "DelimsEsc #6", "DEF-GHI (A\\\\)*C /JK ", "DEF@-GHI @(A\\\\)@*C @/JK "); + doTest1(ce, "DelimsEsc #7", "DEF-GHI (A\\)*C /JK ", "DEF@-GHI @(A\\)*C /JK "); + + + Tools.printStepErrorCount(); + } +} Index: src/org/eclipse/equinox/bidi/internal/tests/FullToLeanTest.java =================================================================== RCS file: src/org/eclipse/equinox/bidi/internal/tests/FullToLeanTest.java diff -N src/org/eclipse/equinox/bidi/internal/tests/FullToLeanTest.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ src/org/eclipse/equinox/bidi/internal/tests/FullToLeanTest.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,334 @@ +/******************************************************************************* + * 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.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; + +import org.eclipse.equinox.bidi.complexp.IComplExpProcessor; +import org.eclipse.equinox.bidi.complexp.StringProcessor; +import org.eclipse.equinox.bidi.complexp.IBiDiProcessor; + +/** + * Tests fullToLean method + */ + +public class FullToLeanTest extends TestCase { + public static Test suite() { + return new TestSuite(FullToLeanTest.class); + } + + public FullToLeanTest() { + super(); + } + + public FullToLeanTest(String name) { + super(name); + } + + static int[] getpos(IComplExpProcessor complexp, boolean leanToFull) + { + int[] pos = new int[5]; + + 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; + } + + static void doTest1(IComplExpProcessor complexp, String data, + String leanLTR, String fullLTR, + int[] l2fPosLTR, int[] f2lPosLTR, + String leanRTL, String fullRTL, + int[] l2fPosRTL, int[] f2lPosRTL) + { + String text, full, lean; + int[] pos; + + System.out.println(); + System.out.println(">>> text=" + data); + text = Tools.toUT16(data); + complexp.assumeOrientation(IComplExpProcessor.ORIENT_LTR); + lean = complexp.fullToLeanText(text); + Tools.verify("LTR lean", lean, leanLTR); + full = complexp.leanToFullText(lean); + Tools.verify("LTR full", full, fullLTR); + pos = getpos(complexp, true); + Tools.verify("leanToFullPos()", pos, l2fPosLTR); + pos = getpos(complexp, false); + Tools.verify("fullToLeanPos()", pos, f2lPosLTR); + complexp.assumeOrientation(IComplExpProcessor.ORIENT_RTL); + lean = complexp.fullToLeanText(text); + Tools.verify("RTL lean", lean, leanRTL); + full = complexp.leanToFullText(lean); + Tools.verify("RTL full", full, fullRTL); + pos = getpos(complexp, true); + Tools.verify("leanToFullPos()", pos, l2fPosRTL); + pos = getpos(complexp, false); + Tools.verify("fullToLeanPos()", pos, f2lPosRTL); + complexp.assumeOrientation(IComplExpProcessor.ORIENT_RTL); + lean = complexp.fullToLeanText(text); + } + + static void doTest2() + { + IComplExpProcessor complexp; + String text, data, full, lean, model; + int state, state2, state3; + + complexp = StringProcessor.getProcessor(IBiDiProcessor.SQL); + complexp.assumeOrientation(IComplExpProcessor.ORIENT_LTR); + System.out.println(); + data = "update \"AB_CDE\" set \"COL1\"@='01', \"COL2\"@='02' /* GH IJK"; + System.out.println(">>> text=" + data); + text = Tools.toUT16(data); + lean = complexp.fullToLeanText(text); + state = complexp.getFinalState(); + model = "update \"AB_CDE\" set \"COL1\"='01', \"COL2\"='02' /* GH IJK"; + Tools.verify("LTR lean", lean, model); + full = complexp.leanToFullText(lean); + Tools.verify("LTR full", full, data); + Tools.verify("state from leanToFullText", state, complexp.getFinalState()); + data = "THIS IS A COMMENT LINE"; + System.out.println(">>> text=" + data); + text = Tools.toUT16(data); + lean = complexp.fullToLeanText(text, state); + state2 = complexp.getFinalState(); + model = "THIS IS A COMMENT LINE"; + Tools.verify("LTR lean", lean, model); + full = complexp.leanToFullText(lean, state); + Tools.verify("LTR full", full, data); + Tools.verify("state from leanToFullText", state2, complexp.getFinalState()); + data = "SOME MORE */ where \"COL3\"@=123"; + System.out.println(">>> text=" + data); + text = Tools.toUT16(data); + lean = complexp.fullToLeanText(text, state2); + state3 = complexp.getFinalState(); + model = "SOME MORE */ where \"COL3\"=123"; + Tools.verify("LTR lean", lean, model); + full = complexp.leanToFullText(lean, state2); + Tools.verify("LTR full", full, data); + Tools.verify("state from leanToFullText", state3, complexp.getFinalState()); + } + + public static void testFullToLean() { + Tools.separ("FullToLeanTest"); + IComplExpProcessor complexp = StringProcessor.getProcessor(IBiDiProcessor.COMMA_DELIMITED); + + doTest1(complexp, "", + "", "", + 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(complexp, "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(complexp, "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(complexp, "@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(complexp, "@@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(complexp, "@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(complexp, "@@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(complexp, "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(complexp, "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(complexp, "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(complexp, "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(complexp, "@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(complexp, "@@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(complexp, "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(complexp, "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(complexp, "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(complexp, "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(complexp, "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(complexp, "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(complexp, "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(complexp, "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(complexp, "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(complexp, "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(complexp, ">@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(complexp, "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(complexp, ">@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(complexp, "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(complexp, "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(complexp, ">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(complexp, ">>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(complexp, ">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(complexp, ">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(complexp, ">@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(complexp, "@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(complexp, ">@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(complexp, "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(complexp, "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(complexp, ">>>@@@@@^^^", + "", "", + 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}); + + // test fullToLeanText with initial state + doTest2(); + + Tools.printStepErrorCount(); + } +} Index: src/org/eclipse/equinox/bidi/internal/tests/MethodsTest.java =================================================================== RCS file: src/org/eclipse/equinox/bidi/internal/tests/MethodsTest.java diff -N src/org/eclipse/equinox/bidi/internal/tests/MethodsTest.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ src/org/eclipse/equinox/bidi/internal/tests/MethodsTest.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,437 @@ +/******************************************************************************* + * 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.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; + +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; + +/** + * Tests most public methods of ComplExpBasic + */ + +public class MethodsTest extends TestCase { + public static Test suite() { + return new TestSuite(MethodsTest.class); + } + + public MethodsTest() { + super(); + } + + public MethodsTest(String name) { + super(name); + } + + final static int LTR = IComplExpProcessor.DIRECTION_LTR; + final static int RTL = IComplExpProcessor.DIRECTION_RTL; + + static void doTestState(IComplExpProcessor complexp) + { + String data, lean, full, model; + int state; + + data = "A=B+C;/* D=E+F;"; + System.out.println(">>> text=" + data); + lean = Tools.toUT16(data); + full = complexp.leanToFullText(lean); + model = "A@=B@+C@;/* D=E+F;"; + Tools.verify("full1", full, model); + state = complexp.getFinalState(); + System.out.println(" state=" + state); + data = "A=B+C; D=E+F;"; + System.out.println(">>> text=" + data); + lean = Tools.toUT16(data); + full = complexp.leanToFullText(lean, state); + model = "A=B+C; D=E+F;"; + Tools.verify("full2", full, model); + state = complexp.getFinalState(); + System.out.println(" state=" + state); + data = "A=B+C;*/ D=E+F;"; + System.out.println(">>> text=" + data); + lean = Tools.toUT16(data); + full = complexp.leanToFullText(lean, state); + model = "A=B+C;*/@ D@=E@+F;"; + Tools.verify("full3", full, model); + } + + static void doTestOrientation() + { + IComplExpProcessor complexp; + int orient; + + complexp = StringProcessor.getProcessor(IBiDiProcessor.COMMA_DELIMITED); + orient = complexp.recallOrientation(); +// TBD: the following test cannot succeed with the current implementation. +// it will need allocating separate data for each processor use. +// Tools.verify("orient #1", orient, IComplExpProcessor.ORIENT_LTR); + + complexp.assumeOrientation(IComplExpProcessor.ORIENT_IGNORE); + orient = complexp.recallOrientation(); + Tools.verify("orient #2", orient, IComplExpProcessor.ORIENT_IGNORE); + + complexp.assumeOrientation(IComplExpProcessor.ORIENT_CONTEXTUAL_RTL); + orient = complexp.recallOrientation(); + complexp.leanToFullText("--!**"); + Tools.verify("orient #3", orient, IComplExpProcessor.ORIENT_CONTEXTUAL_RTL); + + complexp.assumeOrientation(9999); + orient = complexp.recallOrientation(); + complexp.leanToFullText("--!**"); + Tools.verify("orient #4", orient, IComplExpProcessor.ORIENT_UNKNOWN); + } + + static void doTestOrient(IComplExpProcessor complexp, String data, + String resLTR, String resRTL, String resCon) + { + String full, lean; + + System.out.println(); + System.out.println(">>> text=" + data); + lean = Tools.toUT16(data); + complexp.assumeOrientation(IComplExpProcessor.ORIENT_LTR); + full = complexp.leanToFullText(lean); + Tools.verify("LTR full", full, resLTR); + complexp.assumeOrientation(IComplExpProcessor.ORIENT_RTL); + full = complexp.leanToFullText(lean); + Tools.verify("RTL full", full, resRTL); + complexp.assumeOrientation(IComplExpProcessor.ORIENT_CONTEXTUAL_RTL); + full = complexp.leanToFullText(lean); + Tools.verify("CON full", full, resCon); + } + + static void doTestScripts(IComplExpProcessor complexp) + { + boolean flag; + flag = complexp.handlesArabicScript(); + Tools.verify("Handles Arabic 1", flag, true); + flag = complexp.handlesHebrewScript(); + Tools.verify("Handles Hebrew 1", flag, true); + + complexp.selectBidiScript(false, false); + flag = complexp.handlesArabicScript(); + Tools.verify("Handles Arabic 2", flag, false); + flag = complexp.handlesHebrewScript(); + Tools.verify("Handles Hebrew 2", flag, false); + doTestOrient(complexp, "BCD,EF", "BCD,EF", ">@BCD,EF@^", "@BCD,EF"); + complexp.selectBidiScript(true, false); + flag = complexp.handlesArabicScript(); + Tools.verify("Handles Arabic 3", flag, true); + flag = complexp.handlesHebrewScript(); + Tools.verify("Handles Hebrew 3", flag, false); + doTestOrient(complexp, "d,EF", "d,EF", ">@d,EF@^", "d,EF"); + doTestOrient(complexp, "#,eF", "#,eF", ">@#,eF@^", "@#,eF"); + doTestOrient(complexp, "#,12", "#@,12", ">@#@,12@^", "@#@,12"); + doTestOrient(complexp, "#,##", "#@,##", ">@#@,##@^", "@#@,##"); + doTestOrient(complexp, "#,89", "#@,89", ">@#@,89@^", "@#@,89"); + doTestOrient(complexp, "#,ef", "#,ef", ">@#,ef@^", "@#,ef"); + doTestOrient(complexp, "#,", "#,", ">@#,@^", "@#,"); + doTestOrient(complexp, "9,ef", "9,ef", ">@9,ef@^", "9,ef"); + doTestOrient(complexp, "9,##", "9@,##", ">@9@,##@^", "9@,##"); + doTestOrient(complexp, "7,89", "7@,89", ">@7@,89@^", "7@,89"); + doTestOrient(complexp, "7,EF", "7,EF", ">@7,EF@^", "@7,EF"); + doTestOrient(complexp, "BCD,EF", "BCD,EF", ">@BCD,EF@^", "@BCD,EF"); + + complexp.selectBidiScript(false, true); + flag = complexp.handlesArabicScript(); + Tools.verify("Handles Arabic 4", flag, false); + flag = complexp.handlesHebrewScript(); + Tools.verify("Handles Hebrew 4", flag, true); + doTestOrient(complexp, "BCd,EF", "BCd,EF", ">@BCd,EF@^", "@BCd,EF"); + doTestOrient(complexp, "BCD,eF", "BCD,eF", ">@BCD,eF@^", "@BCD,eF"); + doTestOrient(complexp, "BCD,EF", "BCD@,EF", ">@BCD@,EF@^", "@BCD@,EF"); + doTestOrient(complexp, "BCD,12", "BCD@,12", ">@BCD@,12@^", "@BCD@,12"); + doTestOrient(complexp, "BCD,", "BCD,", ">@BCD,@^", "@BCD,"); + + complexp.selectBidiScript(true, true); + doTestOrient(complexp, "123,45|67", "123,45|67", ">@123,45|67@^", "@123,45|67"); + doTestOrient(complexp, "5,e", "5,e", ">@5,e@^", "5,e"); + doTestOrient(complexp, "5,#", "5@,#", ">@5@,#@^", "5@,#"); + doTestOrient(complexp, "5,6", "5@,6", ">@5@,6@^", "5@,6"); + doTestOrient(complexp, "5,D", "5@,D", ">@5@,D@^", "5@,D"); + doTestOrient(complexp, "5,--", "5,--", ">@5,--@^", "@5,--"); + } + + static void doTestLeanOffsets(IComplExpProcessor complexp) + { + String lean, data; + int state; + int[] offsets; + int[] model; + + data = "A=B+C;/* D=E+F;"; + System.out.println(">>> text1=" + data); + lean = Tools.toUT16(data); + offsets = complexp.leanBidiCharOffsets(lean); + model = new int[]{1, 3, 5}; + Tools.verify("leanBidiCharOffsets()", offsets, model); + state = complexp.getFinalState(); + System.out.println(" state=" + state); + data = "A=B+C;*/ D=E+F;"; + System.out.println(">>> text2=" + data); + lean = Tools.toUT16(data); + offsets = complexp.leanBidiCharOffsets(lean, state); + model = new int[]{8, 10, 12}; + Tools.verify("leanBidiCharOffsets() #2", offsets, model); + System.out.println(">>> text3=" + data); + offsets = complexp.leanBidiCharOffsets(); + model = new int[]{8, 10, 12}; + Tools.verify("leanBidiCharOffsets() #3", offsets, model); + } + + static void doTestFullOffsets(IComplExpProcessor complexp, String data, + int[] resLTR, int[] resRTL, int[] resCon) + { + String full, lean; + int[] offsets; + + System.out.println(); + System.out.println(">>> text=" + data); + lean = Tools.toUT16(data); + complexp.assumeOrientation(IComplExpProcessor.ORIENT_LTR); + full = complexp.leanToFullText(lean); + System.out.println("LTR full=" + Tools.toPseudo(full)); + offsets = complexp.fullBidiCharOffsets(); + Tools.verify("fullBidiCharOffsets() LTR", offsets, resLTR); + complexp.assumeOrientation(IComplExpProcessor.ORIENT_RTL); + full = complexp.leanToFullText(lean); + System.out.println("RTL full=" + Tools.toPseudo(full)); + offsets = complexp.fullBidiCharOffsets(); + Tools.verify("fullBidiCharOffsets() RTL", offsets, resRTL); + complexp.assumeOrientation(IComplExpProcessor.ORIENT_CONTEXTUAL_LTR); + full = complexp.leanToFullText(lean); + System.out.println("CON full=" + Tools.toPseudo(full)); + offsets = complexp.fullBidiCharOffsets(); + Tools.verify("fullBidiCharOffsets() CON", offsets, resCon); + } + + static void doTestMirrored() + { + IComplExpProcessor complexp; + boolean mirrored; + + mirrored = ComplExpUtil.isMirroredDefault(); + Tools.verify("mirrored #1", mirrored, false); + complexp = StringProcessor.getProcessor(IBiDiProcessor.COMMA_DELIMITED); + mirrored = complexp.isMirrored(); + Tools.verify("mirrored #2", mirrored, false); + ComplExpUtil.assumeMirroredDefault(true); + mirrored = ComplExpUtil.isMirroredDefault(); + Tools.verify("mirrored #3", mirrored, true); + complexp = StringProcessor.getProcessor(IBiDiProcessor.COMMA_DELIMITED); + mirrored = complexp.isMirrored(); +// TBD: the following test cannot succeed with the current implementation. +// it will need allocating separate data for each processor use. +// Tools.verify("mirrored #4", mirrored, true); + complexp.assumeMirrored(false); + mirrored = complexp.isMirrored(); + Tools.verify("mirrored #5", mirrored, false); + } + + static void doTestDirection() + { + IComplExpProcessor complexp; + int[][] dir; + int[][] modir; + String data, lean, full, model; + + complexp = StringProcessor.getProcessor(IBiDiProcessor.COMMA_DELIMITED); + dir = complexp.getDirection(); + modir = new int[][]{{LTR,LTR},{LTR,LTR}}; + Tools.verify("direction #1", dir, modir); + + complexp.setDirection(RTL); + dir = complexp.getDirection(); + modir = new int[][]{{RTL,RTL},{RTL,RTL}}; + Tools.verify("direction #2", dir, modir); + + complexp.setDirection(LTR, RTL); + dir = complexp.getDirection(); + modir = new int[][]{{LTR,RTL},{LTR,RTL}}; + Tools.verify("direction #3", dir, modir); + + complexp.setArabicDirection(RTL); + dir = complexp.getDirection(); + modir = new int[][]{{RTL,RTL},{LTR,RTL}}; + Tools.verify("direction #4", dir, modir); + + complexp.setArabicDirection(RTL,LTR); + dir = complexp.getDirection(); + modir = new int[][]{{RTL,LTR},{LTR,RTL}}; + Tools.verify("direction #5", dir, modir); + + complexp.setHebrewDirection(RTL); + dir = complexp.getDirection(); + modir = new int[][]{{RTL,LTR},{RTL,RTL}}; + Tools.verify("direction #6", dir, modir); + + complexp.setHebrewDirection(RTL, LTR); + dir = complexp.getDirection(); + modir = new int[][]{{RTL,LTR},{RTL,LTR}}; + Tools.verify("direction #7", dir, modir); + + complexp = StringProcessor.getProcessor(IBiDiProcessor.EMAIL); + complexp.assumeMirrored(false); + complexp.setArabicDirection(LTR,RTL); + complexp.setHebrewDirection(LTR, LTR); + data = "#ABC.#DEF:HOST.com"; + System.out.println(">>> text=" + data); + lean = Tools.toUT16(data); + full = complexp.leanToFullText(lean); + model = "#ABC@.#DEF@:HOST.com"; + Tools.verify("full", full, model); + + data = "ABC.DEF:HOST.com"; + System.out.println(">>> text=" + data); + lean = Tools.toUT16(data); + full = complexp.leanToFullText(lean); + model = "ABC@.DEF@:HOST.com"; + Tools.verify("full", full, model); + + complexp.assumeMirrored(true); + data = "#ABC.#DEF:HOST.com"; + System.out.println(">>> text=" + data); + lean = Tools.toUT16(data); + full = complexp.leanToFullText(lean); + model = "<&#ABC.#DEF:HOST.com&^"; + Tools.verify("full", full, model); + + data = "#ABc.#DEF:HOSt.COM"; + System.out.println(">>> text=" + data); + lean = Tools.toUT16(data); + full = complexp.leanToFullText(lean); + model = "<&#ABc.#DEF:HOSt.COM&^"; + Tools.verify("full", full, model); + + data = "#ABc.#DEF:HOSt."; + System.out.println(">>> text=" + data); + lean = Tools.toUT16(data); + full = complexp.leanToFullText(lean); + model = "<&#ABc.#DEF:HOSt.&^"; + Tools.verify("full", full, model); + + data = "ABC.DEF:HOST.com"; + System.out.println(">>> text=" + data); + lean = Tools.toUT16(data); + full = complexp.leanToFullText(lean); + model = "ABC@.DEF@:HOST.com"; + Tools.verify("full", full, model); + + data = "--.---:----"; + System.out.println(">>> text=" + data); + lean = Tools.toUT16(data); + full = complexp.leanToFullText(lean); + model = "--.---:----"; + Tools.verify("full", full, model); + + data = "ABC.|DEF:HOST.com"; + System.out.println(">>> text=" + data); + lean = Tools.toUT16(data); + full = complexp.leanToFullText(lean); + model = "ABC.|DEF@:HOST.com"; + Tools.verify("full", full, model); + + complexp.assumeOrientation(IComplExpProcessor.ORIENT_RTL); + data = "#ABc.|#DEF:HOST.com"; + System.out.println(">>> text=" + data); + lean = Tools.toUT16(data); + full = complexp.leanToFullText(lean); + model = "#ABc.|#DEF:HOST.com"; + Tools.verify("full", full, model); + } + + public static void testMethods() { + IComplExpProcessor complexp; + + Tools.separ("MethodsTest"); + System.out.println(); + System.out.println(); + System.out.println(">>>>>>>>>> Test leanToFullText with initial state <<<<<<<<<<"); + System.out.println(); + complexp = StringProcessor.getProcessor(IBiDiProcessor.JAVA); + doTestState(complexp); + + System.out.println(); + System.out.println(); + System.out.println(">>>>>>>>>> Test Orientation <<<<<<<<<<"); + System.out.println(); + doTestOrientation(); + + System.out.println(); + System.out.println(); + System.out.println(">>>>>>>>>> Test Orient <<<<<<<<<<"); + System.out.println(); + complexp = StringProcessor.getProcessor(IBiDiProcessor.COMMA_DELIMITED); + doTestOrient(complexp, "", "", "", ""); + doTestOrient(complexp, "abc", "abc", ">@abc@^", "abc"); + doTestOrient(complexp, "ABC", "ABC", ">@ABC@^", "@ABC"); + doTestOrient(complexp, "bcd,ef", "bcd,ef", ">@bcd,ef@^", "bcd,ef"); + doTestOrient(complexp, "BCD,EF", "BCD@,EF", ">@BCD@,EF@^", "@BCD@,EF"); + doTestOrient(complexp, "cde,FG", "cde,FG", ">@cde,FG@^", "cde,FG"); + doTestOrient(complexp, "CDE,fg", "CDE,fg", ">@CDE,fg@^", "@CDE,fg"); + doTestOrient(complexp, "12..def,GH", "12..def,GH", ">@12..def,GH@^", "12..def,GH"); + doTestOrient(complexp, "34..DEF,gh", "34..DEF,gh", ">@34..DEF,gh@^", "@34..DEF,gh"); + + System.out.println(); + System.out.println(); + System.out.println(">>>>>>>>>> Test Scripts <<<<<<<<<<"); + System.out.println(); + doTestScripts(complexp); + + System.out.println(); + System.out.println(); + System.out.println(">>>>>>>>>> Test leanBidiCharOffsets() <<<<<<<<<<"); + System.out.println(); + complexp = StringProcessor.getProcessor(IBiDiProcessor.JAVA); + doTestLeanOffsets(complexp); + + System.out.println(); + System.out.println(); + System.out.println(">>>>>>>>>> Test fullBidiCharOffsets() <<<<<<<<<<"); + System.out.println(); + complexp = StringProcessor.getProcessor(IBiDiProcessor.COMMA_DELIMITED); + doTestFullOffsets(complexp, "BCD,EF,G", new int[]{3,7}, + new int[]{0,1,5,9,12,13}, new int[]{0,4,8}); + + System.out.println(); + System.out.println(); + System.out.println(">>>>>>>>>> Test mirrored <<<<<<<<<<"); + System.out.println(); + doTestMirrored(); + + System.out.println(); + System.out.println(); + System.out.println(">>>>>>>>>> Test Direction <<<<<<<<<<"); + System.out.println(); + doTestDirection(); + + System.out.println(); + System.out.println(); + System.out.println(">>>>>>>>>> Test Many Inserts <<<<<<<<<<"); + System.out.println(); + complexp = StringProcessor.getProcessor(IBiDiProcessor.COMMA_DELIMITED); + complexp.assumeOrientation(IComplExpProcessor.ORIENT_LTR); + complexp.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 = Tools.toUT16(data); + String full = complexp.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"; + Tools.verify("many inserts", full, model); + + Tools.printStepErrorCount(); + } +} Index: src/org/eclipse/equinox/bidi/internal/tests/Tools.java =================================================================== RCS file: src/org/eclipse/equinox/bidi/internal/tests/Tools.java diff -N src/org/eclipse/equinox/bidi/internal/tests/Tools.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ src/org/eclipse/equinox/bidi/internal/tests/Tools.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,413 @@ +/******************************************************************************* + * 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.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; + +/** + * Tools: common methods and their test. + */ + +public class Tools extends TestCase { + public static Test suite() { + return new TestSuite(Tools.class); + } + + public Tools() { + super(); + } + + public Tools(String name) { + super(name); + } + + static final char LRM = 0x200E; + static final char RLM = 0x200F; + static final char LRE = 0x202A; + static final char RLE = 0x202B; + static final char PDF = 0x202C; + + static int errCnt; + static int errCntTotal; + static boolean isTestingTheTools; + + static String toPseudo(String text) + { + char[] chars = text.toCharArray(); + int len = chars.length; + char c; + int i; + for (i = 0; i < len; i++) { + 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); + } + + static String toUT16(String text) + { + char[] chars = text.toCharArray(); + int len = chars.length; + char c; + int i; + for (i = 0; i < len; i++) { + c = chars[i]; + if (c >= '5' && c <= '9') { + chars[i] = (char)(0x0665 + c - '5'); + } + 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 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 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 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(); + } + + static boolean verify(String msg, int result, int expected) + { + System.out.println("Testing: " + msg); + System.out.println(" result = " + result); + if (result != expected) { + System.out.println("!!! ******* ERROR ******* !!!"); + System.out.println(" result = " + result); + System.out.println(" expected = " + expected); + errCnt++; + if (!isTestingTheTools) + assertEquals(expected, result); + return false; + } + return true; + } + + static boolean verify(String msg, boolean result, boolean expected) + { + System.out.println("Testing: " + msg); + System.out.println(" result = " + result); + if (result != expected) { + System.out.println("!!! ******* ERROR ******* !!!"); + System.out.println(" result = " + result); + System.out.println(" expected = " + expected); + errCnt++; + if (!isTestingTheTools) + assertEquals(expected, result); + return false; + } + return true; + } + + static boolean verify(String msg, String result, String expected) + { + System.out.println("Testing: " + msg); + String presult = Tools.toPseudo(result); + System.out.println(" result = " + presult); + if (!presult.equals(expected)) { + System.out.println("!!! ******* ERROR ******* !!!"); + System.out.println(" result = " + presult); + System.out.println(" expected = " + expected); + errCnt++; + if (!isTestingTheTools) + assertEquals(expected, presult); + return false; + } + return true; + } + + static boolean verify(String msg, int[] result, int[] expected) + { + System.out.println("Testing: " + msg); + System.out.println(" result = " + array_display(result)); + if (!arrays_equal(result, expected)) { + System.out.println("!!! ******* ERROR ******* !!!"); + System.out.println(" result = " + array_display(result)); + System.out.println(" expected = " + array_display(expected)); + errCnt++; + if (!isTestingTheTools) + assertEquals(expected, result); + return false; + } + return true; + } + + static boolean verify(String msg, int[][] result, int[][] expected) + { + System.out.println("Testing: " + msg); + System.out.println(" result = " + array2_display(result)); + if (!arrays2_equal(result, expected)) { + System.out.println("!!! ******* ERROR ******* !!!"); + System.out.println(" result = " + array2_display(result)); + System.out.println(" expected = " + array2_display(expected)); + errCnt++; + if (!isTestingTheTools) + assertEquals(expected, result); + return false; + } + return true; + } + + static void printStepErrorCount() + { + System.out.println(); + System.out.println(); + if (errCnt == 0) { + System.out.println("No errors were found."); + } else { + System.out.println("******* " + errCnt + " errors were found !!!!!!!"); + errCntTotal += errCnt; + errCnt = 0; + } + System.out.println(); + } + + static void printTotalErrorCount() + { + errCntTotal += errCnt; + errCnt = 0; + System.out.println(); + System.out.println(); + if (errCntTotal == 0) { + System.out.println("No total errors were found."); + } else { + System.out.println("******* " + errCntTotal + " total errors were found !!!!!!!"); + errCntTotal = 0; + } + System.out.println(); + } + + static void separ(String text) + { + System.out.println(); + System.out.println(); + System.out.println(); + System.out.println("*======================================*"); + System.out.println("* *"); + System.out.println(" " + text); + System.out.println("* *"); + System.out.println("*======================================*"); + System.out.println(); + System.out.println(); + } + + public static void testTools() { + separ("Test Tools"); + // The following statements are meant to test the methods within + // this file. + isTestingTheTools = true; + 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); + + assertTrue(verify("An error is NOT expected below", 0, 0)); + + assertFalse(verify("An error is expected below", 0, 1)); + + assertTrue(verify("An error is NOT expected below", true, true)); + + assertFalse(verify("An error is expected below", true, false)); + + assertTrue(verify("An error is NOT expected below", "abc", "abc")); + + assertFalse(verify("An error is expected below", "abc", "def")); + + assertTrue(verify("An error is NOT expected below", new int[]{0,1}, new int[]{0,1})); + + assertFalse(verify("An error is expected below", new int[]{0,1}, new int[]{2,3})); + + assertTrue(verify("An error is NOT expected below", new int[][]{{0,1},{2,3}}, new int[][]{{0,1},{2,3}})); + + assertFalse(verify("An error is expected below", new int[][]{{0,1},{2,3}}, new int[][]{{4,5},{6,7}})); + System.out.println(); + System.out.println(); + System.out.println("....... The next line should show 5 errors"); + assertEquals(5, errCnt); + printStepErrorCount(); + errCnt = 9; + System.out.println(); + System.out.println(); + System.out.println("....... The next line should show 9 errors"); + assertEquals(9, errCnt); + printStepErrorCount(); + System.out.println(); + System.out.println(); + System.out.println("....... The next line should show 14 total errors"); + assertEquals(14, errCntTotal); + printTotalErrorCount(); + errCnt = 0; + errCntTotal = 0; + System.out.println(); + System.out.println(); + System.out.println("....... Reset error counters to zero"); + printStepErrorCount(); + printTotalErrorCount(); + isTestingTheTools = false; + } +} Index: src/org/eclipse/equinox/bidi/tests/BiDiTestSuite.java =================================================================== RCS file: /cvsroot/rt/org.eclipse.equinox/components/bundles/org.eclipse.equinox.bidi.tests/src/org/eclipse/equinox/bidi/tests/BiDiTestSuite.java,v retrieving revision 1.1 diff -u -r1.1 BiDiTestSuite.java --- src/org/eclipse/equinox/bidi/tests/BiDiTestSuite.java 3 Feb 2010 20:08:12 -0000 1.1 +++ src/org/eclipse/equinox/bidi/tests/BiDiTestSuite.java 23 Feb 2010 23:46:52 -0000 @@ -11,7 +11,7 @@ package org.eclipse.equinox.bidi.tests; -import org.eclipse.equinox.bidi.internal.tests.ExtensibilityTest; +import org.eclipse.equinox.bidi.internal.tests.*; import junit.framework.Test; import junit.framework.TestSuite; @@ -23,5 +23,13 @@ public BiDiTestSuite() { addTestSuite(ExtensibilityTest.class); + addTestSuite(Tools.class); +// addTestSuite(TestDoNothing.class); + addTestSuite(FullToLeanTest.class); + addTestSuite(MethodsTest.class); + addTestSuite(ComplExpMathTest.class); +// TBD: TestSubclass + addTestSuite(ExtensionsTest.class); + addTestSuite(ComplExpUtilTest.class); } }