text:
/* GENERATED SOURCE. DO NOT MODIFY. */
// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html#License
/*
*******************************************************************************
* Copyright (C) 1996-2014, International Business Machines Corporation and    *
* others. All Rights Reserved.                                                *
*******************************************************************************
*/

package android.icu.dev.test.lang;

import org.junit.Test;

import android.icu.dev.test.TestFmwk;
import android.icu.dev.test.UTF16Util;
import android.icu.impl.Utility;
import android.icu.lang.UCharacter;
import android.icu.text.ReplaceableString;
import android.icu.text.UTF16;
import android.icu.text.UTF16.StringComparator;

/**
* Testing class for UTF16
* @author Syn Wee Quek
* @since feb 09 2001
*/
public final class UTF16Test extends TestFmwk
{
    // constructor ===================================================

    /**
     * Constructor
     */
    public UTF16Test()
    {
    }

    // public methods ================================================

    /**
     * Testing UTF16 class methods append
     */
    @Test
    public void TestAppend()
    {
          StringBuffer strbuff = new StringBuffer("this is a string ");
          char array[] = new char[UCharacter.MAX_VALUE >> 2];
          int strsize = strbuff.length();
          int arraysize = strsize;

          if (0 != strsize) {
            strbuff.getChars(0, strsize, array, 0);
        }
          for (int i = 1; i < UCharacter.MAX_VALUE; i += 100) {
        UTF16.append(strbuff, i);
        arraysize = UTF16.append(array, arraysize, i);

        String arraystr = new String(array, 0, arraysize);
        if (!arraystr.equals(strbuff.toString())) {
        errln("FAIL Comparing char array append and string append " +
              "with 0x" + Integer.toHexString(i));
        }

        // this is to cater for the combination of 0xDBXX 0xDC50 which
        // forms a supplementary character
        if (i == 0xDC51) {
        strsize --;
        }

        if (UTF16.countCodePoint(strbuff) != strsize + (i / 100) + 1) {
        errln("FAIL Counting code points in string appended with " +
              " 0x" + Integer.toHexString(i));
        break;
        }
    }

    // coverage for new 1.5 - cover only so no real test
    strbuff = new StringBuffer();
    UTF16.appendCodePoint(strbuff, 0x10000);
    if (strbuff.length() != 2) {
        errln("fail appendCodePoint");
    }
    }

    /**
     * Testing UTF16 class methods bounds
     */
    @Test
    public void TestBounds()
    {
          StringBuffer strbuff =
                        //0     12345     6     7     8     9
        new StringBuffer("\udc000123\ud800\udc00\ud801\udc01\ud802");
          String str = strbuff.toString();
          char array[] = str.toCharArray();
          int boundtype[] = {UTF16.SINGLE_CHAR_BOUNDARY,
               UTF16.SINGLE_CHAR_BOUNDARY,
               UTF16.SINGLE_CHAR_BOUNDARY,
               UTF16.SINGLE_CHAR_BOUNDARY,
               UTF16.SINGLE_CHAR_BOUNDARY,
               UTF16.LEAD_SURROGATE_BOUNDARY,
               UTF16.TRAIL_SURROGATE_BOUNDARY,
               UTF16.LEAD_SURROGATE_BOUNDARY,
               UTF16.TRAIL_SURROGATE_BOUNDARY,
               UTF16.SINGLE_CHAR_BOUNDARY};
          int length = str.length();
          for (int i = 0; i < length; i ++) {
        if (UTF16.bounds(str, i) != boundtype[i]) {
                  errln("FAIL checking bound type at index " + i);
        }
        if (UTF16.bounds(strbuff, i) != boundtype[i]) {
                  errln("FAIL checking bound type at index " + i);
        }
        if (UTF16.bounds(array, 0, length, i) != boundtype[i]) {
                  errln("FAIL checking bound type at index " + i);
        }
          }
          // does not straddle between supplementary character
          int start = 4;
          int limit = 9;
          int subboundtype1[] = {UTF16.SINGLE_CHAR_BOUNDARY,
                   UTF16.LEAD_SURROGATE_BOUNDARY,
                   UTF16.TRAIL_SURROGATE_BOUNDARY,
                   UTF16.LEAD_SURROGATE_BOUNDARY,
                   UTF16.TRAIL_SURROGATE_BOUNDARY};
          try {
        UTF16.bounds(array, start, limit, -1);
        errln("FAIL Out of bounds index in bounds should fail");
          } catch (Exception e) {
        // getting rid of warnings
        System.out.print("");
          }

          for (int i = 0; i < limit - start; i ++) {
        if (UTF16.bounds(array, start, limit, i) != subboundtype1[i]) {
                  errln("FAILED Subarray bounds in [" + start + ", " + limit +
              "] expected " + subboundtype1[i] + " at offset " + i);
        }
          }

          // starts from the mid of a supplementary character
          int subboundtype2[] = {UTF16.SINGLE_CHAR_BOUNDARY,
                   UTF16.LEAD_SURROGATE_BOUNDARY,
                   UTF16.TRAIL_SURROGATE_BOUNDARY};

          start = 6;
          limit = 9;
          for (int i = 0; i < limit - start; i ++) {
        if (UTF16.bounds(array, start, limit, i) != subboundtype2[i]) {
                  errln("FAILED Subarray bounds in [" + start + ", " + limit +
              "] expected " + subboundtype2[i] + " at offset " + i);
        }
          }

          // ends in the mid of a supplementary character
          int subboundtype3[] = {UTF16.LEAD_SURROGATE_BOUNDARY,
                   UTF16.TRAIL_SURROGATE_BOUNDARY,
                   UTF16.SINGLE_CHAR_BOUNDARY};
          start = 5;
          limit = 8;
          for (int i = 0; i < limit - start; i ++) {
        if (UTF16.bounds(array, start, limit, i) != subboundtype3[i]) {
                  errln("FAILED Subarray bounds in [" + start + ", " + limit +
              "] expected " + subboundtype3[i] + " at offset " + i);
        }
          }
    }

    /**
     * Testing UTF16 class methods charAt and charAtCodePoint
     */
    @Test
    public void TestCharAt()
    {
          StringBuffer strbuff =
        new StringBuffer("12345\ud800\udc0167890\ud800\udc02");
          if (UTF16.charAt(strbuff, 0) != '1' || UTF16.charAt(strbuff, 2) != '3'
              || UTF16.charAt(strbuff, 5) != 0x10001 ||
        UTF16.charAt(strbuff, 6) != 0x10001 ||
        UTF16.charAt(strbuff, 12) != 0x10002 ||
        UTF16.charAt(strbuff, 13) != 0x10002) {
        errln("FAIL Getting character from string buffer error" );
          }
          String str = strbuff.toString();
          if (UTF16.charAt(str, 0) != '1' || UTF16.charAt(str, 2) != '3' ||
        UTF16.charAt(str, 5) != 0x10001 || UTF16.charAt(str, 6) != 0x10001
        || UTF16.charAt(str, 12) != 0x10002 ||
        UTF16.charAt(str, 13) != 0x10002)
        {
              errln("FAIL Getting character from string error" );
        }
          char array[] = str.toCharArray();
          int start = 0;
          int limit = str.length();
          if (UTF16.charAt(array, start, limit, 0) != '1' ||
        UTF16.charAt(array, start, limit, 2) != '3' ||
        UTF16.charAt(array, start, limit, 5) != 0x10001 ||
        UTF16.charAt(array, start, limit, 6) != 0x10001 ||
        UTF16.charAt(array, start, limit, 12) != 0x10002 ||
        UTF16.charAt(array, start, limit, 13) != 0x10002) {
        errln("FAIL Getting character from array error" );
          }
          // check the sub array here.
          start = 6;
          limit = 13;
          try {
        UTF16.charAt(array, start, limit, -1);
        errln("FAIL out of bounds error expected");
          } catch (Exception e) {
        System.out.print("");
          }
          try {
        UTF16.charAt(array, start, limit, 8);
        errln("FAIL out of bounds error expected");
          } catch (Exception e) {
        System.out.print("");
          }
          if (UTF16.charAt(array, start, limit, 0) != 0xdc01) {
        errln("FAIL Expected result in subarray 0xdc01");
          }
          if (UTF16.charAt(array, start, limit, 6) != 0xd800) {
        errln("FAIL Expected result in subarray 0xd800");
          }
          ReplaceableString replaceable = new ReplaceableString(str);
          if (UTF16.charAt(replaceable, 0) != '1' ||
              UTF16.charAt(replaceable, 2) != '3' ||
        UTF16.charAt(replaceable, 5) != 0x10001 ||
        UTF16.charAt(replaceable, 6) != 0x10001 ||
        UTF16.charAt(replaceable, 12) != 0x10002 ||
        UTF16.charAt(replaceable, 13) != 0x10002) {
        errln("FAIL Getting character from replaceable error" );
          }

          StringBuffer strbuffer = new StringBuffer("0xD805");
          UTF16.charAt((CharSequence)strbuffer, 0);
    }

    /**
     * Testing UTF16 class methods countCodePoint
     */
    @Test
    public void TestCountCodePoint()
    {
        StringBuffer strbuff = new StringBuffer("");
        char         array[] = null;
        if (UTF16.countCodePoint(strbuff) != 0 ||
        UTF16.countCodePoint("") != 0 ||
        UTF16.countCodePoint(array,0 ,0) != 0) {
        errln("FAIL Counting code points for empty strings");
        }

        strbuff = new StringBuffer("this is a string ");
        String str = strbuff.toString();
        array = str.toCharArray();
        int size = str.length();

        if (UTF16.countCodePoint(array, 0, 0) != 0) {
        errln("FAIL Counting code points for 0 offset array");
        }

        if (UTF16.countCodePoint(str) != size ||
        UTF16.countCodePoint(strbuff) != size ||
        UTF16.countCodePoint(array, 0, size) != size) {
        errln("FAIL Counting code points");
        }

        UTF16.append(strbuff, 0x10000);
        str = strbuff.toString();
        array = str.toCharArray();
        if (UTF16.countCodePoint(str) != size + 1 ||
        UTF16.countCodePoint(strbuff) != size + 1 ||
        UTF16.countCodePoint(array, 0, size + 1) != size + 1 ||
        UTF16.countCodePoint(array, 0, size + 2) != size + 1) {
        errln("FAIL Counting code points");
        }
        UTF16.append(strbuff, 0x61);
        str = strbuff.toString();
        array = str.toCharArray();
        if (UTF16.countCodePoint(str) != size + 2 ||
        UTF16.countCodePoint(strbuff) != size + 2 ||
        UTF16.countCodePoint(array, 0, size + 1) != size + 1 ||
        UTF16.countCodePoint(array, 0, size + 2) != size + 1 ||
        UTF16.countCodePoint(array, 0, size + 3) != size + 2) {
        errln("FAIL Counting code points");
        }
    }

