Examples of UScriptRun


Examples of com.ibm.icu.lang.UScriptRun

        }
    }

    public void TestContstruction()
    {
        UScriptRun scriptRun = null;
        char[] nullChars  = null, dummyChars  = {'d', 'u', 'm', 'm', 'y'};
        String nullString = null, dummyString = new String(dummyChars);
       
        try {
            scriptRun = new UScriptRun(nullString, 0, 100);
            errln("new UScriptRun(nullString, 0, 100) did not produce an IllegalArgumentException!");
        } catch (IllegalArgumentException iae) {
            logln("PASS: UScriptRun failed as expected");
        }
       
        try {
            scriptRun = new UScriptRun(nullString, 100, 0);
            errln("new UScriptRun(nullString, 100, 0) did not produce an IllegalArgumentException!");
        } catch (IllegalArgumentException iae) {
            logln("PASS: UScriptRun failed as expected");
        }
       
        try {
            scriptRun = new UScriptRun(nullString, 0, -100);
            errln("new UScriptRun(nullString, 0, -100) did not produce an IllegalArgumentException!");
        } catch (IllegalArgumentException iae) {
            logln("PASS: UScriptRun failed as expected");
        }
       
        try {
            scriptRun = new UScriptRun(nullString, -100, 0);
            errln("new UScriptRun(nullString, -100, 0) did not produce an IllegalArgumentException!");
        } catch (IllegalArgumentException iae) {
            logln("PASS: UScriptRun failed as expected");
        }
       
        try {
            scriptRun = new UScriptRun(nullChars, 0, 100);
            errln("new UScriptRun(nullChars, 0, 100) did not produce an IllegalArgumentException!");
        } catch (IllegalArgumentException iae) {
            logln("PASS: UScriptRun failed as expected");
        }
       
        try {
            scriptRun = new UScriptRun(nullChars, 100, 0);
            errln("new UScriptRun(nullChars, 100, 0) did not produce an IllegalArgumentException!");
        } catch (IllegalArgumentException iae) {
            logln("PASS: UScriptRun failed as expected");
        }
       
        try {
            scriptRun = new UScriptRun(nullChars, 0, -100);
            errln("new UScriptRun(nullChars, 0, -100) did not produce an IllegalArgumentException!");
        } catch (IllegalArgumentException iae) {
            logln("PASS: UScriptRun failed as expected");
        }
       
        try {
            scriptRun = new UScriptRun(nullChars, -100, 0);
            errln("new UScriptRun(nullChars, -100, 0) did not produce an IllegalArgumentException!");
        } catch (IllegalArgumentException iae) {
            logln("PASS: UScriptRun failed as expected");
        }
       
        try {
            scriptRun = new UScriptRun(dummyString, 0, 6);
            errln("new UScriptRun(dummyString, 0, 6) did not produce an IllegalArgumentException!");
        } catch (IllegalArgumentException iae) {
            logln("PASS: UScriptRun failed as expected");
        }
       
        try {
            scriptRun = new UScriptRun(dummyString, 6, 0);
            errln("new UScriptRun(dummy, 6, 0) did not produce an IllegalArgumentException!");
        }catch (IllegalArgumentException iae) {
            logln("PASS: UScriptRun failed as expected");
        }
       
        try {
            scriptRun = new UScriptRun(dummyString, 0, -100);
            errln("new UScriptRun(dummyString, 0, -100) did not produce an IllegalArgumentException!");
        } catch (IllegalArgumentException iae) {
            logln("PASS: UScriptRun failed as expected");
        }
       
        try {
            scriptRun = new UScriptRun(dummyString, -100, 0);
            errln("new UScriptRun(dummy, -100, 0) did not produce an IllegalArgumentException!");
        } catch (IllegalArgumentException iae) {
            logln("PASS: UScriptRun failed as expected");
        }
       
        try {
            scriptRun = new UScriptRun(dummyChars, 0, 6);
            errln("new UScriptRun(dummyChars, 0, 6) did not produce an IllegalArgumentException!");
        } catch (IllegalArgumentException iae) {
            logln("PASS: UScriptRun failed as expected");
        }
       
        try {
            scriptRun = new UScriptRun(dummyChars, 6, 0);
            errln("new UScriptRun(dummyChars, 6, 0) did not produce an IllegalArgumentException!");
        }catch (IllegalArgumentException iae) {
            logln("PASS: UScriptRun failed as expected");
        }
       
        try {
            scriptRun = new UScriptRun(dummyChars, 0, -100);
            errln("new UScriptRun(dummyChars, 0, -100) did not produce an IllegalArgumentException!");
        } catch (IllegalArgumentException iae) {
            logln("PASS: UScriptRun failed as expected");
        }
       
        try {
            scriptRun = new UScriptRun(dummyChars, -100, 0);
            errln("new UScriptRun(dummy, -100, 0) did not produce an IllegalArgumentException!");
        } catch (IllegalArgumentException iae) {
            logln("PASS: UScriptRun failed as expected");
        }
        if(scriptRun!=null){
View Full Code Here

Examples of com.ibm.icu.lang.UScriptRun

        }
    }
   
    public void TestReset()
    {
        UScriptRun scriptRun = null;
        char[] dummy = {'d', 'u', 'm', 'm', 'y'};
       
        try {
            scriptRun = new UScriptRun();
        } catch (IllegalArgumentException iae) {
            errln("new UScriptRun() produced an IllegalArgumentException!");
        }
       
        try {
            scriptRun.reset(0, 100);
            errln("scriptRun.reset(0, 100) did not produce an IllegalArgumentException!");
        } catch (IllegalArgumentException iae) {
            logln("PASS: scriptRun.reset failed as expected");
        }
       
        try {
            scriptRun.reset(100, 0);
            errln("scriptRun.reset(100, 0) did not produce an IllegalArgumentException!");
        } catch (IllegalArgumentException iae) {
            logln("PASS: scriptRun.reset failed as expected");
        }
       
        try {
            scriptRun.reset(0, -100);
            errln("scriptRun.reset(0, -100) did not produce an IllegalArgumentException!");
        } catch (IllegalArgumentException iae) {
            logln("PASS: scriptRun.reset failed as expected");
        }
       
        try {
            scriptRun.reset(-100, 0);
            errln("scriptRun.reset(-100, 0) did not produce an IllegalArgumentException!");
        } catch (IllegalArgumentException iae) {
            logln("PASS: scriptRun.reset failed as expected");
        }
       
        try {
            scriptRun.reset(dummy, 0, 6);
            errln("scriptRun.reset(dummy, 0, 6) did not produce an IllegalArgumentException!");
        } catch (IllegalArgumentException iae) {
            logln("PASS: scriptRun.reset failed as expected");
        }
       
        try {
            scriptRun.reset(dummy, 6, 0);
            errln("scriptRun.reset(dummy, 6, 0) did not produce an IllegalArgumentException!");
        }catch (IllegalArgumentException iae) {
            logln("PASS: scriptRun.reset failed as expected");
        }
       
        try {
            scriptRun.reset(dummy, 0, -100);
            errln("scriptRun.reset(dummy, 0, -100) did not produce an IllegalArgumentException!");
        } catch (IllegalArgumentException iae) {
            logln("PASS: scriptRun.reset failed as expected");
        }
       
        try {
            scriptRun.reset(dummy, -100, 0);
            errln("scriptRun.reset(dummy, -100, 0) did not produce an IllegalArgumentException!");
        } catch (IllegalArgumentException iae) {
            logln("PASS: scriptRun.reset failed as expected");
        }
       
        try {
            scriptRun.reset(dummy, 0, dummy.length);
        } catch (IllegalArgumentException iae) {
            errln("scriptRun.reset(dummy, 0, dummy.length) produced an IllegalArgumentException!");
        }
       
       
        try {
            scriptRun.reset(0, 6);
            errln("scriptRun.reset(0, 6) did not produce an IllegalArgumentException!");
        } catch (IllegalArgumentException iae) {
            logln("PASS: scriptRun.reset failed as expected");
        }
       
        try {
            scriptRun.reset(6, 0);
            errln("scriptRun.reset(6, 0) did not produce an IllegalArgumentException!");
        } catch (IllegalArgumentException iae) {
            logln("PASS: scriptRun.reset failed as expected");
        }
    }
