[llvm-commits] CVS: llvm-java/test/Programs/SingleSource/UnitTests/Maps.java

Alkis Evlogimenos alkis at cs.uiuc.edu
Wed Feb 2 10:53:32 PST 2005



Changes in directory llvm-java/test/Programs/SingleSource/UnitTests:

Maps.java updated: 1.1 -> 1.2
---
Log message:

Pull some code out

---
Diffs of the changes:  (+15 -4)

 Maps.java |   19 +++++++++++++++----
 1 files changed, 15 insertions(+), 4 deletions(-)


Index: llvm-java/test/Programs/SingleSource/UnitTests/Maps.java
diff -u llvm-java/test/Programs/SingleSource/UnitTests/Maps.java:1.1 llvm-java/test/Programs/SingleSource/UnitTests/Maps.java:1.2
--- llvm-java/test/Programs/SingleSource/UnitTests/Maps.java:1.1	Tue Jan 25 16:28:08 2005
+++ llvm-java/test/Programs/SingleSource/UnitTests/Maps.java	Wed Feb  2 12:53:21 2005
@@ -4,11 +4,22 @@
 {
     public static Random rand = new Random(0);
 
+    public static void fillMapWithRandomInts(Map m) {
+        int size = rand.nextInt(45) + 5;
+        for (int i = 0; i < size; ++i)
+            m.put(new Integer(i), new Integer(rand.nextInt()));
+    }
+
+    public static void printIntMap(Map m) {
+        for (int i = 0; i < m.size(); ++i) {
+            Integer I = (Integer) m.get(new Integer(i));
+            Test.println(I.intValue());
+        }
+    }
+
     public static void main(String[] args) {
         TreeMap tmap = new TreeMap();
-        for (int i = 0; i < 1000; ++i)
-            tmap.put(new Integer(i), new Integer(rand.nextInt()));
-        for (int i = 0; i < 1000; ++i)
-            Test.println(((Integer)tmap.get(new Integer(i))).intValue());
+        fillMapWithRandomInts(tmap);
+        printIntMap(tmap);
     }
 }






More information about the llvm-commits mailing list