MCPcopy Create free account
hub / github.com/1345414527/MIT6.830 / testTupleDesc

Method testTupleDesc

test/simpledb/systemtest/ScanTest.java:116–135  ·  view source on GitHub ↗

Verifies SeqScan's getTupleDesc prefixes the table name + "." to the field names @throws IOException

()

Source from the content-addressed store, hash-verified

114 * @throws IOException
115 */
116 @Test public void testTupleDesc() throws IOException {
117 List<List<Integer>> tuples = new ArrayList<>();
118 HeapFile f = SystemTestUtil.createRandomHeapFile(2, 1000, null, tuples, "test");
119
120 TransactionId tid = new TransactionId();
121 String prefix = "table_alias";
122 SeqScan scan = new SeqScan(tid, f.getId(), prefix);
123
124 TupleDesc original = f.getTupleDesc();
125 TupleDesc prefixed = scan.getTupleDesc();
126 assertEquals(prefix, scan.getAlias());
127
128 // Sanity check the number of fields
129 assertEquals(original.numFields(), prefixed.numFields());
130
131 // Check each field for the appropriate tableAlias. prefix
132 for (int i = 0; i < original.numFields(); i++) {
133 assertEquals(prefix + "." + original.getFieldName(i), prefixed.getFieldName(i));
134 }
135 }
136
137 /** Make test compatible with older version of ant. */
138 public static junit.framework.Test suite() {

Callers

nothing calls this directly

Calls 7

createRandomHeapFileMethod · 0.95
getIdMethod · 0.95
getTupleDescMethod · 0.95
getTupleDescMethod · 0.95
getAliasMethod · 0.95
numFieldsMethod · 0.95
getFieldNameMethod · 0.95

Tested by

no test coverage detected