### Question:
TableStats { public double estimateScanCost() { return totalIOCost; } TableStats(int tableid, int ioCostPerPage); static TableStats getTableStats(String tablename); static void setTableStats(String tablename, TableStats stats); static void setStatsMap(HashMap<String,TableStats> s); static Map<String, TableStats> getStatsMap(); static void computeStatistics(); double estimateScanCost(); int estimateTableCardinality(double selectivityFactor); double avgSelectivity(int field, Predicate.Op op); double estimateSelectivity(int field, Predicate.Op op, Field constant); int totalTuples();  }### Answer:
@Test public void estimateScanCostTest() throws IOException, DbException, TransactionAbortedException { Object[] ret; int[] ioCosts = new int[20]; int[] pageNums = new int[ioCosts.length]; for(int i = 0; i < ioCosts.length; ++i) { ioCosts[i] = 1; pageNums[i] = 3*(i+1); } double stats[] = getRandomTableScanCosts(pageNums, ioCosts); ret = SystemTestUtil.checkConstant(stats); Assert.assertEquals(ret[0], Boolean.FALSE); ret = SystemTestUtil.checkLinear(stats); Assert.assertEquals(ret[0], Boolean.TRUE); for(int i = 0; i < ioCosts.length; ++i) { ioCosts[i] = 10*(i + 1); pageNums[i] = 3; } stats = getRandomTableScanCosts(pageNums, ioCosts); ret = SystemTestUtil.checkConstant(stats); Assert.assertEquals(ret[0], Boolean.FALSE); ret = SystemTestUtil.checkLinear(stats); Assert.assertEquals(ret[0], Boolean.TRUE); for(int i = 0; i < ioCosts.length; ++i) { ioCosts[i] = 3*(i + 1); pageNums[i] = (i+1); } stats = getRandomTableScanCosts(pageNums, ioCosts); ret = SystemTestUtil.checkConstant(stats); Assert.assertEquals(ret[0], Boolean.FALSE); ret = SystemTestUtil.checkLinear(stats); Assert.assertEquals(ret[0], Boolean.FALSE); ret = SystemTestUtil.checkQuadratic(stats); Assert.assertEquals(ret[0], Boolean.TRUE); }