Revision: 7987
Author: rchan...@google.com
Date: Mon Apr 26 12:38:54 2010
Log: Reverting CL15463571
http://gwt-code-reviews.appspot.com/363801/show

Review by: j...@google.com
http://code.google.com/p/google-web-toolkit/source/detail?r=7987

Deleted:
 /branches/2.1/bikeshed/src/com/google/gwt/collections/super
/branches/2.1/bikeshed/test/com/google/gwt/collections/CollectionsServerSideTestSuite.java /branches/2.1/bikeshed/test/com/google/gwt/collections/CollectionsTestSuite.java /branches/2.1/bikeshed/test/com/google/gwt/collections/MutableArrayInternalTest.java /branches/2.1/bikeshed/test/com/google/gwt/collections/MutableArrayTest.java
 /branches/2.1/bikeshed/test/com/google/gwt/collections/super
Modified:
 /branches/2.1/bikeshed/src/com/google/gwt/collections/Collections.gwt.xml
 /branches/2.1/bikeshed/src/com/google/gwt/collections/MutableArray.java
/branches/2.1/bikeshed/test/com/google/gwt/collections/ClientMutableArrayTest.java /branches/2.1/bikeshed/test/com/google/gwt/collections/ImmutableArrayTest.java /branches/2.1/bikeshed/test/com/google/gwt/collections/MutableArrayBenchmarkTest.java