    /**
     * Testing UTF16 class methods delete
     */
    @Test
    public void TestDelete()
    {                                        //01234567890123456
        StringBuffer strbuff = new StringBuffer("these are strings");
        int size = strbuff.length();
        char array[] = strbuff.toString().toCharArray();

        UTF16.delete(strbuff, 3);
        UTF16.delete(strbuff, 3);
        UTF16.delete(strbuff, 3);
        UTF16.delete(strbuff, 3);
        UTF16.delete(strbuff, 3);
        UTF16.delete(strbuff, 3);
        try {
        UTF16.delete(strbuff, strbuff.length());
        errln("FAIL deleting out of bounds character should fail");
        } catch (Exception e) {
        System.out.print("");
        }
        UTF16.delete(strbuff, strbuff.length() - 1);
        if (!strbuff.toString().equals("the string")) {
        errln("FAIL expected result after deleting characters is " +
          "\"the string\"");
        }

        size = UTF16.delete(array, size, 3);
        size = UTF16.delete(array, size, 3);
        size = UTF16.delete(array, size, 3);
        size = UTF16.delete(array, size, 3);
        size = UTF16.delete(array, size, 3);
        size = UTF16.delete(array, size, 3);
        try {
        UTF16.delete(array, size, size);
        errln("FAIL deleting out of bounds character should fail");
        } catch (Exception e) {
        System.out.print("");
        }
        size = UTF16.delete(array, size, size - 1);
        String str = new String(array, 0, size);
        if (!str.equals("the string")) {
        errln("FAIL expected result after deleting characters is " +
          "\"the string\"");
        }
    //012345678     9     01     2      3     4
        strbuff = new StringBuffer("string: \ud800\udc00 \ud801\udc01 \ud801\udc01");
        size = strbuff.length();
        array = strbuff.toString().toCharArray();

        UTF16.delete(strbuff, 8);
        UTF16.delete(strbuff, 8);
        UTF16.delete(strbuff, 9);
        UTF16.delete(strbuff, 8);
        UTF16.delete(strbuff, 9);
        UTF16.delete(strbuff, 6);
        UTF16.delete(strbuff, 6);
        if (!strbuff.toString().equals("string")) {
        errln("FAIL expected result after deleting characters is \"string\"");
        }

        size = UTF16.delete(array, size, 8);
        size = UTF16.delete(array, size, 8);
        size = UTF16.delete(array, size, 9);
        size = UTF16.delete(array, size, 8);
        size = UTF16.delete(array, size, 9);
        size = UTF16.delete(array, size, 6);
        size = UTF16.delete(array, size, 6);
        str = new String(array, 0, size);
        if (!str.equals("string")) {
        errln("FAIL expected result after deleting characters is \"string\"");
        }
    }

    /**
     * Testing findOffsetFromCodePoint and findCodePointOffset
     */
    @Test
    public void TestfindOffset()
    {
        // jitterbug 47
        String str = "a\uD800\uDC00b";
        StringBuffer strbuff = new StringBuffer(str);
        char array[] = str.toCharArray();
        int limit = str.length();
        if (UTF16.findCodePointOffset(str, 0) != 0 ||
        UTF16.findOffsetFromCodePoint(str, 0) != 0 ||
        UTF16.findCodePointOffset(strbuff, 0) != 0 ||
        UTF16.findOffsetFromCodePoint(strbuff, 0) != 0 ||
        UTF16.findCodePointOffset(array, 0, limit, 0) != 0 ||
        UTF16.findOffsetFromCodePoint(array, 0, limit, 0) != 0) {
        errln("FAIL Getting the first codepoint offset to a string with " +
          "supplementary characters");
        }
        if (UTF16.findCodePointOffset(str, 1) != 1 ||
        UTF16.findOffsetFromCodePoint(str, 1) != 1 ||
        UTF16.findCodePointOffset(strbuff, 1) != 1 ||
        UTF16.findOffsetFromCodePoint(strbuff, 1) != 1 ||
        UTF16.findCodePointOffset(array, 0, limit, 1) != 1 ||
        UTF16.findOffsetFromCodePoint(array, 0, limit, 1) != 1) {
        errln("FAIL Getting the second codepoint offset to a string with " +
          "supplementary characters");
        }
        if (UTF16.findCodePointOffset(str, 2) != 1 ||
        UTF16.findOffsetFromCodePoint(str, 2) != 3 ||
        UTF16.findCodePointOffset(strbuff, 2) != 1 ||
        UTF16.findOffsetFromCodePoint(strbuff, 2) != 3 ||
        UTF16.findCodePointOffset(array, 0, limit, 2) != 1 ||
        UTF16.findOffsetFromCodePoint(array, 0, limit, 2) != 3) {
        errln("FAIL Getting the third codepoint offset to a string with " +
          "supplementary characters");
        }
        if (UTF16.findCodePointOffset(str, 3) != 2 ||
        UTF16.findOffsetFromCodePoint(str, 3) != 4 ||
        UTF16.findCodePointOffset(strbuff, 3) != 2 ||
        UTF16.findOffsetFromCodePoint(strbuff, 3) != 4 ||
        UTF16.findCodePointOffset(array, 0, limit, 3) != 2 ||
        UTF16.findOffsetFromCodePoint(array, 0, limit, 3) != 4) {
        errln("FAIL Getting the last codepoint offset to a string with " +
          "supplementary characters");
        }
        if (UTF16.findCodePointOffset(str, 4) != 3 ||
        UTF16.findCodePointOffset(strbuff, 4) != 3 ||
        UTF16.findCodePointOffset(array, 0, limit, 4) != 3) {
        errln("FAIL Getting the length offset to a string with " +
          "supplementary characters");
        }
        try {
        UTF16.findCodePointOffset(str, 5);
        errln("FAIL Getting the a non-existence codepoint to a string " +
          "with supplementary characters");
        } catch (Exception e) {
        // this is a success
        logln("Passed out of bounds codepoint offset");
        }
        try {
        UTF16.findOffsetFromCodePoint(str, 4);
        errln("FAIL Getting the a non-existence codepoint to a string " +
          "with supplementary characters");
        } catch (Exception e) {
        // this is a success
        logln("Passed out of bounds codepoint offset");
        }
        try {
        UTF16.findCodePointOffset(strbuff, 5);
        errln("FAIL Getting the a non-existence codepoint to a string " +
          "with supplementary characters");
        } catch (Exception e) {
        // this is a success
        logln("Passed out of bounds codepoint offset");
        }
        try {
        UTF16.findOffsetFromCodePoint(strbuff, 4);
        errln("FAIL Getting the a non-existence codepoint to a string " +
          "with supplementary characters");
        } catch (Exception e) {
        // this is a success
        logln("Passed out of bounds codepoint offset");
        }
        try {
        UTF16.findCodePointOffset(array, 0, limit, 5);
        errln("FAIL Getting the a non-existence codepoint to a string " +
          "with supplementary characters");
        } catch (Exception e) {
        // this is a success
        logln("Passed out of bounds codepoint offset");
        }
        try {
        UTF16.findOffsetFromCodePoint(array, 0, limit, 4);
        errln("FAIL Getting the a non-existence codepoint to a string " +
          "with supplementary characters");
        } catch (Exception e) {
        // this is a success
        logln("Passed out of bounds codepoint offset");
        }

        if (UTF16.findCodePointOffset(array, 1, 3, 0) != 0 ||
        UTF16.findOffsetFromCodePoint(array, 1, 3, 0) != 0 ||
        UTF16.findCodePointOffset(array, 1, 3, 1) != 0 ||
        UTF16.findCodePointOffset(array, 1, 3, 2) != 1 ||
        UTF16.findOffsetFromCodePoint(array, 1, 3, 1) != 2) {
        errln("FAIL Getting valid codepoint offset in sub array");
        }
    }

    /**
     * Testing UTF16 class methods getCharCount, *Surrogate
     */
    @Test
    public void TestGetCharCountSurrogate()
    {
        if (UTF16.getCharCount(0x61) != 1 ||
        UTF16.getCharCount(0x10000) != 2) {
        errln("FAIL getCharCount result failure");
        }
        if (UTF16.getLeadSurrogate(0x61) != 0 ||
        UTF16.getTrailSurrogate(0x61) != 0x61 ||
        UTF16.isLeadSurrogate((char)0x61) ||
        UTF16.isTrailSurrogate((char)0x61) ||
        UTF16.getLeadSurrogate(0x10000) != 0xd800 ||
        UTF16.getTrailSurrogate(0x10000) != 0xdc00 ||
        UTF16.isLeadSurrogate((char)0xd800) != true ||
        UTF16.isTrailSurrogate((char)0xd800) ||
        UTF16.isLeadSurrogate((char)0xdc00) ||
        UTF16.isTrailSurrogate((char)0xdc00) != true) {
        errln("FAIL *Surrogate result failure");
        }

        if (UTF16.isSurrogate((char)0x61) || !UTF16.isSurrogate((char)0xd800)
            || !UTF16.isSurrogate((char)0xdc00)) {
        errln("FAIL isSurrogate result failure");
        }
    }

    /**
     * Testing UTF16 class method insert
     */
    @Test
    public void TestInsert()
    {
        StringBuffer strbuff = new StringBuffer("0123456789");
        char array[] = new char[128];
        int srcEnd = strbuff.length();
        if (0 != srcEnd) {
            strbuff.getChars(0, srcEnd, array, 0);
        }
        int length = 10;
        UTF16.insert(strbuff, 5, 't');
        UTF16.insert(strbuff, 5, 's');
        UTF16.insert(strbuff, 5, 'e');
        UTF16.insert(strbuff, 5, 't');
        if (!(strbuff.toString().equals("01234test56789"))) {
        errln("FAIL inserting \"test\"");
        }
        length = UTF16.insert(array, length, 5, 't');
        length = UTF16.insert(array, length, 5, 's');
        length = UTF16.insert(array, length, 5, 'e');
        length = UTF16.insert(array, length, 5, 't');
        String str = new String(array, 0, length);
        if (!(str.equals("01234test56789"))) {
        errln("FAIL inserting \"test\"");
        }
        UTF16.insert(strbuff, 0, 0x10000);
        UTF16.insert(strbuff, 11, 0x10000);
        UTF16.insert(strbuff, strbuff.length(), 0x10000);
        if (!(strbuff.toString().equals(
                    "\ud800\udc0001234test\ud800\udc0056789\ud800\udc00"))) {
        errln("FAIL inserting supplementary characters");
        }
        length = UTF16.insert(array, length, 0, 0x10000);
        length = UTF16.insert(array, length, 11, 0x10000);
        length = UTF16.insert(array, length, length, 0x10000);
        str = new String(array, 0, length);
        if (!(str.equals(
             "\ud800\udc0001234test\ud800\udc0056789\ud800\udc00"))) {
        errln("FAIL inserting supplementary characters");
        }

        try {
        UTF16.insert(strbuff, -1, 0);
        errln("FAIL invalid insertion offset");
        } catch (Exception e) {
        System.out.print("");
        }
        try {
        UTF16.insert(strbuff, 64, 0);
        errln("FAIL invalid insertion offset");
        } catch (Exception e) {
        System.out.print("");
        }
        try {
        UTF16.insert(array, length, -1, 0);
        errln("FAIL invalid insertion offset");
        } catch (Exception e) {
        System.out.print("");
        }
        try {
        UTF16.insert(array, length, 64, 0);
        errln("FAIL invalid insertion offset");
        } catch (Exception e) {
        System.out.print("");
        }
        try {
        // exceeded array size
        UTF16.insert(array, array.length, 64, 0);
        errln("FAIL invalid insertion offset");
        } catch (Exception e) {
        System.out.print("");
        }
    }

    /*
     * Testing moveCodePointOffset APIs
     */

