Please send questions to st10@humboldt.edu .
//---------------------------------------------------------------
// File: test_binSearch.cpp
// Name: Sharon Tuttle
// last modified: 2-3-05
//
// Purpose: tester for function binSearch
//--------------------------------------------------------------

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

int main()
{
    // set-up declarations
    int arr1[] = {1, 3, 8, 27, 56, 77, 78, 79, 100};
    int arr2[] = {};

    // tests and associated cout's

    cout << endl;
    cout << "Testing function binSearch..." << endl;
    cout << endl;

    cout << "1's mean test passed, 0's mean test failed:" << endl;
    cout << "-------------------------------------------" << endl;

    cout << (binSearch(arr1, 0, 8, 50) == -1) << endl;
    cout << (binSearch(arr1, 0, 8, 150) == -1) << endl;
    cout << (binSearch(arr1, 0, 8, 0) == -1) << endl;
    cout << (binSearch(arr1, 0, 8, 1) == 0) << endl;
    cout << (binSearch(arr1, 0, 8, 100) == 8) << endl;
    cout << (binSearch(arr1, 0, 8, 56) == 4) << endl;
    cout << (binSearch(arr2, 0, 0, 13) == -1) << endl;

    cout << endl;

    // let's try a BIG array... [for ADDITIONAL, "bonus" testing!]

    int big[10000];

    for (int i=0; i < 10000; i++)
    {
        big[i] = i*2;
    }

    int target;

    cout << "enter a value to search for: " ;
    cin >> target;

    cout << "found it at: ";
    int where;
    where = binSearch(big, 0, 9999, target);
    cout << where;
    cout << endl;   

    return EXIT_SUCCESS;
}