=======================================
--- /branches/2.1/bikeshed/test/com/google/gwt/collections/CollectionsServerSideTestSuite.java Mon Apr 26 10:16:20 2010
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright 2009 Google Inc.
- *
- * Licensed 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 com.google.gwt.collections;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-/**
- * This suite collects all server-side Lightweight collections tests.
- */
-public class CollectionsServerSideTestSuite extends TestSuite {
-  public static Test suite() {
-    TestSuite suite =
-      new TestSuite("All Gwt Lightweight collections unit tests");
-
-    suite.addTestSuite(MutableArrayTest.class);
-    suite.addTestSuite(MutableArrayInternalTest.class);
-    suite.addTestSuite(ImmutableArrayTest.class);
-
-    return suite;
-  }
-}
=======================================
--- /branches/2.1/bikeshed/test/com/google/gwt/collections/CollectionsTestSuite.java Mon Apr 26 10:16:20 2010
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright 2009 Google Inc.
- *
- * Licensed 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 com.google.gwt.collections;
-
-import com.google.gwt.junit.tools.GWTTestSuite;
-
-import junit.framework.Test;
-
-/**
- * This suite collects all client-side Lightweight collections tests.
- */
-public class CollectionsTestSuite extends GWTTestSuite {
-  public static Test suite() {
- GWTTestSuite suite = new GWTTestSuite("All Gwt Lightwight collections unit tests");
-
-    suite.addTestSuite(ClientMutableArrayTest.class);
-    suite.addTestSuite(GwtImmutableArrayTest.class);
-
-    return suite;
-  }
-}
=======================================
--- /branches/2.1/bikeshed/test/com/google/gwt/collections/MutableArrayInternalTest.java Mon Apr 26 10:16:20 2010
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright 2009 Google Inc.
- *
- * Licensed 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 com.google.gwt.collections;
-
-import com.google.gwt.junit.client.GWTTestCase;
-
-/**
- * Tests mutable array implementation internal details.
- */
-public class MutableArrayInternalTest extends GWTTestCase {
-
-  @Override
-  public String getModuleName() {
-    return null;
-  }
-
-  public void testSetSizeNullElems() {
-    MutableArray<String> b = CollectionFactory.createMutableArray();
-
-    b.setSize(1, "fillValue");
-    assertNotNull(b.elems);
-
-    b.setSize(0, null);
-    assertEquals(null, b.elems);
-  }
-
-}
=======================================
--- /branches/2.1/bikeshed/test/com/google/gwt/collections/MutableArrayTest.java Mon Apr 26 10:16:20 2010
+++ /dev/null
@@ -1,297 +0,0 @@
-/*
- * Copyright 2009 Google Inc.
- *
- * Licensed 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 com.google.gwt.collections;
-
-import static com.google.gwt.collections.CollectionFactory.createMutableArray;
-
-import com.google.gwt.junit.client.GWTTestCase;
-
-/**
- * Tests mutable arrays.
- */
-public class MutableArrayTest extends GWTTestCase {
-
-  boolean assertionsEnabled;
-
-  @Override
-  public String getModuleName() {
-    return null;
-  }
-
-  public void gwtSetUp() {
-    assertionsEnabled = this.getClass().desiredAssertionStatus();
-  }
-
-  public void testClear() {
-    {
-      // Clear an empty array
-      MutableArray<Object> b = createMutableArray();
-      b.clear();
-      assertEquals(0, b.size());
-    }
-
-    {
-      // Clear a non-empty array
-      MutableArray<Object> b = createMutableArray();
-      b.add("string");
-      b.add(false);
-      b.add(3);
-      b.clear();
-      assertEquals(0, b.size());
-    }
-  }
-
-  public void testCreateNonEmptyArray() {
-    MutableArray<String> b = createMutableArray(2, "apples");
-
-    assertEquals(2, b.size());
-    assertEquals("apples", b.get(0));
-    assertEquals("apples", b.get(1));
-  }
-
-  public void testInsertAtBeginning() {
-    final int n = 10;
-    MutableArray<Integer> b = createMutableArray();
-
-    for (int i = 0; i < n; ++i) {
-      b.insert(0, i);
-    }
-
-    for (int i = 0; i < n; ++i) {
-      assertEquals(n - i - 1, b.get(i).intValue());
-    }
-  }
-
-  public void testInsertAtEnd() {
-    final int n = 10;
-    MutableArray<Integer> b = createMutableArray();
-
-    for (int i = 0; i < n; ++i) {
-      b.insert(b.size(), i);
-    }
-
-    for (int i = 0; i < n; ++i) {
-      assertEquals(i, b.get(i).intValue());
-    }
-  }
-
-  public void testInsertInMiddle() {
-    final int n = 10;
-    MutableArray<Integer> b = createMutableArray();
-
-    // Fill the array with 0..(N-1)
-    for (int i = 0; i < n; ++i) {
-      b.insert(b.size(), i);
-    }
-
-    // Double each number by inserting.
-    for (int i = 0; i < n; ++i) {
-      b.insert(i * 2, i);
-    }
-
-    for (int i = 0, j = 0; i < 2 * n; i += 2, ++j) {
-      assertEquals(j, b.get(i).intValue());
-      assertEquals(j, b.get(i + 1).intValue());
-    }
-  }
-
-  public void testMultiElementArrayManipulations() {
-    MutableArray<String> b = createMutableArray();
-    b.add("apple");
-    b.add("banana");
-    b.add("coconut");
-    b.add(null);
-    b.add("donut");
-
-    // On mutable array, get() in order
-    assertEquals("apple", b.get(0));
-    assertEquals("banana", b.get(1));
-    assertEquals("coconut", b.get(2));
-    assertEquals(null, b.get(3));
-    assertEquals("donut", b.get(4));
-
-    // On mutable array, get() in non-sequential order
-    assertEquals("coconut", b.get(2));
-    assertEquals("apple", b.get(0));
-    assertEquals("donut", b.get(4));
-    assertEquals("banana", b.get(1));
-    assertEquals(null, b.get(3));
-
-    // Try a set() call, too
-    b.set(3, "eclair");
-    assertEquals("eclair", b.get(3));
-  }
-
-  public void testRemove() {
-    MutableArray<Integer> b = createMutableArray();
-
-    b.add(1);
-    b.add(2);
-    b.add(3);
-    b.add(4);
-    b.add(5);
-
-    // Remove from the middle to make 1,2,4,5
-    b.remove(2);
-    assertEquals(4, b.size());
-    assertEquals(1, b.get(0).intValue());
-    assertEquals(5, b.get(3).intValue());
-
-    // Remove from the beginning to make 2,4,5
-    b.remove(0);
-    assertEquals(3, b.size());
-    assertEquals(2, b.get(0).intValue());
-    assertEquals(5, b.get(2).intValue());
-
-    // Remove from the end to make 2,4
-    b.remove(b.size() - 1);
-    assertEquals(2, b.size());
-    assertEquals(2, b.get(0).intValue());
-    assertEquals(4, b.get(1).intValue());
-  }
-
-  public void testSetSize() {
-    MutableArray<String> b = createMutableArray();
-
-    b.setSize(1, "fillValue");
-    assertEquals(1, b.size());
-    assertEquals("fillValue", b.get(0));
-
-    b.setSize(2, "anotherValue");
-    assertEquals(2, b.size());
-    assertEquals("fillValue", b.get(0));
-    assertEquals("anotherValue", b.get(1));
-
-    b.setSize(1, null);
-    assertEquals(1, b.size());
-    assertEquals("fillValue", b.get(0));
-
-    b.setSize(0, null);
-    assertEquals(0, b.size());
-  }
-
-  public void testSingleElementAddAndRemove() {
-      MutableArray<String> a = createMutableArray();
-
-      a.add("foo");
-
-      assertEquals(1, a.size());
-      assertEquals("foo", a.get(0));
-
-      a.remove(0);
-
-      assertEquals(0, a.size());
-
-      a.add("bar");
-
-      assertEquals(1, a.size());
-      assertEquals("bar", a.get(0));
-  }
-
-  public void testSingleElementNull() {
-    MutableArray<String> b = createMutableArray();
-    b.add(null);
-
-    assertEquals(null, b.get(0));
-  }
-
-  public void testSingletonArrayCreationAndRetrieval() throws Exception {
-    final int c = 2112;
-    MutableArray<Integer> b = createMutableArray();
-    b.add(c);
-    assertEquals(c, b.get(0).intValue());
-
-    Array<Integer> a = b;
-    assertEquals(1, a.size());
-
-    assertEquals((Integer) 2112, a.get(0));
-  }
-
-  public void testSingletonArrayInvalidIndex() throws Exception {
-    MutableArray<Boolean> b = createMutableArray();
-    b.add(false);
-    Array<Boolean> a = b;
-
-    assertEquals((Boolean) false, a.get(0));
-
-    // Do not test undefined behavior without assertions
-    if (!assertionsEnabled) {
-      return;
-    }
-
-    try {
-      a.get(1);
-      fail("That should have failed");
-    } catch (AssertionError e) {
- assertEquals(("Index " + 1 + " was not in the acceptable range [" + 0 + ", " + 1 + ")"),
-          e.getMessage());
-    }
-  }
-
-  public void testSingletonArrayManipulations() {
-    MutableArray<String> b = createMutableArray();
-    b.add("diva");
-    b.set(0, "avid");
-    assertEquals(1, b.size());
-    assertEquals("avid", b.get(0));
-  }
-
- public void testThatEmptyArraysHaveHaveNoValidIndices() throws Exception {
-    {
-      // Do not test undefined behavior without assertions
-      if (!assertionsEnabled) {
-        return;
-      }
-      // Tests get().
-      MutableArray<String> b = createMutableArray();
-      Array<String> a = b;
-      // Iterate i through the various likely errors states.
-      for (int i = -1; i < 4; ++i) {
-        try {
-          a.get(i);
-          fail("Should have triggered an assertion");
-        } catch (AssertionError e) {
-          // Good
- assertEquals(("Index " + i + " was not in the acceptable range [" + 0 + ", "
-          + 0 + ")"), e.getMessage());
-        }
-      }
-    }
-
-    {
-      // Tests set().
-      MutableArray<String> b = createMutableArray();
-      // Iterate i through the various likely errors states.
-      for (int i = -1; i < 4; ++i) {
-        try {
-          b.set(i, "random string");
-          fail("Should have triggered an assertion");
-        } catch (AssertionError e) {
-          // Good
- assertEquals(("Index " + i + " was not in the acceptable range [" + 0 + ", "
-          + 0 + ")"), e.getMessage());
-        }
-      }
-    }
-  }
-
-  public void testThatEmptyArraysHaveSizeZero() {
-    MutableArray<String> b = createMutableArray();
-    Array<String> a = b;
-    assertEquals(0, a.size());
-  }
-
-}
=======================================
--- /branches/2.1/bikeshed/src/com/google/gwt/collections/Collections.gwt.xml Mon Apr 26 10:16:20 2010 +++ /branches/2.1/bikeshed/src/com/google/gwt/collections/Collections.gwt.xml Mon Apr 26 12:38:54 2010
@@ -16,5 +16,4 @@
 <module>
   <inherits name='com.google.gwt.user.User'/>
   <source path="" />
