&sectionHeader('Gmap Unit Tests (35 points)');
$subtotal = 0;
@SOURCE = ();
@LINK = ();
$subtotal = &runTest('001', 'gmap_get');
$subtotal += &runTest('002', 'gmap_size');
$subtotal += &runTest('003', 'gmap_contains_key');
$subtotal += &runTest('004', 'gmap_put copies key');
$subtotal += &runTest('005', 'gmap_put does not copy value');
$subtotal += &runTest('006', 'gmap_put multiple times same key');
$subtotal += &runTest('007', 'Large map');
$subtotal += &runTest('008', 'Large map with bad hash function');
$subtotal += &runTest('009', 'gmap_for_each');
$subtotal += &runTest('010', 'gmap_keys');
$subtotal += &runTest('011', 'gmap with alternative key and value types');
$subtotal = $subtotal * 35 / 11;
$total += floor($subtotal);
&sectionResults('Gmap Unit Tests (35 points)', $subtotal, 11, $checkpoint );
$testCount += 11;

&sectionHeader('Gmap Unit Tests with Valgrind (15 points)');
$subtotal = 0;
@SOURCE = ();
@LINK = ();
$subtotal = &runTest('012', 'gmap_get');
$subtotal += &runTest('013', 'gmap_put copies key');
$subtotal += &runTest('014', 'gmap_put does not copy value');
$subtotal += &runTest('015', 'gmap_put multiple times same key');
$subtotal += &runTest('016', 'Large map');
$subtotal += &runTest('017', 'gmap_for_each');
$subtotal += &runTest('018', 'gmap_keys');
$subtotal += &runTest('019', 'gmap with alternative key and value types');
$subtotal = $subtotal * 15 / 8;
$total += floor($subtotal);
&sectionResults('Gmap Unit Tests with Valgrind (15 points)', $subtotal, 8, $checkpoint );
$testCount += 8;

&sectionHeader('Gmap Worst-case Running Times (10 points)');
$subtotal = 0;
@SOURCE = ();
@LINK = ();
$subtotal = &runTest('020', 'gmap_for_each');
$subtotal += &runTest('021', 'gmap_put');
$subtotal += &runTest('022', 'gmap_get');
@scores = (0,2,5,10);
 $subtotal = (int($subtotal) < scalar @scores) ? $scores[int($subtotal)] : $scores[(scalar @scores) - 1];
$total += floor($subtotal);
&sectionResults('Gmap Worst-case Running Times (10 points)', $subtotal, 3, $checkpoint );
$testCount += 3;

&sectionHeader('Showstopper Circumvention Tests (no credit for gmap if any fail)');
$subtotal = 0;
@SOURCE = ();
@LINK = ();
$subtotal = &runTest('023', 'Initial size is reasonable');
$subtotal += &runTest('024', 'Uses supplied hash function');
$subtotal += &runTest('025', 'gmap_put expected time');
$subtotal += &runTest('026', 'gmap_get expected time');
$subtotal = ($subtotal < 4 ? - $total : 0);
$total += floor($subtotal);
&sectionResults('Showstopper Circumvention Tests (no credit for gmap if any fail)', $subtotal, 4, $checkpoint );
$testCount += 4;

&sectionHeader('Competitions (40 points)');
$subtotal = 0;
@SOURCE = ();
@LINK = ();
$subtotal = &runTest('027', '2 Battlefields, 2 Entries');
$subtotal += &runTest('028', '2 Battlefields, 3 Entries');
$subtotal += &runTest('029', '4 Battlefields, 3 Entries');
$subtotal += &runTest('030', '4 Battlefields, 2 Entries, Tied Matchup');
$subtotal += &runTest('031', '4 Battlefields, 4 entries, not Round-Robin');
$subtotal = $subtotal * 40 / 5;
$total += floor($subtotal);
&sectionResults('Competitions (40 points)', $subtotal, 5, $checkpoint );
$testCount += 5;

&sectionHeader('Additional Unit Tests');
$subtotal = 0;
@SOURCE = ();
@LINK = ();
$subtotal = &runTest('032', 'gmap_remove');
$subtotal += &runTest('033', 'gmap_remove nonexistent key');
$subtotal += &runTest('034', 'gmap_remove after collisions');
$subtotal += &runTest('035', 'gmap_keys with intervening embiggen');
$checkpoint = $total;
$total = 0;
$testCount = 0;
$total += floor($subtotal);
&sectionResults('Additional Unit Tests', $subtotal, 4, $checkpoint );
$testCount += 4;

&sectionHeader('Additional Unit Tests with Valgrind');
$subtotal = 0;
@SOURCE = ();
@LINK = ();
$subtotal = &runTest('036', 'gmap_remove');
$subtotal += &runTest('037', 'gmap_remove nonexistent key');
$subtotal += &runTest('038', 'gmap_remove after collisions');
$subtotal += &runTest('039', 'gmap_keys with intervening embiggen');
$total += floor($subtotal);
&sectionResults('Additional Unit Tests with Valgrind', $subtotal, 4, $checkpoint );
$testCount += 4;

&sectionHeader('Additional Competitions');
$subtotal = 0;
@SOURCE = ();
@LINK = ();
$subtotal = &runTest('040', '4 Battlefields, 3 Entries, Different Scoring');
$subtotal += &runTest('041', '4 Battlefields, 3 Entries, Double-digit Units');
$subtotal += &runTest('042', '5 Battlefields');
$subtotal += &runTest('043', 'Valgrind');
$total += floor($subtotal);
&sectionResults('Additional Competitions', $subtotal, 4, $checkpoint );
$testCount += 4;

&sectionHeader('Invalid input');
$subtotal = 0;
@SOURCE = ();
@LINK = ();
$subtotal = &runTest('044', 'Long id in entries');
$subtotal += &runTest('045', 'Non-numeric unit count in entries');
$subtotal += &runTest('046', 'Inconsistent total units');
$subtotal += &runTest('047', 'Wrong number of battlefields');
$subtotal += &runTest('048', 'Matchup with invalid id');
$subtotal += &runTest('049', 'Missing entry id in matchup');
$total += floor($subtotal);
&sectionResults('Invalid input', $subtotal, 6, $checkpoint );
$testCount += 6;

&sectionHeader('Invalid input with Valgrind');
$subtotal = 0;
@SOURCE = ();
@LINK = ();
$subtotal = &runTest('050', 'Long id in entries');
$subtotal += &runTest('051', 'Non-numeric unit count in entries');
$subtotal += &runTest('052', 'Inconsistent total units');
$subtotal += &runTest('053', 'Wrong number of battlefields');
$subtotal += &runTest('054', 'Matchup with invalid id');
$subtotal += &runTest('055', 'Missing entry id in matchup');
$total += floor($subtotal);
&sectionResults('Invalid input with Valgrind', $subtotal, 6, $checkpoint );
$testCount += 6;