    //
    //   checkMoveCodePointOffset
    //      Run a single test case through each of the moveCodePointOffset() functions.
    //          Parameters -
    //              s               The string to work in.
    //              startIdx        The starting position within the string.
    //              amount          The number of code points to move.
    //              expectedResult  The string index after the move, or -1 if the
    //                              function should throw an exception.
    private void checkMoveCodePointOffset(String s, int startIdx, int amount, int expectedResult) {
        // Test with the String flavor of moveCodePointOffset
        try {
            int result = UTF16.moveCodePointOffset(s, startIdx, amount);
            if (result != expectedResult) {
                errln("FAIL: UTF16.moveCodePointOffset(String \"" + s + "\", " + startIdx + ", " + amount + ")" +
                        " returned "  + result + ", expected result was " +
                        (expectedResult==-1 ? "exception" : Integer.toString(expectedResult)));
            }
        }
        catch (IndexOutOfBoundsException e) {
            if (expectedResult != -1) {
                errln("FAIL: UTF16.moveCodePointOffset(String \"" + s + "\", " + startIdx + ", " + amount + ")" +
                        " returned exception" + ", expected result was " + expectedResult);
            }
        }

        // Test with the StringBuffer flavor of moveCodePointOffset
        StringBuffer sb = new StringBuffer(s);
        try {
            int result = UTF16.moveCodePointOffset(sb, startIdx, amount);
            if (result != expectedResult) {
                errln("FAIL: UTF16.moveCodePointOffset(StringBuffer \"" + s + "\", " + startIdx + ", " + amount + ")" +
                        " returned "  + result + ", expected result was " +
                        (expectedResult==-1 ? "exception" : Integer.toString(expectedResult)));
            }
        }
        catch (IndexOutOfBoundsException e) {
            if (expectedResult != -1) {
                errln("FAIL: UTF16.moveCodePointOffset(StringBuffer \"" + s + "\", " + startIdx + ", " + amount + ")" +
                        " returned exception" + ", expected result was " + expectedResult);
            }
        }

        // Test with the char[] flavor of moveCodePointOffset
        char ca[] = s.toCharArray();
        try {
            int result = UTF16.moveCodePointOffset(ca, 0, s.length(), startIdx, amount);
            if (result != expectedResult) {
                errln("FAIL: UTF16.moveCodePointOffset(char[] \"" + s + "\", 0, " + s.length()
                        + ", " + startIdx + ", " + amount + ")" +
                        " returned "  + result + ", expected result was " +
                        (expectedResult==-1 ? "exception" : Integer.toString(expectedResult)));
            }
        }
        catch (IndexOutOfBoundsException e) {
            if (expectedResult != -1) {
                errln("FAIL: UTF16.moveCodePointOffset(char[] \"" + s + "\", 0, " + s.length()
                        + ", " + startIdx + ", " + amount + ")" +
                        " returned exception" + ", expected result was " + expectedResult);
            }
        }

        // Put the test string into the interior of a char array,
        //   run test on the subsection of the array.
        char ca2[] = new char[s.length()+2];
        ca2[0] = (char)0xd800;
        ca2[s.length()+1] = (char)0xd8ff;
        s.getChars(0, s.length(), ca2, 1);
        try {
            int result = UTF16.moveCodePointOffset(ca2, 1, s.length()+1, startIdx, amount);
            if (result != expectedResult) {
                errln("UTF16.moveCodePointOffset(char[] \"" + "." + s + ".\", 1, " + (s.length()+1)
                        + ", " + startIdx + ", " + amount + ")" +
                         " returned "  + result + ", expected result was " +
                        (expectedResult==-1 ? "exception" : Integer.toString(expectedResult)));
            }
        }
        catch (IndexOutOfBoundsException e) {
            if (expectedResult != -1) {
                errln("UTF16.moveCodePointOffset(char[] \"" + "." + s + ".\", 1, " + (s.length()+1)
                        + ", " + startIdx + ", " + amount + ")" +
                        " returned exception" + ", expected result was " + expectedResult);
            }
        }

    }

    @Test
    public void TestMoveCodePointOffset()
    {
        // checkMoveCodePointOffset(String, startIndex, amount, expected );  expected=-1 for exception.

        // No Supplementary chars
        checkMoveCodePointOffset("abc", 1,  1, 2);
        checkMoveCodePointOffset("abc", 1, -1, 0);
        checkMoveCodePointOffset("abc", 1, -2, -1);
        checkMoveCodePointOffset("abc", 1,  2, 3);
        checkMoveCodePointOffset("abc", 1,  3, -1);
        checkMoveCodePointOffset("abc", 1,  0, 1);

        checkMoveCodePointOffset("abc", 3, 0, 3);
        checkMoveCodePointOffset("abc", 4, 0, -1);
        checkMoveCodePointOffset("abc", 0, 0, 0);
        checkMoveCodePointOffset("abc", -1, 0, -1);

        checkMoveCodePointOffset("", 0, 0, 0);
        checkMoveCodePointOffset("", 0, -1, -1);
        checkMoveCodePointOffset("", 0, 1, -1);

        checkMoveCodePointOffset("a", 0, 0, 0);
        checkMoveCodePointOffset("a", 1, 0, 1);
        checkMoveCodePointOffset("a", 0, 1, 1);
        checkMoveCodePointOffset("a", 1, -1, 0);

        // Supplementary in middle of string
        checkMoveCodePointOffset("a\ud800\udc00b", 0, 1, 1);
        checkMoveCodePointOffset("a\ud800\udc00b", 0, 2, 3);
        checkMoveCodePointOffset("a\ud800\udc00b", 0, 3, 4);
        checkMoveCodePointOffset("a\ud800\udc00b", 0, 4, -1);

        checkMoveCodePointOffset("a\ud800\udc00b", 4, -1, 3);
        checkMoveCodePointOffset("a\ud800\udc00b", 4, -2, 1);
        checkMoveCodePointOffset("a\ud800\udc00b", 4, -3, 0);
        checkMoveCodePointOffset("a\ud800\udc00b", 4, -4, -1);

        // Supplementary at start of string
        checkMoveCodePointOffset("\ud800\udc00ab", 0, 1, 2);
        checkMoveCodePointOffset("\ud800\udc00ab", 1, 1, 2);
        checkMoveCodePointOffset("\ud800\udc00ab", 2, 1, 3);
        checkMoveCodePointOffset("\ud800\udc00ab", 2, -1, 0);
        checkMoveCodePointOffset("\ud800\udc00ab", 1, -1, 0);
        checkMoveCodePointOffset("\ud800\udc00ab", 0, -1, -1);

        // Supplementary at end of string
        checkMoveCodePointOffset("ab\ud800\udc00", 1, 1, 2);
        checkMoveCodePointOffset("ab\ud800\udc00", 2, 1, 4);
        checkMoveCodePointOffset("ab\ud800\udc00", 3, 1, 4);
        checkMoveCodePointOffset("ab\ud800\udc00", 4, 1, -1);

        checkMoveCodePointOffset("ab\ud800\udc00", 5, -2, -1);
        checkMoveCodePointOffset("ab\ud800\udc00", 4, -1, 2);
        checkMoveCodePointOffset("ab\ud800\udc00", 3, -1, 2);
        checkMoveCodePointOffset("ab\ud800\udc00", 2, -1, 1);
        checkMoveCodePointOffset("ab\ud800\udc00", 1, -1, 0);

        // Unpaired surrogate in middle
        checkMoveCodePointOffset("a\ud800b", 0, 1, 1);
        checkMoveCodePointOffset("a\ud800b", 1, 1, 2);
        checkMoveCodePointOffset("a\ud800b", 2, 1, 3);

        checkMoveCodePointOffset("a\udc00b", 0, 1, 1);
        checkMoveCodePointOffset("a\udc00b", 1, 1, 2);
        checkMoveCodePointOffset("a\udc00b", 2, 1, 3);

        checkMoveCodePointOffset("a\udc00\ud800b", 0, 1, 1);
        checkMoveCodePointOffset("a\udc00\ud800b", 1, 1, 2);
        checkMoveCodePointOffset("a\udc00\ud800b", 2, 1, 3);
        checkMoveCodePointOffset("a\udc00\ud800b", 3, 1, 4);

        checkMoveCodePointOffset("a\ud800b", 1, -1, 0);
        checkMoveCodePointOffset("a\ud800b", 2, -1, 1);
        checkMoveCodePointOffset("a\ud800b", 3, -1, 2);

        checkMoveCodePointOffset("a\udc00b", 1, -1, 0);
        checkMoveCodePointOffset("a\udc00b", 2, -1, 1);
        checkMoveCodePointOffset("a\udc00b", 3, -1, 2);

        checkMoveCodePointOffset("a\udc00\ud800b", 1, -1, 0);
        checkMoveCodePointOffset("a\udc00\ud800b", 2, -1, 1);
        checkMoveCodePointOffset("a\udc00\ud800b", 3, -1, 2);
        checkMoveCodePointOffset("a\udc00\ud800b", 4, -1, 3);

        // Unpaired surrogate at start
        checkMoveCodePointOffset("\udc00ab", 0, 1, 1);
        checkMoveCodePointOffset("\ud800ab", 0, 2, 2);
        checkMoveCodePointOffset("\ud800\ud800ab", 0, 3, 3);
        checkMoveCodePointOffset("\udc00\udc00ab", 0, 4, 4);

        checkMoveCodePointOffset("\udc00ab", 2, -1, 1);
        checkMoveCodePointOffset("\ud800ab", 1, -1, 0);
        checkMoveCodePointOffset("\ud800ab", 1, -2, -1);
        checkMoveCodePointOffset("\ud800\ud800ab", 2, -1, 1);
        checkMoveCodePointOffset("\udc00\udc00ab", 2, -2, 0);
        checkMoveCodePointOffset("\udc00\udc00ab", 2, -3, -1);

        // Unpaired surrogate at end
        checkMoveCodePointOffset("ab\udc00\udc00ab", 3, 1, 4);
        checkMoveCodePointOffset("ab\udc00\udc00ab", 2, 1, 3);
        checkMoveCodePointOffset("ab\udc00\udc00ab", 1, 1, 2);

        checkMoveCodePointOffset("ab\udc00\udc00ab", 4, -1, 3);
        checkMoveCodePointOffset("ab\udc00\udc00ab", 3, -1, 2);
        checkMoveCodePointOffset("ab\udc00\udc00ab", 2, -1, 1);

                               //01234567890     1     2     3     45678901234
        String str = new String("0123456789\ud800\udc00\ud801\udc010123456789");
        int move1[] = { 1,  2,  3,  4,  5,  6,  7,  8,  9, 10,
                       12, 12, 14, 14, 15, 16, 17, 18, 19, 20,
                       21, 22, 23, 24};
        int move2[] = { 2,  3,  4,  5,  6,  7,  8,  9, 10, 12,
                       14, 14, 15, 15, 16, 17, 18, 19, 20, 21,
                       22, 23, 24, -1};
        int move3[] = { 3,  4,  5,  6,  7,  8,  9, 10, 12, 14,
                       15, 15, 16, 16, 17, 18, 19, 20, 21, 22,
                       23, 24, -1, -1};
        int size = str.length();
        for (int i = 0; i < size; i ++) {
            checkMoveCodePointOffset(str, i, 1, move1[i]);
            checkMoveCodePointOffset(str, i, 2, move2[i]);
            checkMoveCodePointOffset(str, i, 3, move3[i]);
        }

        char strarray[] = str.toCharArray();
        if (UTF16.moveCodePointOffset(strarray, 9, 13, 0, 2) != 3) {
            errln("FAIL: Moving offset 0 by 2 codepoint in subarray [9, 13] " +
            "expected result 3");
        }
        if (UTF16.moveCodePointOffset(strarray, 9, 13, 1, 2) != 4) {
            errln("FAIL: Moving offset 1 by 2 codepoint in subarray [9, 13] " +
            "expected result 4");
        }
        if (UTF16.moveCodePointOffset(strarray, 11, 14, 0, 2) != 3) {
            errln("FAIL: Moving offset 0 by 2 codepoint in subarray [11, 14] "
                    + "expected result 3");
        }
    }