-  <super-source path="super"/>
 </module>
=======================================
--- /branches/2.1/bikeshed/src/com/google/gwt/collections/MutableArray.java Mon Apr 26 10:16:20 2010 +++ /branches/2.1/bikeshed/src/com/google/gwt/collections/MutableArray.java Mon Apr 26 12:38:54 2010
@@ -115,6 +115,7 @@
     Assertions.assertNotFrozen(this);
     Assertions.assertIndexInRange(index, 0, size());
     if (elems != null && elems.length >= 1) {
+      // TODO: replace with splice using JSNI
       int oldLen = elems.length;
       E[] newElems = (E[]) new Object[oldLen - 1];
       System.arraycopy(elems, 0, newElems, 0, index);
=======================================
--- /branches/2.1/bikeshed/test/com/google/gwt/collections/ClientMutableArrayTest.java Mon Apr 26 10:16:20 2010 +++ /branches/2.1/bikeshed/test/com/google/gwt/collections/ClientMutableArrayTest.java Mon Apr 26 12:38:54 2010
@@ -16,12 +16,12 @@
 package com.google.gwt.collections;

 /**
- * Re-run {...@link MutableArrayTest} tests under GWT.
+ * Re-run {...@link ObjectArrayTest} tests under GWT.
  */
-public class ClientMutableArrayTest extends MutableArrayTest {
+public class ClientMutableArrayTest extends ObjectArrayTest {
   @Override
   public String getModuleName() {
     return "com.google.gwt.collections.Collections";
   }
-
-}
+
+}
=======================================
--- /branches/2.1/bikeshed/test/com/google/gwt/collections/ImmutableArrayTest.java Mon Apr 26 10:16:20 2010 +++ /branches/2.1/bikeshed/test/com/google/gwt/collections/ImmutableArrayTest.java Mon Apr 26 12:38:54 2010
@@ -111,7 +111,6 @@
     assertTrue(ia1.elems == ia2.elems);
   }

