@Test public void testHash() { Random r = new Random(0); int[] utf32 = new int[20]; tstEquiv(utf32, 0); utf32[0] = 0x10000; tstEquiv(utf32, 1); utf32[0] = 0x8000; tstEquiv(utf32, 1); utf32[0] = Character.MAX_CODE_POINT; tstEquiv(utf32, 1); for (int iter = 0; iter < 10000; iter++) { int len = r.nextInt(utf32.length + 1); for (int i = 0; i < len; i++) { int codePoint; do { codePoint = r.nextInt(Character.MAX_CODE_POINT + 1); } while ((codePoint & 0xF800) == 0xD800); // avoid surrogate code points utf32[i] = codePoint; } // System.out.println("len="+len + ","+utf32[0]+","+utf32[1]); tstEquiv(utf32, len); } }