    /**
     * Testing UTF16 class methods setCharAt
     */
    @Test
    public void TestSetCharAt()
    {
        StringBuffer strbuff = new StringBuffer("012345");
        char array[] = new char[128];
        int srcEnd = strbuff.length();
        if (0 != srcEnd) {
            strbuff.getChars(0, srcEnd, array, 0);
        }
        int length = 6;
        for (int i = 0; i < length; i ++) {
        UTF16.setCharAt(strbuff, i, '0');
        UTF16.setCharAt(array, length, i, '0');
        }
        String str = new String(array, 0, length);
        if (!(strbuff.toString().equals("000000")) ||
        !(str.equals("000000"))) {
        errln("FAIL: setChar to '0' failed");
        }
        UTF16.setCharAt(strbuff, 0, 0x10000);
        UTF16.setCharAt(strbuff, 4, 0x10000);
        UTF16.setCharAt(strbuff, 7, 0x10000);
        if (!(strbuff.toString().equals(
                    "\ud800\udc0000\ud800\udc000\ud800\udc00"))) {
        errln("FAIL: setChar to 0x10000 failed");
        }
        length = UTF16.setCharAt(array, length, 0, 0x10000);
        length = UTF16.setCharAt(array, length, 4, 0x10000);
        length = UTF16.setCharAt(array, length, 7, 0x10000);
        str = new String(array, 0, length);
        if (!(str.equals("\ud800\udc0000\ud800\udc000\ud800\udc00"))) {
        errln("FAIL: setChar to 0x10000 failed");
        }
        UTF16.setCharAt(strbuff, 0, '0');
        UTF16.setCharAt(strbuff, 1, '1');
        UTF16.setCharAt(strbuff, 2, '2');
        UTF16.setCharAt(strbuff, 4, '3');
        UTF16.setCharAt(strbuff, 4, '4');
        UTF16.setCharAt(strbuff, 5, '5');
        if (!strbuff.toString().equals("012345")) {
        errln("Fail converting supplementaries in StringBuffer to BMP " +
          "characters");
        }
        length = UTF16.setCharAt(array, length, 0, '0');
        length = UTF16.setCharAt(array, length, 1, '1');
        length = UTF16.setCharAt(array, length, 2, '2');
        length = UTF16.setCharAt(array, length, 4, '3');
        length = UTF16.setCharAt(array, length, 4, '4');
        length = UTF16.setCharAt(array, length, 5, '5');
        str = new String(array, 0, length);
        if (!str.equals("012345")) {
        errln("Fail converting supplementaries in array to BMP " +
          "characters");
        }
        try {
        UTF16.setCharAt(strbuff, -1, 0);
        errln("FAIL: setting character at invalid offset");
        } catch (Exception e) {
        System.out.print("");
        }
        try {
        UTF16.setCharAt(array, length, -1, 0);
        errln("FAIL: setting character at invalid offset");
        } catch (Exception e) {
        System.out.print("");
        }
        try {
        UTF16.setCharAt(strbuff, length, 0);
        errln("FAIL: setting character at invalid offset");
        } catch (Exception e) {
        System.out.print("");
        }
        try {
        UTF16.setCharAt(array, length, length, 0);
        errln("FAIL: setting character at invalid offset");
        } catch (Exception e) {
        System.out.print("");
        }
    }

    /**
     * Testing UTF16 valueof APIs
     */
    @Test
    public void TestValueOf()
    {
        if(UCharacter.getCodePoint('\ud800','\udc00')!=0x10000){
            errln("FAIL: getCodePoint('\ud800','\udc00')");
        }
        if (!UTF16.valueOf(0x61).equals("a") ||
        !UTF16.valueOf(0x10000).equals("\ud800\udc00")) {
        errln("FAIL: valueof(char32)");
        }
        String str = new String("01234\ud800\udc0056789");
        StringBuffer strbuff = new StringBuffer(str);
        char array[] = str.toCharArray();
        int length = str.length();

        String expected[] = {"0", "1", "2", "3", "4", "\ud800\udc00",
                 "\ud800\udc00", "5", "6", "7", "8", "9"};
        for (int i = 0; i < length; i ++) {
        if (!UTF16.valueOf(str, i).equals(expected[i]) ||
                !UTF16.valueOf(strbuff, i).equals(expected[i]) ||
                !UTF16.valueOf(array, 0, length, i).equals(expected[i])) {
                errln("FAIL: valueOf() expected " + expected[i]);
        }
        }
        try {
        UTF16.valueOf(str, -1);
        errln("FAIL: out of bounds error expected");
        } catch (Exception e) {
        System.out.print("");
        }
        try {
        UTF16.valueOf(strbuff, -1);
        errln("FAIL: out of bounds error expected");
        } catch (Exception e) {
        System.out.print("");
        }
        try {
        UTF16.valueOf(array, 0, length, -1);
        errln("FAIL: out of bounds error expected");
        } catch (Exception e) {
        System.out.print("");
        }
        try {
        UTF16.valueOf(str, length);
        errln("FAIL: out of bounds error expected");
        } catch (Exception e) {
        System.out.print("");
        }
        try {
        UTF16.valueOf(strbuff, length);
        errln("FAIL: out of bounds error expected");
        } catch (Exception e) {
        System.out.print("");
        }
        try {
        UTF16.valueOf(array, 0, length, length);
        errln("FAIL: out of bounds error expected");
        } catch (Exception e) {
        System.out.print("");
        }
        if (!UTF16.valueOf(array, 6, length, 0).equals("\udc00") ||
        !UTF16.valueOf(array, 0, 6, 5).equals("\ud800")) {
        errln("FAIL: error getting partial supplementary character");
        }
        try {
        UTF16.valueOf(array, 3, 5, -1);
        errln("FAIL: out of bounds error expected");
        } catch (Exception e) {
        System.out.print("");
        }
        try {
        UTF16.valueOf(array, 3, 5, 3);
        errln("FAIL: out of bounds error expected");
        } catch (Exception e) {
        System.out.print("");
        }
    }

    @Test
    public void TestIndexOf()
    {
    //012345678901234567890123456789012345
        String test1     = "test test ttest tetest testesteststt";
        String test2     = "test";
        int    testChar1 = 0x74;
        int    testChar2 = 0x20402;
        // int    testChar3 = 0xdc02;
        // int    testChar4 = 0xd841;
        String test3     = "\ud841\udc02\u0071\udc02\ud841\u0071\ud841\udc02\u0071\u0072\ud841\udc02\u0071\ud841\udc02\u0071\udc02\ud841\u0073";
        String test4     = UCharacter.toString(testChar2);

        if (UTF16.indexOf(test1, test2) != 0 ||
            UTF16.indexOf(test1, test2, 0) != 0) {
            errln("indexOf failed: expected to find '" + test2 +
                  "' at position 0 in text '" + test1 + "'");
        }
        if (UTF16.indexOf(test1, testChar1) != 0 ||
            UTF16.indexOf(test1, testChar1, 0) != 0) {
            errln("indexOf failed: expected to find 0x" +
                  Integer.toHexString(testChar1) +
                  " at position 0 in text '" + test1 + "'");
        }
        if (UTF16.indexOf(test3, testChar2) != 0 ||
            UTF16.indexOf(test3, testChar2, 0) != 0) {
            errln("indexOf failed: expected to find 0x" +
                  Integer.toHexString(testChar2) +
                  " at position 0 in text '" + Utility.hex(test3) + "'");
        }
        String test5 = "\ud841\ud841\udc02";
        if (UTF16.indexOf(test5, testChar2) != 1 ||
            UTF16.indexOf(test5, testChar2, 0) != 1) {
            errln("indexOf failed: expected to find 0x" +
                  Integer.toHexString(testChar2) +
                  " at position 0 in text '" + Utility.hex(test3) + "'");
        }
        if (UTF16.lastIndexOf(test1, test2) != 29 ||
            UTF16.lastIndexOf(test1, test2, test1.length()) != 29) {
            errln("lastIndexOf failed: expected to find '" + test2 +
                  "' at position 29 in text '" + test1 + "'");
        }
        if (UTF16.lastIndexOf(test1, testChar1) != 35 ||
            UTF16.lastIndexOf(test1, testChar1, test1.length()) != 35) {
            errln("lastIndexOf failed: expected to find 0x" +
                  Integer.toHexString(testChar1) +
                  " at position 35 in text '" + test1 + "'");
        }
        if (UTF16.lastIndexOf(test3, testChar2) != 13 ||
            UTF16.lastIndexOf(test3, testChar2, test3.length()) != 13) {
            errln("indexOf failed: expected to find 0x" +
                  Integer.toHexString(testChar2) +
                  " at position 13 in text '" + Utility.hex(test3) + "'");
        }
        int occurrences = 0;
        for (int startPos = 0; startPos != -1 && startPos < test1.length();)
        {
        startPos = UTF16.indexOf(test1, test2, startPos);
        if (startPos >= 0) {
            ++ occurrences;
            startPos += 4;
        }
        }
        if (occurrences != 6) {
            errln("indexOf failed: expected to find 6 occurrences, found "
                  + occurrences);
        }

        occurrences = 0;
        for (int startPos = 10; startPos != -1 && startPos < test1.length();)
        {
        startPos = UTF16.indexOf(test1, test2, startPos);
        if (startPos >= 0) {
            ++ occurrences;
            startPos += 4;
        }
        }
        if (occurrences != 4) {
            errln("indexOf with starting offset failed: expected to find 4 occurrences, found "
                  + occurrences);
        }

        occurrences = 0;
        for (int startPos = 0;
         startPos != -1 && startPos < test3.length();) {
            startPos = UTF16.indexOf(test3, test4, startPos);
            if (startPos != -1) {
                ++ occurrences;
                startPos += 2;
            }
        }
        if (occurrences != 4) {
            errln("indexOf failed: expected to find 4 occurrences, found "
          + occurrences);
        }

        occurrences = 0;
        for (int startPos = 10;
             startPos != -1 && startPos < test3.length();) {
            startPos = UTF16.indexOf(test3, test4, startPos);
            if (startPos != -1) {
                ++ occurrences;
                startPos += 2;
            }
        }
        if (occurrences != 2) {
            errln("indexOf failed: expected to find 2 occurrences, found "
                  + occurrences);
        }

        occurrences = 0;
        for (int startPos = 0;
         startPos != -1 && startPos < test1.length();) {
            startPos = UTF16.indexOf(test1, testChar1, startPos);
            if (startPos != -1) {
                ++ occurrences;
                startPos += 1;
            }
        }
        if (occurrences != 16) {
            errln("indexOf with character failed: expected to find 16 occurrences, found "
                  + occurrences);
        }

        occurrences = 0;
        for (int startPos = 10;
         startPos != -1 && startPos < test1.length();) {
            startPos = UTF16.indexOf(test1, testChar1, startPos);
            if (startPos != -1) {
                ++ occurrences;
                startPos += 1;
            }
        }
        if (occurrences != 12) {
            errln("indexOf with character & start offset failed: expected to find 12 occurrences, found "
          + occurrences);
        }

        occurrences = 0;
        for (int startPos = 0;
         startPos != -1 && startPos < test3.length();) {
            startPos = UTF16.indexOf(test3, testChar2, startPos);
            if (startPos != -1) {
                ++ occurrences;
                startPos += 1;
            }
        }
        if (occurrences != 4) {
            errln("indexOf failed: expected to find 4 occurrences, found "
                  + occurrences);
        }

        occurrences = 0;
        for (int startPos = 5; startPos != -1 && startPos < test3.length();) {
            startPos = UTF16.indexOf(test3, testChar2, startPos);
            if (startPos != -1) {
                ++ occurrences;
                startPos += 1;
            }
        }
        if (occurrences != 3) {
            errln("indexOf with character & start & end offsets failed: expected to find 2 occurrences, found "
          + occurrences);
        }
        occurrences = 0;
        for (int startPos = 32; startPos != -1;) {
            startPos = UTF16.lastIndexOf(test1, test2, startPos);
            if (startPos != -1) {
                ++ occurrences;
                startPos -= 5;
            }
        }
        if (occurrences != 6) {
            errln("lastIndexOf with starting and ending offsets failed: expected to find 4 occurrences, found "
                  + occurrences);
        }
        occurrences = 0;
        for (int startPos = 32; startPos != -1;) {
            startPos = UTF16.lastIndexOf(test1, testChar1, startPos);
            if (startPos != -1) {
                ++ occurrences;
                startPos -= 5;
            }
        }
        if (occurrences != 7) {
            errln("lastIndexOf with character & start & end offsets failed: expected to find 11 occurrences, found "
          + occurrences);
        }

        //testing UChar32
        occurrences = 0;
        for (int startPos = test3.length(); startPos != -1;) {
            startPos = UTF16.lastIndexOf(test3, testChar2, startPos - 5);
            if (startPos != -1) {
                ++ occurrences;
            }
        }
        if (occurrences != 3) {
            errln("lastIndexOf with character & start & end offsets failed: expected to find 3 occurrences, found "
          + occurrences);
        }

        // testing supplementary
        for (int i = 0; i < INDEXOF_SUPPLEMENTARY_CHAR_.length; i ++) {
        int ch = INDEXOF_SUPPLEMENTARY_CHAR_[i];
        for (int j = 0; j < INDEXOF_SUPPLEMENTARY_CHAR_INDEX_[i].length;
         j ++) {
        int index = 0;
        int expected = INDEXOF_SUPPLEMENTARY_CHAR_INDEX_[i][j];
        if  (j > 0) {
            index = INDEXOF_SUPPLEMENTARY_CHAR_INDEX_[i][j - 1] + 1;
        }
        if (UTF16.indexOf(INDEXOF_SUPPLEMENTARY_STRING_, ch, index) !=
            expected ||
            UTF16.indexOf(INDEXOF_SUPPLEMENTARY_STRING_,
                  UCharacter.toString(ch), index) !=
            expected) {
            errln("Failed finding index for supplementary 0x" +
              Integer.toHexString(ch));
        }
        index = INDEXOF_SUPPLEMENTARY_STRING_.length();
        if (j < INDEXOF_SUPPLEMENTARY_CHAR_INDEX_[i].length - 1) {
            index = INDEXOF_SUPPLEMENTARY_CHAR_INDEX_[i][j + 1] - 1;
        }
        if (UTF16.lastIndexOf(INDEXOF_SUPPLEMENTARY_STRING_, ch,
                      index) != expected ||
            UTF16.lastIndexOf(INDEXOF_SUPPLEMENTARY_STRING_,
                      UCharacter.toString(ch), index)
            != expected)
            {
            errln("Failed finding last index for supplementary 0x" +
                  Integer.toHexString(ch));
            }
        }
        }

        for (int i = 0; i < INDEXOF_SUPPLEMENTARY_STR_INDEX_.length; i ++) {
        int index = 0;
        int expected = INDEXOF_SUPPLEMENTARY_STR_INDEX_[i];
        if  (i > 0) {
        index = INDEXOF_SUPPLEMENTARY_STR_INDEX_[i - 1] + 1;
        }
        if (UTF16.indexOf(INDEXOF_SUPPLEMENTARY_STRING_,
                  INDEXOF_SUPPLEMENTARY_STR_, index) != expected) {
        errln("Failed finding index for supplementary string " +
              hex(INDEXOF_SUPPLEMENTARY_STRING_));
        }
        index = INDEXOF_SUPPLEMENTARY_STRING_.length();
        if (i < INDEXOF_SUPPLEMENTARY_STR_INDEX_.length - 1) {
        index = INDEXOF_SUPPLEMENTARY_STR_INDEX_[i + 1] - 1;
        }
        if (UTF16.lastIndexOf(INDEXOF_SUPPLEMENTARY_STRING_,
                              INDEXOF_SUPPLEMENTARY_STR_, index) != expected) {
        errln("Failed finding last index for supplementary string " +
              hex(INDEXOF_SUPPLEMENTARY_STRING_));
        }
        }
    }

