&sectionHeader('Distance (20 points)');
$subtotal = 0;
@SOURCE = ();
@LINK = ();
$subtotal = &runTest('001', 'Querying the ends of a linked list');
$subtotal += &runTest('002', 'Querying the ends of a graph consisting of two unconnected components');
$subtotal += &runTest('003', 'One query on a small graph');
$subtotal += &runTest('004', 'Multiple queries on a small graph');
$subtotal += &runTest('005', 'Query all edges');
$subtotal = $subtotal * 20 / 5;
$total += floor($subtotal);
&sectionResults('Distance (20 points)', $subtotal, 5, $checkpoint );
$testCount += 5;

&sectionHeader('Mutual (20 points)');
$subtotal = 0;
@SOURCE = ();
@LINK = ();
$subtotal = &runTest('006', 'Querying the ends of a linked list');
$subtotal += &runTest('007', 'Querying the ends of a graph consisting of two unconnected components');
$subtotal += &runTest('008', 'One query on a small graph');
$subtotal += &runTest('009', 'Multiple queries on a small graph');
$subtotal += &runTest('010', 'Query all edges');
$subtotal = $subtotal * 20 / 5;
$total += floor($subtotal);
&sectionResults('Mutual (20 points)', $subtotal, 5, $checkpoint );
$testCount += 5;

&sectionHeader('Both (5 points)');
$subtotal = 0;
@SOURCE = ();
@LINK = ();
$subtotal = &runTest('011', 'Query all edges');
$subtotal = $subtotal * 5 / 1;
$total += floor($subtotal);
&sectionResults('Both (5 points)', $subtotal, 1, $checkpoint );
$testCount += 1;

&sectionHeader('Valgrind (10 points)');
$subtotal = 0;
@SOURCE = ();
@LINK = ();
$subtotal = &runTest('012', 'Multiple queries on a small graph, distance');
$subtotal += &runTest('013', 'Query all edges, distance');
$subtotal += &runTest('014', 'Multiple queries on a small graph, mutual');
$subtotal += &runTest('015', 'Query all edges, mutual');
$subtotal = $subtotal * 10 / 4;
$total += floor($subtotal);
&sectionResults('Valgrind (10 points)', $subtotal, 4, $checkpoint );
$testCount += 4;

&sectionHeader('Graph Unit Tests (14 points, worth no points if low score in prior sections)');
$subtotal = 0;
@SOURCE = ();
@LINK = ();
$subtotal = &runTest('016', 'add_edge');
$subtotal += &runTest('017', 'has_vertex');
$subtotal += &runTest('018', 'has_edge');
$subtotal += &runTest('019', 'has_edge, vertices reversed in check');
$subtotal += &runTest('020', 'has_vertices, 1000 vertices');
$subtotal += &runTest('021', 'bfs_distance, 20 vertices');
$subtotal += &runTest('022', 'common neighbors, 20 vertices');
$subtotal = ($total < 20 ? 0 : $subtotal);
$subtotal = $subtotal * 14 / 7;
$total += floor($subtotal);
&sectionResults('Graph Unit Tests (14 points, worth no points if low score in prior sections)', $subtotal, 7, $checkpoint );
$testCount += 7;

&sectionHeader('Gmap Unit Tests with Valgrind (14 points, worth no points if low score in prior sections)');
$subtotal = 0;
@SOURCE = ();
@LINK = ();
$subtotal = &runTest('023', 'add_edge');
$subtotal += &runTest('024', 'has_vertex');
$subtotal += &runTest('025', 'has_edge');
$subtotal += &runTest('026', 'has_edge, vertices reversed in check');
$subtotal += &runTest('027', 'has_vertices, 1000 vertices');
$subtotal += &runTest('028', 'bfs_distance, 20 vertices');
$subtotal += &runTest('029', 'common neighbors, 20 vertices');
$subtotal = ($total < 20 ? 0 : $subtotal);
$subtotal = $subtotal * 14 / 7;
$total += floor($subtotal);
&sectionResults('Gmap Unit Tests with Valgrind (14 points, worth no points if low score in prior sections)', $subtotal, 7, $checkpoint );
$testCount += 7;

&sectionHeader('Size tests (10 points)');
$subtotal = 0;
@SOURCE = ();
@LINK = ();
$subtotal = &runTest('030', 'Medium graph, small number of queries, mutual');
$subtotal += &runTest('031', 'Large graph, small number of queries, mutual');
$subtotal += &runTest('032', 'Large graph, medium number of queries, mutual');
$subtotal += &runTest('033', 'Large graph, large number of queries, mutual');
$subtotal += &runTest('034', 'Medium graph, small number of queries, distance');
$subtotal += &runTest('035', 'Large graph, small number of queries, distance');
$subtotal += &runTest('036', 'Large graph, medium number of queries, distance');
$subtotal += &runTest('037', 'Large graph, large number of queries, distance');
$subtotal = $subtotal * 10 / 8;
$total += floor($subtotal);
&sectionResults('Size tests (10 points)', $subtotal, 8, $checkpoint );
$testCount += 8;

&sectionHeader('Timing test (7 points)');
$subtotal = 0;
@SOURCE = ();
@LINK = ();
$subtotal = &runTest('038', 'bfs_distance');
$subtotal = $subtotal * 7 / 1;
$total += floor($subtotal);
&sectionResults('Timing test (7 points)', $subtotal, 1, $checkpoint );
$testCount += 1;

&sectionHeader('Invalid input');
$subtotal = 0;
@SOURCE = ();
@LINK = ();
$subtotal = &runTest('039', 'Graph file not found');
$subtotal += &runTest('040', 'Whitespace in names');
$subtotal += &runTest('041', 'Name not present in graph');
$subtotal += &runTest('042', 'Name in graph exceeds 20 characters');
$subtotal += &runTest('043', 'Graph contains vertex with edge with self');
$subtotal += &runTest('044', 'Commas in graph edge name');
$subtotal += &runTest('045', 'Missing mode');
$checkpoint = $total;
$total = 0;
$testCount = 0;
$total += floor($subtotal);
&sectionResults('Invalid input', $subtotal, 7, $checkpoint );
$testCount += 7;

&sectionHeader('Edge cases');
$subtotal = 0;
@SOURCE = ();
@LINK = ();
$subtotal = &runTest('046', 'No edges in graph, no queries');
$subtotal += &runTest('047', 'Small graph, no queries');
$subtotal += &runTest('048', 'Mutual friends with self');
$total += floor($subtotal);
&sectionResults('Edge cases', $subtotal, 3, $checkpoint );
$testCount += 3;

