comparison test/org/tmatesoft/hg/test/TestIntMap.java @ 415:ee8264d80747

Explicit constant for regular file flags, access to flags for a given file revision
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Thu, 22 Mar 2012 18:54:11 +0100
parents 55fad5e0e98b
children
comparison
equal deleted inserted replaced
414:bb278ccf9866 415:ee8264d80747
15 * contact TMate Software at support@hg4j.com 15 * contact TMate Software at support@hg4j.com
16 */ 16 */
17 package org.tmatesoft.hg.test; 17 package org.tmatesoft.hg.test;
18 18
19 import static org.junit.Assert.assertEquals; 19 import static org.junit.Assert.assertEquals;
20
21 import java.util.HashMap;
22 import java.util.Iterator;
23 import java.util.Map;
24 import java.util.Map.Entry;
20 25
21 import org.junit.Test; 26 import org.junit.Test;
22 import org.tmatesoft.hg.internal.IntMap; 27 import org.tmatesoft.hg.internal.IntMap;
23 28
24 /** 29 /**
57 assertEquals(m.get(i), Integer.toString(i)); 62 assertEquals(m.get(i), Integer.toString(i));
58 } 63 }
59 } 64 }
60 assertEquals(m.size(), actualCount); 65 assertEquals(m.size(), actualCount);
61 } 66 }
67
68 @Test
69 public void testIterators() {
70 IntMap<Boolean> m = new IntMap<Boolean>(20);
71 for (int i = 0; i <= 30; i+= 5) {
72 m.put(i, Boolean.TRUE);
73 }
74 HashMap<Integer, Boolean> hm = new HashMap<Integer, Boolean>();
75 for (Iterator<Map.Entry<Integer, Boolean>> it = m.entryIterator(); it.hasNext(); ) {
76 Entry<Integer, Boolean> next = it.next();
77 hm.put(next.getKey(), next.getValue());
78 }
79 assertEquals(m.size(), hm.size());
80 for (int i = 0; i <= 30; i++) {
81 assertEquals(m.get(i), hm.get(i));
82 }
83 //
84 HashMap<Integer, Boolean> hm2 = new HashMap<Integer, Boolean>();
85 m.fill(hm2);
86 assertEquals(hm, hm2);
87 }
62 } 88 }