    @Test
    public void TestReplace()
    {
        String test1 = "One potato, two potato, three potato, four\n";
        String test2 = "potato";
        String test3 = "MISSISSIPPI";

        String result = UTF16.replace(test1, test2, test3);
        String expectedValue =
            "One MISSISSIPPI, two MISSISSIPPI, three MISSISSIPPI, four\n";
        if (!result.equals(expectedValue)) {
            errln("findAndReplace failed: expected \"" + expectedValue +
                  "\", got \"" + test1 + "\".");
        }
        result = UTF16.replace(test1, test3, test2);
        expectedValue = test1;
        if (!result.equals(expectedValue)) {
            errln("findAndReplace failed: expected \"" + expectedValue +
                  "\", got \"" + test1 + "\".");
        }

        result = UTF16.replace(test1, ',', 'e');
        expectedValue = "One potatoe two potatoe three potatoe four\n";
        if (!result.equals(expectedValue)) {
            errln("findAndReplace failed: expected \"" + expectedValue +
                  "\", got \"" + test1 + "\".");
        }

        result = UTF16.replace(test1, ',', 0x10000);
        expectedValue = "One potato\ud800\udc00 two potato\ud800\udc00 three potato\ud800\udc00 four\n";
        if (!result.equals(expectedValue)) {
            errln("findAndReplace failed: expected \"" + expectedValue +
                  "\", got \"" + test1 + "\".");
        }

        result = UTF16.replace(test1, "potato", "\ud800\udc00\ud801\udc01");
        expectedValue = "One \ud800\udc00\ud801\udc01, two \ud800\udc00\ud801\udc01, three \ud800\udc00\ud801\udc01, four\n";
        if (!result.equals(expectedValue)) {
            errln("findAndReplace failed: expected \"" + expectedValue +
                  "\", got \"" + test1 + "\".");
        }

        String test4 = "\ud800\ud800\udc00\ud800\udc00\udc00\ud800\ud800\udc00\ud800\udc00\udc00";
        result = UTF16.replace(test4, 0xd800, 'A');
        expectedValue = "A\ud800\udc00\ud800\udc00\udc00A\ud800\udc00\ud800\udc00\udc00";
        if (!result.equals(expectedValue)) {
            errln("findAndReplace failed: expected \"" + expectedValue +
                  "\", got \"" + test1 + "\".");
        }

        result = UTF16.replace(test4, 0xdC00, 'A');
        expectedValue = "\ud800\ud800\udc00\ud800\udc00A\ud800\ud800\udc00\ud800\udc00A";
        if (!result.equals(expectedValue)) {
            errln("findAndReplace failed: expected \"" + expectedValue +
                  "\", got \"" + test1 + "\".");
        }

        result = UTF16.replace(test4, 0x10000, 'A');
        expectedValue = "\ud800AA\udc00\ud800AA\udc00";
        if (!result.equals(expectedValue)) {
            errln("findAndReplace failed: expected \"" + expectedValue +
                  "\", got \"" + test1 + "\".");
        }
    }

    @Test
    public void TestReverse()
    {
        StringBuffer test = new StringBuffer(
                         "backwards words say to used I");

        StringBuffer result = UTF16.reverse(test);
        if (!result.toString().equals("I desu ot yas sdrow sdrawkcab")) {
            errln("reverse() failed:  Expected \"I desu ot yas sdrow sdrawkcab\",\n got \""
          + result + "\"");
        }
        StringBuffer testbuffer = new StringBuffer();
        UTF16.append(testbuffer, 0x2f999);
        UTF16.append(testbuffer, 0x1d15f);
        UTF16.append(testbuffer, 0x00c4);
        UTF16.append(testbuffer, 0x1ed0);
        result = UTF16.reverse(testbuffer);
        if (result.charAt(0) != 0x1ed0 ||
            result.charAt(1) != 0xc4 ||
            UTF16.charAt(result, 2) != 0x1d15f ||
            UTF16.charAt(result, 4)!=0x2f999) {
            errln("reverse() failed with supplementary characters");
        }
    }

    /**
     * Testing the setter and getter apis for StringComparator
     */
    @Test
    public void TestStringComparator()
    {
        UTF16.StringComparator compare = new UTF16.StringComparator();
        if (compare.getCodePointCompare() != false) {
            errln("Default string comparator should be code unit compare");
        }
        if (compare.getIgnoreCase() != false) {
            errln("Default string comparator should be case sensitive compare");
        }
        if (compare.getIgnoreCaseOption()
            != UTF16.StringComparator.FOLD_CASE_DEFAULT) {
            errln("Default string comparator should have fold case default compare");
        }
        compare.setCodePointCompare(true);
        if (compare.getCodePointCompare() != true) {
            errln("Error setting code point compare");
        }
        compare.setCodePointCompare(false);
        if (compare.getCodePointCompare() != false) {
            errln("Error setting code point compare");
        }
        compare.setIgnoreCase(true, UTF16.StringComparator.FOLD_CASE_DEFAULT);
        if (compare.getIgnoreCase() != true
            || compare.getIgnoreCaseOption()
        != UTF16.StringComparator.FOLD_CASE_DEFAULT) {
            errln("Error setting ignore case and options");
        }
        compare.setIgnoreCase(false, UTF16.StringComparator.FOLD_CASE_EXCLUDE_SPECIAL_I);
        if (compare.getIgnoreCase() != false
            || compare.getIgnoreCaseOption()
        != UTF16.StringComparator.FOLD_CASE_EXCLUDE_SPECIAL_I) {
            errln("Error setting ignore case and options");
        }
        compare.setIgnoreCase(true, UTF16.StringComparator.FOLD_CASE_EXCLUDE_SPECIAL_I);
        if (compare.getIgnoreCase() != true
            || compare.getIgnoreCaseOption()
        != UTF16.StringComparator.FOLD_CASE_EXCLUDE_SPECIAL_I) {
            errln("Error setting ignore case and options");
        }
        compare.setIgnoreCase(false, UTF16.StringComparator.FOLD_CASE_DEFAULT);
        if (compare.getIgnoreCase() != false
            || compare.getIgnoreCaseOption()
        != UTF16.StringComparator.FOLD_CASE_DEFAULT) {
            errln("Error setting ignore case and options");
        }
    }

    @Test
    public void TestCodePointCompare()
    {
        // these strings are in ascending order
        String str[] = {"\u0061", "\u20ac\ud801", "\u20ac\ud800\udc00",
                        "\ud800", "\ud800\uff61", "\udfff",
                        "\uff61\udfff", "\uff61\ud800\udc02", "\ud800\udc02",
                        "\ud84d\udc56"};
        UTF16.StringComparator cpcompare
            = new UTF16.StringComparator(true, false,
                     UTF16.StringComparator.FOLD_CASE_DEFAULT);
        UTF16.StringComparator cucompare
            = new UTF16.StringComparator();
        for (int i = 0; i < str.length - 1; ++ i) {
            if (cpcompare.compare(str[i], str[i + 1]) >= 0) {
                errln("error: compare() in code point order fails for string "
                      + Utility.hex(str[i]) + " and "
                      + Utility.hex(str[i + 1]));
            }
            // test code unit compare
            if (cucompare.compare(str[i], str[i + 1])
                != str[i].compareTo(str[i + 1])) {
                errln("error: compare() in code unit order fails for string "
                      + Utility.hex(str[i]) + " and "
                      + Utility.hex(str[i + 1]));
            }
        }
    }

