harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From telli...@apache.org
Subject svn commit: r486127 - in /harmony/enhanced/classlib/trunk/modules/misc/src/test/java/common: ./ org/ org/apache/ org/apache/harmony/ org/apache/harmony/misc/ org/apache/harmony/misc/tests/ org/apache/harmony/misc/tests/accessors/
Date Tue, 12 Dec 2006 13:15:04 GMT
Author: tellison
Date: Tue Dec 12 05:15:03 2006
New Revision: 486127

URL: http://svn.apache.org/viewvc?view=rev&rev=486127
Log:
Adding test case from HARMONY-2616 ([classlib][misc] StringAccessor.getChars(long, long, String,
int, int) doesn't set trailing zero)

Added:
    harmony/enhanced/classlib/trunk/modules/misc/src/test/java/common/
    harmony/enhanced/classlib/trunk/modules/misc/src/test/java/common/org/
    harmony/enhanced/classlib/trunk/modules/misc/src/test/java/common/org/apache/
    harmony/enhanced/classlib/trunk/modules/misc/src/test/java/common/org/apache/harmony/
    harmony/enhanced/classlib/trunk/modules/misc/src/test/java/common/org/apache/harmony/misc/
    harmony/enhanced/classlib/trunk/modules/misc/src/test/java/common/org/apache/harmony/misc/tests/
    harmony/enhanced/classlib/trunk/modules/misc/src/test/java/common/org/apache/harmony/misc/tests/accessors/
    harmony/enhanced/classlib/trunk/modules/misc/src/test/java/common/org/apache/harmony/misc/tests/accessors/StringAccessorTest.java
  (with props)

Added: harmony/enhanced/classlib/trunk/modules/misc/src/test/java/common/org/apache/harmony/misc/tests/accessors/StringAccessorTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/misc/src/test/java/common/org/apache/harmony/misc/tests/accessors/StringAccessorTest.java?view=auto&rev=486127
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/misc/src/test/java/common/org/apache/harmony/misc/tests/accessors/StringAccessorTest.java
(added)
+++ harmony/enhanced/classlib/trunk/modules/misc/src/test/java/common/org/apache/harmony/misc/tests/accessors/StringAccessorTest.java
Tue Dec 12 05:15:03 2006
@@ -0,0 +1,54 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+
+package org.apache.harmony.misc.tests.accessors;
+
+import junit.framework.TestCase;
+import org.apache.harmony.misc.accessors.StringAccessor;
+import org.apache.harmony.misc.accessors.AccessorFactory;
+import org.apache.harmony.awt.nativebridge.NativeBridge;
+import org.apache.harmony.awt.nativebridge.Int8Pointer;
+
+public class StringAccessorTest extends TestCase {
+    public void test_getChars() throws Exception {
+        StringAccessor acc = AccessorFactory.getStringAccessor();
+
+        String str = new String("Hello world!");
+
+        long ptr1 = acc.getChars(str);
+        Int8Pointer iptr1 = NativeBridge.getInstance().createInt8Pointer(ptr1);
+        assertEquals(0, iptr1.get(str.length()*2));
+        assertEquals(0, iptr1.get(str.length()*2+1));
+
+        Int8Pointer iptr2 = NativeBridge.getInstance().createInt8Pointer(12, false);
+        iptr2.fill((byte)0xFF, 12);
+        long ptr2 = iptr2.lock();
+        long ptr3 = acc.getChars(ptr2, 12, str, 6, 5);
+        assertEquals(ptr2, ptr3);
+        iptr2.unlock();
+
+        assertEquals(0, acc.compareString(new String("world"), iptr2.lock(), 5));
+        iptr2.unlock();
+
+        assertEquals(0, iptr2.get(10));
+        assertEquals(0, iptr2.get(11));
+
+        iptr1.free();
+        iptr2.free();
+    }
+}

Propchange: harmony/enhanced/classlib/trunk/modules/misc/src/test/java/common/org/apache/harmony/misc/tests/accessors/StringAccessorTest.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message