-
   public void testModifyFrozenMutable() {
     // Do not test undefined behavior with assertions disabled
     if (!assertionsEnabled) {
=======================================
--- /branches/2.1/bikeshed/test/com/google/gwt/collections/MutableArrayBenchmarkTest.java Mon Apr 26 10:16:20 2010 +++ /branches/2.1/bikeshed/test/com/google/gwt/collections/MutableArrayBenchmarkTest.java Mon Apr 26 12:38:54 2010
@@ -20,24 +20,22 @@
 import com.google.gwt.benchmarks.client.Operator;
 import com.google.gwt.benchmarks.client.RangeField;

-import java.util.ArrayList;
-
 /**
  * Benchmarks the performance of various MutableArray methods.
  */
 public class MutableArrayBenchmarkTest extends Benchmark {

-  final IntRange elemRange = new IntRange(5, 30000, Operator.ADD, 500);
+  final IntRange elemRange = new IntRange(0, 5000, Operator.ADD, 100);

   @Override
   public String getModuleName() {
     return "com.google.gwt.collections.Collections";
   }

-  public void testGwtCollectionsArrayAddGrowth() {
+  public void testAddGrowth() {
   }

- public void testGwtCollectionsArrayAddGrowth(@RangeField("elemRange") Integer numElements) {
+  public void testAddGrowth(@RangeField("elemRange") Integer numElements) {
     MutableArray<Integer> ma = CollectionFactory.createMutableArray();

     for (int i = 0; i < numElements; i++) {
@@ -45,10 +43,10 @@
     }
   }

-  public void testGwtCollectionsArraySetSizeGrowth() {
+  public void testSetSizeGrowth() {
   }

- public void testGwtCollectionsArraySetSizeGrowth(@RangeField("elemRange") Integer numElements) { + public void testSetSizeGrowth(@RangeField("elemRange") Integer numElements) {
     MutableArray<Integer> ma = CollectionFactory.createMutableArray();

     ma.setSize(numElements, null);
@@ -56,40 +54,5 @@
       ma.set(i, i);
     }
   }
-
-  public void testGwtCollectionsArraySetSizeInitGrowth() {
-  }
-
-  public void testGwtCollectionsArraySetSizeInitGrowth(
-      @RangeField("elemRange") Integer numElements) {
-    MutableArray<Integer> ma = CollectionFactory.createMutableArray();
-
-    ma.setSize(numElements, new Integer(0));
-    for (int i = 0; i < numElements; i++) {
-      ma.set(i, i);
-    }
-  }
-
-  public void testJavaArraySetGrowth() {
-  }
-
- public void testJavaArraySetGrowth(@RangeField("elemRange") Integer numElements) {
-    Integer[] ia = new Integer[numElements];
-
-    for (int i = 0; i < numElements; i++) {
-      ia[i] = i;
-    }
-  }
-
-  public void testJreArrayListAddGrowth() {
-  }
-
- public void testJreArrayListAddGrowth(@RangeField("elemRange") Integer numElements) {
-    ArrayList<Integer> al = new ArrayList<Integer>();
-
-    for (int i = 0; i < numElements; i++) {
-      al.add(i);
-    }
-  }

 }

--
http://groups.google.com/group/Google-Web-Toolkit-Contributors

Reply via email to