    @Test
    public void TestCaseCompare()
    {
        String mixed = "\u0061\u0042\u0131\u03a3\u00df\ufb03\ud93f\udfff";
        String otherDefault = "\u0041\u0062\u0131\u03c3\u0073\u0053\u0046\u0066\u0049\ud93f\udfff";
        String otherExcludeSpecialI = "\u0041\u0062\u0131\u03c3\u0053\u0073\u0066\u0046\u0069\ud93f\udfff";
        String different = "\u0041\u0062\u0131\u03c3\u0073\u0053\u0046\u0066\u0049\ud93f\udffd";

        UTF16.StringComparator compare = new UTF16.StringComparator();
        compare.setIgnoreCase(true, UTF16.StringComparator.FOLD_CASE_DEFAULT);
        // test u_strcasecmp()
        int result = compare.compare(mixed, otherDefault);
        if (result != 0) {
            errln("error: default compare(mixed, other) = " + result
                  + " instead of 0");
        }

        // test u_strcasecmp() - exclude special i
        compare.setIgnoreCase(true,
                  UTF16.StringComparator.FOLD_CASE_EXCLUDE_SPECIAL_I);
        result = compare.compare(mixed, otherExcludeSpecialI);
        if (result != 0) {
            errln("error: exclude_i compare(mixed, other) = " + result
                  + " instead of 0");
        }

        // test u_strcasecmp()
        compare.setIgnoreCase(true,
                              UTF16.StringComparator.FOLD_CASE_DEFAULT);
        result = compare.compare(mixed, different);
        if (result <= 0) {
            errln("error: default compare(mixed, different) = " + result
                  + " instead of positive");
        }

        // test substrings - stop before the sharp s (U+00df)
        compare.setIgnoreCase(true,
                              UTF16.StringComparator.FOLD_CASE_DEFAULT);
        result = compare.compare(mixed.substring(0, 4),
                                 different.substring(0, 4));
        if (result != 0) {
            errln("error: default compare(mixed substring, different substring) = "
          + result + " instead of 0");
        }
        // test substrings - stop in the middle of the sharp s (U+00df)
        compare.setIgnoreCase(true,
                              UTF16.StringComparator.FOLD_CASE_DEFAULT);
        result = compare.compare(mixed.substring(0, 5),
                                 different.substring(0, 5));
        if (result <= 0) {
            errln("error: default compare(mixed substring, different substring) = "
          + result + " instead of positive");
        }
    }

    @Test
    public void TestHasMoreCodePointsThan()
    {
        String str = "\u0061\u0062\ud800\udc00\ud801\udc01\u0063\ud802\u0064"
        + "\udc03\u0065\u0066\ud804\udc04\ud805\udc05\u0067";
        int length = str.length();
        while (length >= 0) {
            for (int i = 0; i <= length; ++ i) {
                String s = str.substring(0, i);
                for (int number = -1; number <= ((length - i) + 2); ++ number) {
                    boolean flag = UTF16.hasMoreCodePointsThan(s, number);
                    if (flag != (UTF16.countCodePoint(s) > number)) {
                        errln("hasMoreCodePointsThan(" + Utility.hex(s)
                              + ", " + number + ") = " + flag + " is wrong");
                    }
                }
            }
            -- length;
        }

        // testing for null bad input
        for(length = -1; length <= 1; ++ length) {
            for (int i = 0; i <= length; ++ i) {
                for (int number = -2; number <= 2; ++ number) {
                    boolean flag = UTF16.hasMoreCodePointsThan((String)null,
                                                               number);
                    if (flag != (UTF16.countCodePoint((String)null) > number)) {
                        errln("hasMoreCodePointsThan(null, " + number + ") = "
                  + flag + " is wrong");
                    }
                }
            }
        }

        length = str.length();
        while (length >= 0) {
            for (int i = 0; i <= length; ++ i) {
                StringBuffer s = new StringBuffer(str.substring(0, i));
                for (int number = -1; number <= ((length - i) + 2); ++ number) {
                    boolean flag = UTF16.hasMoreCodePointsThan(s, number);
                    if (flag != (UTF16.countCodePoint(s) > number)) {
                        errln("hasMoreCodePointsThan(" + Utility.hex(s)
                              + ", " + number + ") = " + flag + " is wrong");
                    }
                }
            }
            -- length;
        }

        // testing for null bad input
        for (length = -1; length <= 1; ++ length) {
            for (int i = 0; i <= length; ++ i) {
                for (int number = -2; number <= 2; ++ number) {
                    boolean flag = UTF16.hasMoreCodePointsThan(
                                   (StringBuffer)null, number);
                    if (flag
                        != (UTF16.countCodePoint((StringBuffer)null) > number))
            {
                errln("hasMoreCodePointsThan(null, " + number + ") = "
                  + flag + " is wrong");
            }
                }
            }
        }

        char strarray[] = str.toCharArray();
        while (length >= 0) {
            for (int limit = 0; limit <= length; ++ limit) {
                for (int start = 0; start <= limit; ++ start) {
                    for (int number = -1; number <= ((limit - start) + 2);
                         ++ number) {
                        boolean flag = UTF16.hasMoreCodePointsThan(strarray,
                                   start, limit, number);
                        if (flag != (UTF16.countCodePoint(strarray, start,
                                                          limit) > number)) {
                            errln("hasMoreCodePointsThan("
                                  + Utility.hex(str.substring(start, limit))
                                  + ", " + start + ", " + limit + ", " + number
                                  + ") = " + flag + " is wrong");
                        }
                    }
                }
            }
            -- length;
        }

        // testing for null bad input
        for (length = -1; length <= 1; ++ length) {
            for (int i = 0; i <= length; ++ i) {
                for (int number = -2; number <= 2; ++ number) {
                    boolean flag = UTF16.hasMoreCodePointsThan(
                                   (StringBuffer)null, number);
                    if (flag
                        != (UTF16.countCodePoint((StringBuffer)null) > number))
            {
                errln("hasMoreCodePointsThan(null, " + number + ") = "
                  + flag + " is wrong");
            }
                }
            }
        }

        // bad input
        try {
            UTF16.hasMoreCodePointsThan(strarray, -2, -1, 5);
            errln("hasMoreCodePointsThan(chararray) with negative indexes has to throw an exception");
        } catch (Exception e) {
            logln("PASS: UTF16.hasMoreCodePointsThan failed as expected");
        }
        try {
            UTF16.hasMoreCodePointsThan(strarray, 5, 2, 5);
            errln("hasMoreCodePointsThan(chararray) with limit less than start index has to throw an exception");
        } catch (Exception e) {
            logln("PASS: UTF16.hasMoreCodePointsThan failed as expected");
        }
        try {
            if (UTF16.hasMoreCodePointsThan(strarray, -2, 2, 5)) {
                errln("hasMoreCodePointsThan(chararray) with negative start indexes can't return true");
            }
        } catch (Exception e) {
        }
    }

    @Test
    public void TestUtilities() {
        String[] tests = {
                "a",
                "\uFFFF",
                "😀",
                "\uD800",
                "\uDC00",
                "\uDBFF\uDfff",
                "",
                "\u0000",
                "\uDC00\uD800",
                "ab",
                "😀a",
                null,
        };
        StringComparator sc = new UTF16.StringComparator(true,false,0);
        for (String item1 : tests) {
            String nonNull1 = item1 == null ? "" : item1;
            int count = UTF16.countCodePoint(nonNull1);
            int expected = count == 0 || count > 1 ? -1 : nonNull1.codePointAt(0);
            assertEquals("codepoint test " + Utility.hex(nonNull1), expected, UTF16.getSingleCodePoint(item1));
            if (expected == -1) {
                continue;
            }
            for (String item2 : tests) {
                String nonNull2 = item2 == null ? "" : item2;
                int scValue = Integer.signum(sc.compare(nonNull1, nonNull2));
                int fValue = Integer.signum(UTF16.compareCodePoint(expected, item2));
                assertEquals("comparison " + Utility.hex(nonNull1) + ", " + Utility.hex(nonNull2), scValue, fValue);
            }
        }
    }

    @Test
    public void TestNewString() {
    final int[] codePoints = {
        UCharacter.toCodePoint(UCharacter.MIN_HIGH_SURROGATE, UCharacter.MAX_LOW_SURROGATE),
        UCharacter.toCodePoint(UCharacter.MAX_HIGH_SURROGATE, UCharacter.MIN_LOW_SURROGATE),
        UCharacter.MAX_HIGH_SURROGATE,
        'A',
        -1,
    };

    final String cpString = "" +
        UCharacter.MIN_HIGH_SURROGATE +
        UCharacter.MAX_LOW_SURROGATE +
        UCharacter.MAX_HIGH_SURROGATE +
        UCharacter.MIN_LOW_SURROGATE +
        UCharacter.MAX_HIGH_SURROGATE +
        'A';

    final int[][] tests = {
        { 0, 1, 0, 2 },
        { 0, 2, 0, 4 },
        { 1, 1, 2, 2 },
        { 1, 2, 2, 3 },
        { 1, 3, 2, 4 },
        { 2, 2, 4, 2 },
        { 2, 3, 0, -1 },
        { 4, 5, 0, -1 },
        { 3, -1, 0, -1 }
    };

     for (int i = 0; i < tests.length; ++i) {
        int[] t = tests[i];
        int s = t[0];
        int c = t[1];
        int rs = t[2];
        int rc = t[3];

        Exception e = null;
        try {
        String str = UTF16.newString(codePoints, s, c);
        if (rc == -1 || !str.equals(cpString.substring(rs, rs+rc))) {
            errln("failed codePoints iter: " + i + " start: " + s + " len: " + c);
        }
        continue;
        }
        catch (IndexOutOfBoundsException e1) {
        e = e1;
        }
        catch (IllegalArgumentException e2) {
        e = e2;
        }
        if (rc != -1) {
        errln(e.getMessage());
        }
    }
    }

    // private data members ----------------------------------------------

    private final static String INDEXOF_SUPPLEMENTARY_STRING_ =
        "\ud841\udc02\u0071\udc02\ud841\u0071\ud841\udc02\u0071\u0072" +
        "\ud841\udc02\u0071\ud841\udc02\u0071\udc02\ud841\u0073";
    private final static int INDEXOF_SUPPLEMENTARY_CHAR_[] =
    {0x71, 0xd841, 0xdc02,
     UTF16Util.getRawSupplementary((char)0xd841,
                 (char)0xdc02)};
    private final static int INDEXOF_SUPPLEMENTARY_CHAR_INDEX_[][] =
    {{2, 5, 8, 12, 15},
     {4, 17},
     {3, 16},
     {0, 6, 10, 13}
    };
    private final static String INDEXOF_SUPPLEMENTARY_STR_ = "\udc02\ud841";
    private final static int INDEXOF_SUPPLEMENTARY_STR_INDEX_[] =
    {3, 16};

    // private methods ---------------------------------------------------
}

redpajama_set_name: RedPajamaGithub


