diff --git a/lib/src/trove4j_changes.txt b/lib/src/trove4j_changes.txt index e6f59e60a6c6..bb567bbf2156 100644 --- a/lib/src/trove4j_changes.txt +++ b/lib/src/trove4j_changes.txt @@ -1,3 +1,8 @@ +Date: 4 Feb 2013 + Changed classes: + gnu.trove.THashMap - fixed bug in the Entry.setValue() + gnu.trove.benchmark.* - moved to the util/gnu.trove.benchmark package + Date: 5 May 2012 Changed classes: gnu.trove.TPrimitiveHash - fixed manual setUp in constructor (capacity, load_fator) as proper super call will do it properly diff --git a/lib/src/trove4j_src.jar b/lib/src/trove4j_src.jar index 27160558b595..693c96410a03 100644 Binary files a/lib/src/trove4j_src.jar and b/lib/src/trove4j_src.jar differ diff --git a/lib/trove4j.jar b/lib/trove4j.jar index 2373faf0200d..23b2e996432f 100644 Binary files a/lib/trove4j.jar and b/lib/trove4j.jar differ diff --git a/platform/util/testSrc/com/intellij/util/containers/TObjectIntHashMapTest.java b/platform/util/testSrc/com/intellij/util/containers/TObjectIntHashMapTest.java deleted file mode 100644 index dddfb4389626..000000000000 --- a/platform/util/testSrc/com/intellij/util/containers/TObjectIntHashMapTest.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 2000-2009 JetBrains s.r.o. - * - * 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.intellij.util.containers; - - - -public class TObjectIntHashMapTest extends junit.framework.TestCase { - public void test() { - gnu.trove.TObjectIntHashMap map = new gnu.trove.TObjectIntHashMap(); - map.trimToSize(); - for (int i = 0; i < 100; i++) { - String key = String.valueOf(i); - map.put(key, i); - map.put(key+"a", i); - } - for (int i = 0; i < 100; i++) { - String key = String.valueOf(i); - junit.framework.Assert.assertEquals(i, map.get(key)); - junit.framework.Assert.assertEquals(i, map.get(key+"a")); - } - junit.framework.Assert.assertEquals(200, map.size()); - } -} diff --git a/platform/util/testSrc/com/intellij/util/containers/TroveTest.java b/platform/util/testSrc/com/intellij/util/containers/TroveTest.java new file mode 100644 index 000000000000..443413a88d84 --- /dev/null +++ b/platform/util/testSrc/com/intellij/util/containers/TroveTest.java @@ -0,0 +1,61 @@ +/* + * Copyright 2000-2013 JetBrains s.r.o. + * + * 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.intellij.util.containers; + + +import gnu.trove.THashMap; +import gnu.trove.TObjectIntHashMap; +import junit.framework.Assert; +import junit.framework.TestCase; + +import java.util.Map; + +public class TroveTest extends TestCase { + public void testObjectInt() { + TObjectIntHashMap map = new TObjectIntHashMap(); + map.trimToSize(); + for (int i = 0; i < 100; i++) { + String key = String.valueOf(i); + map.put(key, i); + map.put(key+"a", i); + } + for (int i = 0; i < 100; i++) { + String key = String.valueOf(i); + Assert.assertEquals(i, map.get(key)); + Assert.assertEquals(i, map.get(key+"a")); + } + Assert.assertEquals(200, map.size()); + } + + public void testTHashMap_Entry() { + Map map = new THashMap(); + map.put("1", "2"); + + Map.Entry entry = map.entrySet().iterator().next(); + + assertEquals("1", entry.getKey()); + assertEquals("2", entry.getValue()); + Object old = entry.setValue("3"); + assertEquals("2", old); + assertEquals("1", entry.getKey()); + assertEquals("3", entry.getValue()); + + Map.Entry refreshed = map.entrySet().iterator().next(); + assertEquals("1", refreshed.getKey()); + assertEquals("3", refreshed.getValue()); + } +}