Recursion Lab Test File
  • This test file is to help you make sure you are on the right track with the functions for Lab 4
  • Note that this test file is not exhaustive or thorough in its testing.
  • Please make sure that you more thoroughly test each of your functions in your own test file.
  • Please do not submit this file to me as part of this assignment.
    • I wrote it, so I already have a copy!
  • This file is not a substitute for your own tests or test file.

/**
 * Jennifer Parrish
 * CIS 22C
 * RecursionLabTest.cpp
 */

#include <iostream>
#include "List.h"
using namespace std;

int main() {

    List<int> L;

    for(int i = 1; i < 11; i++) {
        L.insertEnd(i);
    }

    cout << "Should print 10 9 8 7 6 5 4 3 2 1: \n";
    L.printReverse();
    cout << endl;
    if (L.isSorted()) {
        cout << "List is sorted!" << endl;
    } else {
        cout << "The list is not sorted" << endl;
    }


    L.advanceToIndex(1);
    cout << "Should print 1 1: " << L.getIndex() << " " << L.getIterator() << endl;
    L.advanceToIndex(5);
    cout << "Should print 5 5: " << L.getIndex() << " " << L.getIterator() << endl;
    cout << endl << endl;
    cout << "Should print -1: " << L.linearSearch(11) << endl;
    cout << "Should print -1: " << L.binarySearch(11) << endl;
    cout << endl << endl;
    cout << "Should print 1: " << L.linearSearch(1) << endl;
    cout << "Should print 1: " << L.binarySearch(1) << endl;

 }