package simpledb;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import junit.framework.JUnit4TestAdapter;

import org.junit.Before;
import org.junit.Test;

import simpledb.systemtest.SimpleDbTestBase;

public class ImputeTest extends SimpleDbTestBase {

  int testWidth = 3;
  DbIterator scan;

  /**
   * Initialize each unit test
   */
  @Before public void setUp() {
	  this.scan = new TestUtil.MockScanWithMissing(-5, 5, testWidth);
  }

  /**
   * Unit test for Impute.getTupleDesc()
   */
  @Test public void getTupleDesc() {
  }

  /**
   * Unit test for Impute.rewind()
   */
  @Test public void rewind() throws Exception {
  }
  
  @Test public void imputeTotallyRandom() throws Exception {
	  Impute op= new ImputeTotallyRandom(scan);
	  op.open();
	  while (op.hasNext()){
		  Tuple t = op.next();
		  assertTrue(!t.hasMissingFields());
	  }
	  op.close();
  }

  /**
   * JUnit suite target
   */
  public static junit.framework.Test suite() {
    return new JUnit4TestAdapter(ImputeTest.class);
  }
}

@@ -595,18 +595,60 @@
 leDesc()
+. TupleDesc should be identical as before.
 %0D%0A
-
    */%0D%0A 
@@ -680,24 +680,207 @@
 leDesc() %7B%0D%0A
+%09  Impute op = new ImputeTotallyRandom(scan);%0D%0A%09  TupleDesc expected = Utility.getTupleDesc(testWidth);%0D%0A%09  TupleDesc actual = op.getTupleDesc();%0D%0A%09  assertEquals(expected, actual);%0D%0A
   %7D%0D%0A%0D%0A  /**
@@ -1040,24 +1040,24 @@
 xception %7B%0D%0A
-
 %09  Impute op
@@ -1056,16 +1056,17 @@
 mpute op
+ 
 = new Im

Add unit test for ImputeTotallyRandom#getTupleDesc()