// Path: src/java/minijava/util/ImpTable.java
// public class ImpTable<V> extends DefaultIndentable 
// implements Iterable<Entry<String, V>>, Lookup<V>
// {
// 	
// 	public static class DuplicateException extends Exception {
// 
// 		private static final long serialVersionUID = 8650830167061316305L;
// 
// 		public DuplicateException(String arg0) {
// 			super(arg0);
// 		}
// 
// 	}
// 
// 	private Map<String, V> map = new HashMap<String, V>();
// 
// 	@Override
// 	public Iterator<Entry<String,V>> iterator() {
// 		return map.entrySet().iterator();
// 	}
// 	
// 	/**
// 	 * Insert an entry into the table. This modifies the table.
// 	 * Duplicate entries (i.e. with the same id are not supported).
// 	 * When a duplicate id is being entered a DuplicatException is
// 	 * thrown.
// 	 * <p>
// 	 * Note: the name "put" different from the name "insert" in the
// 	 * FunTable is deliberate. This will make sure you get compile
// 	 * errors when you try to change code using imperative puts
// 	 * to use functional inserts instead.
// 	 */
// 	public void put(String id, V value) throws DuplicateException {
// 		Assert.assertNotNull(value);
// 		Assert.assertNotNull(id);
// 		V existing = map.get(id);
// 		if (existing!=null) throw new DuplicateException("Duplicate entry: "+id);
// 		map.put(id, value);
// 	}
// 	
// 	/**
// 	 * Find an entry in the table. If no entry is found, null is returned.
// 	 */
// 	public V lookup(String id) {
// 		return map.get(id);
// 	}
// 
// 	@Override
// 	public void dump(IndentingWriter out) {
// 		out.println("Table {");
// 		out.indent();
// 		for (Entry<String, V> entry : this) {
// 			out.print(entry.getKey()+" = ");
// 			out.println(entry.getValue());
// 		}
// 		out.outdent();
// 		out.print("}");
// 	}
// 
// 	public boolean isEmpty() {
// 		return size()==0;
// 	}
// 
// 	@Override
// 	public int size() {
// 		return map.size();
// 	}
// 
// }
// 
// Path: src/java/minijava/util/ImpTable.java
// public static class DuplicateException extends Exception {
// 
// 	private static final long serialVersionUID = 8650830167061316305L;
// 
// 	public DuplicateException(String arg0) {
// 		super(arg0);
// 	}
// 
// }


import minijava.util.ImpTable;
import minijava.util.ImpTable.DuplicateException;
import org.junit.Assert;
import org.junit.Test;
package minijava.test.util;



/**
 * It is a good idea to provide unit tests for all non-trivial 
 * data structure implementations. This class contains tests for
 * our implementation of Symbol tables provided in the class
 * minijava.table.ImpTable.
 * <p>
 * The implementation of Table that is provided is already complete.
 * These tests should run and pass "out of the box".
 * 
 * @author kdvolder
 */
public class ImpTableTest {
	
	@Test public void testEmptyTable() {
		ImpTable<Integer> tab = new ImpTable<Integer>();
		Assert.assertTrue(tab.isEmpty());
		Assert.assertNull(tab.lookup("something"));
	}

	@Test public void testOneInsert() throws DuplicateException {
// Path: src/java/minijava/util/ImpTable.java
// public class ImpTable<V> extends DefaultIndentable 
// implements Iterable<Entry<String, V>>, Lookup<V>
// {
// 	
// 	public static class DuplicateException extends Exception {
// 
// 		private static final long serialVersionUID = 8650830167061316305L;
// 
// 		public DuplicateException(String arg0) {
// 			super(arg0);
// 		}
// 
// 	}
// 
// 	private Map<String, V> map = new HashMap<String, V>();
// 
// 	@Override
// 	public Iterator<Entry<String,V>> iterator() {
// 		return map.entrySet().iterator();
// 	}
// 	
// 	/**
// 	 * Insert an entry into the table. This modifies the table.
// 	 * Duplicate entries (i.e. with the same id are not supported).
// 	 * When a duplicate id is being entered a DuplicatException is
// 	 * thrown.
// 	 * <p>
// 	 * Note: the name "put" different from the name "insert" in the
// 	 * FunTable is deliberate. This will make sure you get compile
// 	 * errors when you try to change code using imperative puts
// 	 * to use functional inserts instead.
// 	 */
// 	public void put(String id, V value) throws DuplicateException {
// 		Assert.assertNotNull(value);
// 		Assert.assertNotNull(id);
// 		V existing = map.get(id);
// 		if (existing!=null) throw new DuplicateException("Duplicate entry: "+id);
// 		map.put(id, value);
// 	}
// 	
// 	/**
// 	 * Find an entry in the table. If no entry is found, null is returned.
// 	 */
// 	public V lookup(String id) {
// 		return map.get(id);
// 	}
// 
// 	@Override
// 	public void dump(IndentingWriter out) {
// 		out.println("Table {");
// 		out.indent();
// 		for (Entry<String, V> entry : this) {
// 			out.print(entry.getKey()+" = ");
// 			out.println(entry.getValue());
// 		}
// 		out.outdent();
// 		out.print("}");
// 	}
// 
// 	public boolean isEmpty() {
// 		return size()==0;
// 	}
// 
// 	@Override
// 	public int size() {
// 		return map.size();
// 	}
// 
// }
// 
// Path: src/java/minijava/util/ImpTable.java
// public static class DuplicateException extends Exception {
// 
// 	private static final long serialVersionUID = 8650830167061316305L;
// 
// 	public DuplicateException(String arg0) {
// 		super(arg0);
// 	}
// 
// }


// Path: src/java/minijava/test/util/ImpTableTest.java
import minijava.util.ImpTable;
import minijava.util.ImpTable.DuplicateException;
import org.junit.Assert;
import org.junit.Test;

package minijava.test.util;



/**
 * It is a good idea to provide unit tests for all non-trivial 
 * data structure implementations. This class contains tests for
 * our implementation of Symbol tables provided in the class
 * minijava.table.ImpTable.
 * <p>
 * The implementation of Table that is provided is already complete.
 * These tests should run and pass "out of the box".
 * 
 * @author kdvolder
 */
public class ImpTableTest {
	
	@Test public void testEmptyTable() {
		ImpTable<Integer> tab = new ImpTable<Integer>();
		Assert.assertTrue(tab.isEmpty());
		Assert.assertNull(tab.lookup("something"));
	}

	@Test public void testOneInsert() throws DuplicateException {
		ImpTable<Integer> tab = new ImpTable<Integer>();