View Full Code Here

Examples of com.ibm.icu.lang.UScriptRun

        for (int i = 0; i < m_testData.length; i += 1) {
            RunTestData[] test = m_testData[i];
            int stringLimit = 0;
            int[] runStarts = new int[test.length + 1];
            String testString = "";
            UScriptRun scriptRun = null;
       
            /*
             * Fill in the test string and the runStarts array.
             */
            for (int run = 0; run < test.length; run += 1) {
                runStarts[run] = stringLimit;
                stringLimit += test[run].runText.length();
                testString  += test[run].runText;
            }

            /* The limit of the last run */
            runStarts[test.length] = stringLimit;
       
            try {
                scriptRun = new UScriptRun(testString);
                CheckScriptRuns(scriptRun, runStarts, test);
            } catch (IllegalArgumentException iae) {
                errln("new UScriptRun(testString) produced an IllegalArgumentException!");
            }
       
            try {
                scriptRun.reset();
                CheckScriptRuns(scriptRun, runStarts, test);
            } catch (IllegalArgumentException iae) {
                errln("scriptRun.reset() on a valid UScriptRun produced an IllegalArgumentException!");
            }
       
            try {
                scriptRun = new UScriptRun(testString.toCharArray());
                CheckScriptRuns(scriptRun, runStarts, test);
            } catch (IllegalArgumentException iae) {
                errln("new UScriptRun(testString.toCharArray()) produced an IllegalArgumentException!");
            }
       
            try {
                scriptRun.reset();
                CheckScriptRuns(scriptRun, runStarts, test);
            } catch (IllegalArgumentException iae) {
                errln("scriptRun.reset() on a valid UScriptRun produced an IllegalArgumentException!");
            }
       
            try {
                scriptRun = new UScriptRun();
           
                if (scriptRun.next()) {
                    errln("scriptRun.next() on an empty UScriptRun returned true!");
                }
            } catch (IllegalArgumentException iae) {
                errln("new UScriptRun() produced an IllegalArgumentException!");
            }
       
            try {
                scriptRun.reset(testString, 0, testString.length());
                CheckScriptRuns(scriptRun, runStarts, test);
            } catch (IllegalArgumentException iae) {
                errln("scriptRun.reset(testString, 0, testString.length) produced an IllegalArgumentException!");
            }

            try {
                scriptRun.reset(testString.toCharArray(), 0, testString.length());
                CheckScriptRuns(scriptRun, runStarts, test);
            } catch (IllegalArgumentException iae) {
                errln("scriptRun.reset(testString.toCharArray(), 0, testString.length) produced an IllegalArgumentException!");
            }

            String paddedTestString = padding + testString + padding;
            int startOffset = padding.length();
            int count = testString.length();
           
            for (int run = 0; run < runStarts.length; run += 1) {
                runStarts[run] += startOffset;
            }
           
            try {
                scriptRun.reset(paddedTestString, startOffset, count);
                CheckScriptRuns(scriptRun, runStarts, test);
            } catch (IllegalArgumentException iae) {
                errln("scriptRun.reset(paddedTestString, startOffset, count) produced an IllegalArgumentException!");
            }

            try {
                scriptRun.reset(paddedTestString.toCharArray(), startOffset, count);
                CheckScriptRuns(scriptRun, runStarts, test);
            } catch (IllegalArgumentException iae) {
                errln("scriptRun.reset(paddedTestString.toCharArray(), startOffset, count) produced an IllegalArgumentException!");
            }
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.