&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('Total score Competitions, unsorted output (40 points)');
$subtotal = 0;
@SOURCE = ();
@LINK = ();
$subtotal = &runTest('027', 'Small example, total score');
$subtotal += &runTest('028', 'Larger example, score');
$subtotal += &runTest('029', 'Valgrind');
$subtotal = $subtotal * 40 / 3;
$total += floor($subtotal);
&sectionResults('Total score Competitions, unsorted output (40 points)', $subtotal, 3, $checkpoint );
$testCount += 3;

&sectionHeader('Additional Unit Tests');
$subtotal = 0;
@SOURCE = ();
@LINK = ();
$subtotal = &runTest('030', 'gmap_remove');
$subtotal += &runTest('031', 'gmap_remove nonexistent key');
$subtotal += &runTest('032', 'gmap_remove after collisions');
$subtotal += &runTest('033', '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('034', 'gmap_remove');
$subtotal += &runTest('035', 'gmap_remove nonexistent key');
$subtotal += &runTest('036', 'gmap_remove after collisions');
$subtotal += &runTest('037', 'gmap_keys with intervening embiggen');
$total += floor($subtotal);
&sectionResults('Additional Unit Tests with Valgrind', $subtotal, 4, $checkpoint );
$testCount += 4;

&sectionHeader('Competitions -- order of output counts');
$subtotal = 0;
@SOURCE = ();
@LINK = ();
$subtotal = &runTest('038', 'Small example, total score');
$subtotal += &runTest('039', 'Larger example, score');
$subtotal += &runTest('040', 'Small example, wins');
$subtotal += &runTest('041', 'Larger example, wins');
$subtotal += &runTest('042', 'Valgrind');
$total += floor($subtotal);
&sectionResults('Competitions -- order of output counts', $subtotal, 5, $checkpoint );
$testCount += 5;

&sectionHeader('Invalid input');
$subtotal = 0;
@SOURCE = ();
@LINK = ();
$subtotal = &runTest('043', 'File not found');
$subtotal += &runTest('044', 'Not win or score');
$subtotal += &runTest('045', 'Long id in entries');
$subtotal += &runTest('046', 'Non-numeric unit count in entries');
$subtotal += &runTest('047', 'Inconsistent total units');
$subtotal += &runTest('048', 'Wrong number of battlefields');
$subtotal += &runTest('049', 'Blank line');
$subtotal += &runTest('050', 'Matchup with invalid id');
$subtotal += &runTest('051', 'Missing entry id in matchup');
$total += floor($subtotal);
&sectionResults('Invalid input', $subtotal, 9, $checkpoint );
$testCount += 9;

&sectionHeader('Invalid input with Valgrind');
$subtotal = 0;
@SOURCE = ();
@LINK = ();
$subtotal = &runTest('052', 'File not found');
$subtotal += &runTest('053', 'Not win or score');
$subtotal += &runTest('054', 'Long id in entries');
$subtotal += &runTest('055', 'Inconsistent total units');
$subtotal += &runTest('056', 'Wrong number of battlefields');
$subtotal += &runTest('057', 'Blank line');
$subtotal += &runTest('058', 'Matchup with invalid id');
$subtotal += &runTest('059', 'Missing entry id in matchup');
$total += floor($subtotal);
&sectionResults('Invalid input with Valgrind', $subtotal, 8, $checkpoint );
$testCount += 8;