text:
The Soundtrack of a Kitchen
By Adrienne Guldin
I am probably the last person to (reluctantly) get on the dance floor at a wedding. But in a kitchen, I am Fred Astaire and Misty Copeland, Peg Leg Bates and Gwen Verdon, Alvin Ailey and Martha Graham. I have been known to leap from counter to cupboard. I chassé from oven to table. I trip over my feet from fridge to sink. And behind it all is the soundtrack of the kitchen.
Often the soundtrack includes music. For a solid three months out of each year, the Eurovision Song Contest entries for that particular year will feature prominently (or exclusively, if I'm honest). The rest of the time, it could be a Pandora playlist, the soundtrack for a movie, a Broadway show, or whatever strikes the fancy of whomever I'm in the kitchen with. Recently, it was our own disco remix of Edelweiss from The Sound of Music. But there is so much more to the music of the kitchen.
One of my favorite moments working in The Daly Bagel's kitchen is when I'm the first one to arrive in the morning. Most people are still asleep. The streets are devoid of cars. The sun has yet to make an appearance. The first few moments are magical. I unlock the door and turn off the alarm system. And just stand for a second. The only sound is the hum of the refrigerators. And like Ravel's Bolero, the music begins.
It's a slow build starting with the fan of the convection ovens. Add the metallic thunder of sinks being filled followed by the more gentle rumble as the water level rises. The clang of metal on metal as I wheel in the rolling rack full of the tools of our trade adds a brief cadenza. The mixer begins its droning purr. Music pours from the speakers of the phone I have jammed into a convenient pocket. Conversations, questions, instructions between the bakers crescendo as the whole cacophony becomes a symphony. Oven timers go off, adding a fleeting discordant note. And it all slows. And calms. Until the last sounds are the spritz of a sanitizer bottle and the swish of a mop and then peace.
Through it all, we dance. We may not label it as a dance, but it is. I noticed several weeks ago that I was timing my measuring of sea salt with the beat of the music playing: each teaspoon added on a downbeat and I began thinking of each of our movements in dance terms. This kitchen dance is such a beautifully choreographed mix of large and small movements. It's a pirouette between oven and cooling rack, a spin from flour bin to mixing bowl, a hip shimmy to close an unruly fridge door, a slide of honey in a metal bowl and the elegant movement of a wrist followed by the sharp slap of dough hitting a stainless steel table. Repeat for eight bars.
Maybe if more weddings involved doughs and ovens, I'd be more eager to leap onto the dance floor.
Rainbow Bagels

redpajama_set_name: RedPajamaCommonCrawl


text:
Ceinos de Campos kan syfta på följande platser:

Spanien

 Ceinos de Campos (kommunhuvudort), Kastilien och Leon, Provincia de Valladolid,
 Ceinos de Campos (kommun), Kastilien och Leon, Provincia de Valladolid,

Robotskapade Spanienförgreningar

redpajama_set_name: RedPajamaWikipedia


These subscription packages come in a variety of digital forms, such as Amazon Prime Video, and physical formats, much like product-of-the-month clubs such as Dollar Shave Club or Birchbox. Many digital options are updated weekly with new classes, options, and more, and most subscription packages come with a free trial and also allow you to cancel at any time. We've sorted through all the subscriptions and rounded up the most tempting ones out there. Read on to discover our favorite Amazon subscriptions you may never have heard of.
Add to your child's development with this smart toy delivery service. Launched in January 2017, Amazon's STEM Club delivers handpicked science, technology, engineering, and math toys to your doorstep each month. As STEM learning continues to become more common, this services meets the needs of parents looking for a way to help their child advance through learning.
These creative, hands-on toys help your child develop the building blocks for a bright future in fields such as robotics, computers, and natural sciences. Subscription options are broken down by age with one for children 3-to-4 years old, another for children 5-to-7 years old, and a third for children 8-to-13 years old, with each option available for the standard price of $20 per month.
Stay fit and healthy all year long from the comfort of your home — for less than the cost of a typical gym membership — with a BurnAlong subscription. The health-focused subscription service gives you access to unlimited fitness videos provided by gyms, studios, nutritionists, mentors, and coaches. The digital subscription allows you to enjoy all videos on any supported Apple, Android, Fire, or other streaming device.
You get access to hundreds of fitness videos in various categories and levels, with new classes added weekly so you never grow tired of a routine. Amazon provides a 12-month package that gives you 30 days free and then renews at $100 per year billed annually, or a 1-month package that gives you 15 days free and automatically renews at $10 per month after the free trial.
Upgrade from your typical grocery store deli meat with a Carnivore Club subscription. This meat-lovers subscription offers handcrafted cured meats from award-winning artisans, and allows you to discover new meats every month that are spotlighted through traditional recipes. You'll be treated to different styles of meat and preparation, including French charcuterie, Italian salumi, Spanish chorizo, and even South African biltong.
Each box comes with a Meat-Eater's Handbook that provides the artisan's story and explains the selected products. The Standard Box subscription offers 4-to-6 (23-32oz) handcrafted cured meats per month, while the Snack Box option features snack-sized samples of meat. There's also a premium Wooden Crate option that gives you all the goodies of a Standard box delivered in a fancy wood crate. Pick up a Snack Box subscription for $39 a month, a Classic Box subscription for $55 per month, or a Wooden Crate subscription for $85 per month.
Get your creative juices flowing when you join Creativebug, an online learning community of makers that includes unlimited access to an entire library of award-winning arts and crafts video classes. Chose from more than 1,000 HD video classes taught by world-renowned artists. Members can comment on classes and get prompt replies from instructors and staff experts, post project photos, and engage with other members.
Classes are easy to follow and come with detailed supplies lists to make shopping easy. If you opt for a sewing, quilting, knitting, crocheting, baking, or paper craft class, you'll get free downloadable patterns and recipes. With your subscription, you get to choose one class a month to keep in your library forever (up to a $25 value). Subscription options include a 1-month subscription option that gives you 14 days for free and then automatically renews for $5 a month after that or a 12-month subscription that gives you 12 months unlimited access for $53 per year.
Take the hassle out of dating with the Amazon matchmaking service Tawkify. The subscription acts as your own digital matchmaker by searching for, screening, and hand-selecting every match. It even plans introductory dates for you. This digital matchmaking service is designed for singles who are too busy, private, or discriminating for online dating.
With an active membership, you get unlimited potential matching with Tawkify clients and 100 percent privacy, as only Tawkify matchmakers have access to your profile. Simply create a profile, get screened when there's a potential match, and then enjoy a preplanned date. You even get feedback after your date so you can improve your dating skills as you go. Tawkify is available as a 12-month subscription for $99 per year.
Get access to the largest online meal planning service in America with an eMeals Clean Eating subscription. Members get new and healthy dinner, lunch and breakfast ideas (depending on the package selected), including entrées and sides designed each week by food experts. The easy-to-prepare recipes come complete with a mobile app and shopping lists, and feature more than 15 different food styles.
The recipe subscription helps you save time, eat healthier, control your budget, and lose weight. Each subscription option comes with a free 14-day trial. The All Day Plan offers a three-month option for $50 every three months or a 12-month option for $140 per year. The Lunch and Dinner Plan offers a three-month membership for $40 every three months or 12-month option for $100 per year. The Dinner Only Plan offers a three-month membership for $30 every three months or a 12-month option for $60 per year.
There are also a handful of other eMeals subscriptions to meet your dietary needs including an eMeals Paleo Meal Club, an eMeals Gluten Free Meal Plan, and an eMeals Portion Control Meal Plan.


text:
CanYouIDME?
Behind the Badge
PPB Home
Portland Police Bureau
UPDATE: Deceased Driver Identified
Portland Police Badge
Follow @PortlandPolice
The occupant killed in a New Year's Day crash in Southeast Portland is being identified as
Daniel Martinez, 19, of Portland. His family has been notified of his death. The two passengers are not being identified. One is seriously injured.
Investigators determined Martinez was the driver of the vehicle, which was seen driving at a high rate of speed before it crashed into a pole. They do not believe any other vehicles were involved in the wreck.
This was the first fatal crash of the year.
###PPB###
###ORIGINAL MESSAGE BELOW###
A vehicle occupant died on the scene of a crash Friday morning, and another is in the hospital with life threatening injuries.
On Friday, January 1, 2021 at 7:16a.m., East Precinct officers were dispatched to a crash at Southeast Division Street and Southeast 112th Avenue. When officers arrived with Portland Fire and Rescue and AMR paramedics, they located a single vehicle that impacted a pole. One occupant was found deceased. Another occupant was seriously injured and transported to the hospital by ambulance. That person's injuries are considered life threatening. A third occupant had minor injuries and was treated on scene.
The Portland Police Traffic Division Major Crash Team is responding to assume the investigation. While they do their work, Southeast Division Street is closed between Southeast 109th Avenue and Southeast 113th Avenue. Southeast 112th Avenue is closed between Southeast Lincoln Street and Southeast Clinton Street.
The PIO is not responding to the scene. More information will be released as investigators gather more information.
This is Portland's first fatal crash of 2021. It comes less than 12 hours since the last fatal crash of 2020, which was the 58th traffic-related death of that year.
PPBPIO@portlandoregon.gov
1111 SW 2nd Ave
Tweets by @PortlandPolice
Update: Missing Woman Located (Photo)
Double Homicide Investigation Underway in Centennial Neighborhood
UPDATE: Suspect Arrested for Involvement in Fatal Crash (Photo)
Suspect Arrested for Their Involvement in October Shooting
Protest Forms Around Officers Helping Person in Crisis
Fatality on I205 Freeway Investigation Update
UPDATE: Arrest Made in Shooting Investigation
PPB Seeks Public Input on Directives
One Individual Struck by Gunfire in the Parkrose Neighborhood, Another Residence Struck by Gunfire in the Powellhurst-Gilbert Neighborhood


The trip starts and ends at the bus drop-off point.
Students with a minimum 2.75 semester GPA will be afforded the opportunity to skate at RollArena Skate Center in Richland for two hours in the morning, then spend a few hours at Columbia Center Mall. There is no cost to skate; but money for lunch and/ or retail therapy will be needed. The Dayton Middle School ASB sponsors this event.


text:
DOWNLOAD FULL ALBUM: Logic – YSIV
It's the return of Young Sinatra.
At the end of August, Logic released a freestyle dubbed "YSIV," where in it he revealed that he was readying another Young Sinatra album for the end of September. He wasted no time following the announcement to start the album's campaign either, first sharing the hand-drawn cover art & then a slew of records over the past few weeks like "One Day," "The Return" & "Ready" to name a few. But after weeks of anticipation, Young Sinatra 4 has finally arrived.
On Thursday night, Logic released his fourth studio album, YSIV, his first full-length release since 2017's Everybody. The project spans 14 tracks and includes guest appearances by Wale, Jaden Smith, Hailee Steinfeld, and members of the Wu-Tang Clan. Logic announced the latter collaboration via social media last week, and also shed a little light on what YSIV will deliver:
"I'ma be honest. This is one of the best albums I ever made," the Maryland rapper said. "This shit is so boom-bap, it's so hip-hop, and the reason it's special is because if I release boom-bap after boom-bap after boom-bap, it wouldn't be that fucking dope. You gotta put some trap in that shit."
The album includes the previously released singles "The Return," "Everybody Dies," as well as "One Day" featuring OneRepublic's Ryan Tedder.
You can stream YSIV on Apple Music/iTunes or below via Spotify.
01. Thank You (feat. Lucy Rose & The RattPack) // Download
02. Everybody Dies // Download
03. The Return // Download
04. The Glorious Five // Download
05. One Day (feat. Ryan Tedder) // Download
06. Wu Tang Forever (feat. Ghostface Killah, Raekwon, RZA, Method Man, Inspectah Deck, Cappadonna, Jackpot Scotty Wotty, U-God, Masta Killa & GZA) // Download
07. 100 Miles and Running (feat. Wale & John Lindahl) // Download
08. Ordinary Day (feat. Hailee Steinfeld) // Download
09. YSIV // Download
10. Street Dreams II // Download
11. The Adventures of Stoney Bob (feat. Kajo, Slaydro & Big Lenbo) // Download
12. Legacy // Download
13. ICONIC (feat. Jaden Smith) // Download
14. Last Call // Download
King Chidex March 26, 2019 Album
DOWNLOAD FULL ALBUM: Rich The Kid & YG – L.A.N.Y
King Chidex June 11, 2017 Album
Utibrainz x Drew – The Judicata EP [FREE DOWNLOAD]
King Chidex February 9, 2018 Album
DOWNLOAD FULL ALBUM: M.I Abaga – Rendezvous
ALBUM: RICK ROSS – RATHER YOU THAN ME (ZIP DOWNLOAD)
Tags:Logic YSIV


Own a piece of Anfield grass with this cool LFC Grass Plaque.
Moulded into a circular design with LFC Liverbird.
Due to strict IATA regulations, this product can only be shipped to the UK and EU, not overseas.


Exiles from totalitarian regimes have always been a potential and real threat to the credibility, durability and legitimacy of dictatorships, particularly the Communist variety. These regimes sought to quash exile effectiveness through a round-the-clock dispatch of intelligence assets in aggressive defamation and elimination operations.
In the United States, we metaphorically abide by the double-edged sword. While America is a haven for those who seek freedom from repressive regimes, we simultaneously provide a forum for supporters of those regimes. Stephen Kimber, an award winning journalist and currently a professor of journalism at the University of King's College in Halifax, represents the latter.
As a writer, Comrade Kimber is what Soviet dictator Josef Stalin called an engineer of human souls – endowed with the power to remold the ideological mentality of his readers. Kimber recently wrote, What Lies Across the Water: The Real Story of the Cuban Five – a book that justifies agent insertion into the United States by the Cuban regime and (of course) slanders anti-Communist Cuban exiles.
The Washington Post published an Op-Ed by Kimber where he defends the Cuban Five – spies who, among many other illegal acts, were instrumental in the 1996 downing of two Brothers to the Rescue planes over the Florida Straits. The American light aircraft were shot down over international waters by Cuban MiGs firing air-to-air missiles that killed four on board. The Cuban Five were subsequently convicted by a federal jury that did not include any Cuban exiles.
South Florida's WLRN General Manager John Labonia defended the station's decision to also provide a platform to Kimber. To not do so would apparently have been dumb and intolerant. He nodded to the sensitivity of the matter and stated, "…the local conversation about Cuba has evolved and become more broad-minded…and that it can accommodate opinions today that might have been too uncomfortable to engage a generation ago." Have broad-mindedness, objectivity and tolerance ever been demanded of other victims of totalitarianism, such as Jews under the Nazi regime and those who toppled Adolf Hitler? No, because these standards are solely exacted on victims of Communism and the underlying reality is that their lives are allotted a low value, if any at all.
The unbridled statements by journalists and others about Communism's exiles are certainly beneficial to the oppressors. Thus, those subjected to property confiscation, political arrests and torture are somehow unable to accurately address their homeland's ills as opposed to those who regurgitate the content of Communist State publications. For example, journalists describe Vietnamese exiles, ad nauseum, as "right-wing" and an "extreme anti-Communist bloc," whose younger generations are more open-minded. The loved ones of the 16,000 Cambodians who died on orders of Kaing Guek Eav, a.k.a. "Duch," ought not have had a say in his sentencing, according to international judge Sylvia Cartwright because of the need for objectivity and balance as opposed to victims' "mob rule." A group or government that attempts, by any means necessary, to bring freedom to a country is generally lauded as heroic – so long as that country is not under the yoke of Communism. Laotian anti-Communists have been subjected to arrests, bombardments, re-education camps and shootings; but an effort by exiles and sympathizers, labeled by the U.S. government as "mercenaries," to liberate the country resulted in arrest for many in the United States.
So how did the double standard originate?
The latest excerpt from Brian Latell's new book "Castro's Secrets: The CIA and Cuba's Intelligence Machine" is a light and breezy read, but disappointingly devoid of facts. It captures the reminisces of a few Cuban defectors who claim that a handful of Russians trained a cadre of starry-eyed Cubans spies, who subsequently taught themselves and became one of the world's premier services.
In contrast to the simplistic picture painted by Latell, Cuba received considerable and sustained help from other nations. For example, the Soviet Union and East Germany help Havana establish its counterintelligence force, focused on internal threats. General Marcus Wolf, head of East Germany's Intelligence Service, originally assessed the performance of Havana's services as amateurish. He equated their sophistication and professionalism to his own services 10-15 years earlier. Wolf subsequently advised Cuba on how to improve its effectiveness and efficiency. This, along with the Soviet support, helped seal the fate of the anti-Castro resistance in the early 1960s, further consolidating Castro's power.
No-cost training and assistance in "foreign intelligence" came from the Soviets and several Warsaw Pact allies. The Soviets were the more generous in terms of quantity, but Cuba viewed the East German and Hungarian assistance as being of higher quality. Czechoslovakia also provided intelligence advisors, but details regarding their activities remain limited.
As Moscow-Havana ties deepened in the early 1960s, Cuban intelligence officers were sent to the Soviet Union for advanced training. For the remainder of the 1960s, sixty Cuban intelligence officers arrived annually for ten months of training. Half of the Cuban personnel studied foreign intelligence with the KGB. The other half was schooled in the dark art of Counterintelligence.
It was the culmination of this massive training and assistance program, followed by bilateral intelligence operations that led to Cuba's rapid rise as an intelligence powerhouse. A scholar of Dr. Latell's stature should know better than to blindly accept the recollections of defectors, no matter how well trusted or respected. Defectors are human, with inherently imperfect memories and perceptions built upon their unique experiences. They will also have biases – intended or not – based on these experiences and yes, sometimes personal agendas. Defectors can be rewarding sources of information, but their information is simply a starting point awaiting cross-checking and verification against other sources.


We meet weekly from September through June on Thursday evenings at 7:30 in the social hall below the sanctuary. We gather again on Sunday mornings at 9:15 am before the service for a brush up rehearsal in the sanctuary. The choir sings a wide variety of SAB and SATB music. In addition to music for the regular weekly service the choir plans special music for the other special services which take place during the church year.
The annual Candlelight Christmas Concert is the favorite of the majority of choir members. This program has been a highlight of the Reformed Church year for over 75 years and is considered a kind of opening to the Christmas Season. Within a few weeks the Christmas season comes to a crescendo with the annual Christmas Eve Service. Preparations for the Candlelight Service and Christmas Eve begin in early October.
We believe that you will find the choir a friendly and dedicated group. Our musical skills vary greatly but all enjoy singing with a traditional mixed chorus. If your music reading skills lag behind your love for singing, you should not hesitate to join the group.
During the summer, the choir takes a well deserved vacation from its weekly responsibilities. If you enjoy singing solos or in small ensembles and wish to volunteer some special music, please contact us. Special music is welcomed and greatly appreciated.
We invite, welcome and encourage you to come and try us out.
Music in worship has always held a special place in my life. From early years at my home church in California, from teachers, mentors and fellow musicians, from both choral and instrumental performances over the years, the value of sacred music has become an inspiration. I look forward to working with the Senior Choir and sharing those special values. I am delighted to join with the staff and congregation, to support and continue the fine musical traditions of the Reformed Church of New Paltz.


Back when I interviewed Casey Crescenzo last year on their headlining tour he was mentioning he was working on an undertaking of songs all based on the colors of the rainbow, and using black and white as basically the book ends. Being a huge Dear Hunter fan I was immediately excited at the possibilities of what this could entail and also extremely amazed that The Dear Hunter was looking to release 9 EPs at once.
Fast forward a year and The Color Spectrum has been released through Triple Crown Records, featuring 36 brand new songs. I must admit when Casey mentioned this undertaking I figured that the EPs would probably contain some filler considering the massiveness of the project, but boy was I wrong. Everything from the production to the songwriting is absolutely amazing.
What I find to be The Color Spectrum's greatest strength I also think is it's greatest weakness and that is how much each color sounds completely different from the last. It is truly remarkable how Casey can change genres such as blues, rock, electronic, piano rock, grunge and more with perfect ease. It's almost startling how easily Casey can transform The Dear Hunter to sound like Radiohead, Nine Inch Nails, Phish, Ben Folds, and even Coldplay and even doing those bands sounds better than they can.
With each color having only 4 songs and such different moods and style changes you would think that it would be difficult to follow along, but each color blends pretty seamlessly into each other. That being said inevitably like myself you most likely are most likely going to find certain colors that you really love and others that you could do with out (yellow, yes I'm looking at you).
Overall The Color Spectrum is absolutely incredible from top to bottom it truly shows off how much of a musical genius and talent Casey Crescenzo is. From a listening standpoint it's quite the undertaking just listening to a 36 song collection and I cant even imagine the musical undertaking that this took.
In closing while there is something for everyone on this album, most likely not everything on this album will appeal to just one listener. Regardless this is an album that is truly worth supporting and picking up.


text:
Q: Why can't I use Template Toolkit? I am trying to use TemplateToolkit instead of good ole' variable interpolation and my server is giving me a lot of grief.  Here are the errors I am getting:
*** 'D:\Inetpub\gic\source\extjs_source.plx' error message at: 2008/09/30 15:27:37 failed to create context: failed to create context: failed to load Template/Stash/XS.pm: Couldn't load Template::Stash::XS 2.20:

Can't load 'D:/Perl/site/lib/auto/Template/Stash/XS/XS.dll' for module Template::Stash::XS: load_file:The specified procedure could not be found at D:/Perl/lib/DynaLoader.pm line 230.  at D:/Perl/site/lib/Template/Stash/XS.pm line 31

BEGIN failed--compilation aborted at D:/Perl/site/lib/Template/Stash/XS.pm line 31. Compilation failed in require at D:/Perl/site/lib/Template/Config.pm line 82.

The Platform is Windows Server 2003 and we are using ActiveState perl and PPM for the packages with IIS.

A: From what I hear, if Template Toolkit is available for Strawberry Perl, you should definitely look into switching to Strawberry.

A: I figured this one out after a long time.  Apparently the ActiveState people didn't check much into the package because it requires Template::Stash::XS, but that's not actually available in PPM.  To fix this issue just edit the Template/Config.pm and change Template::Stash::XS to Template::Stash.

redpajama_set_name: RedPajamaStackExchange


As one of Audi's most attractive and technology packed models currently available, the Audi A4 - which comes in saloon and Avant options - is a striking vehicle that epitomises the exceptional values of the brand.
With a range of used Audi A4s available from our dealership in Canterbury, we at Motorline Audi are delighted to be able to provide great value for money access to a selection of models from this impressive lineup.
Featuring the looks of a sophisticated executive saloon from the outside and a level of interior luxury that is among the finest in its class, a used Audi A4 can be relied upon to offer the very best in quality. Fine Audi craftsmanship is evident in the intelligent arrangement of the dashboard and the sumptuous materials used throughout. Plus, with such technology as touchscreen entertainment systems and a full complement of safety measures, this is a contemporary model that offers more for your money.
View the latest array of used Audi A4s available in Canterbury below, and get in touch with our expert sales advisors to book a test drive and learn more about purchasing one of our used cars through affordable vehicle financing.


text:
Malita es un municipio filipino de primera categoría, situado en la parte sudeste de la isla de Mindanao. Forma parte de la provincia de Dávao del Sur situada en la región administrativa de Dávao. Para las elecciones está encuadrado en el Segundo Distrito Electoral.

Barrios
El municipio de Malita se divide, a los efectos administrativos, en 30 barangayes o barrios, conforme a la siguiente relación:

Historia
El actual territorio de la provincia de Davao del Sur fue parte de la provincia de Caraga durante la mayor parte del Imperio español en Asia y Oceanía (1520-1898). A principios del siglo XX la isla de Mindanao se hallaba dividida en siete distritos o provincias.

El Distrito 4º de Dávao, llamado hasta 1858  provincia de Nueva Guipúzcoa, tenía por capital el pueblo de Dávao e incluía la  Comandancia de Mati. Malita existió como un barrio mucho antes de la llegada de los estadounidenses a Davao.

Durante la ocupación estadounidense de Filipinas Malita fue uno de los 15 municipios y distritos municipales que formaban la provincia de Davao. Ya figuraba como parte de la provincia del Moro.

Malita es el segundo municipio más antiguo de la provincia, tras el de Santa Cruz. Su creación como tal data del  17 de noviembre de 1936.

El 16 de junio de 1955 los barrios de Basiaguánn y de Kibulán, así como los sitios de Kimatay y Kilalag pasan a depender del municipio de Malalag.

En 1967, la provincia de Davao se divide en tres provincias: Davao del Norte, Davao del Sur y Davao Oriental.

Etimología
Según la etimología popular, su nombre deriva de la palabra española maleta. Don Mariano Peralta, un veterano de la Guerra Española-Americana,   se aventuró en el lugar estableciéndose en la vasta y fértil llanura de este término. Un día, mientras vadeba el río, su maleta fue arrastrada por la fuerza de la corriente. Sus gritos desesperados de ¡Maleta, maleta! atrajeron la atención de los nativos, quienes pensaron que esta palabra se refería a la tierra donde tenía la intención de instalarse. El uso frecuente de esta palabra por los indios transforma el sonido  por el de  .

Referencias

Localidades de Dávao Occidental
Municipios de Filipinas de Primera Categoría
Estados y territorios fundados en 1936