1 /*
 2  * =====================================================================================
 3  *
 4  *       Filename:  test_del.cpp
 5  *
 6  *    Description:  Testing Double Deletes
 7  *
 8  *        Version:  1.0
 9  *        Created:  04/02/2011 05:12:24 PM
10  *       Revision:  none
11  *       Compiler:  gcc
12  *
13  *         Author:  YOUR NAME Ruben Safir,
14  *        Company:  NYLXS
15  *
16  * =====================================================================================
17  */
18
19
20
21 #ifndef  LINKLIST
22 #define LINKLIST
23 #include        "linklist.h"
24 #include       "stats.h"
25 #endif     /* -----  not LINKLIST  ----- */
26
27 #include        <iostream>
28 #include        <fstream>
29 #include        <climits>
30 #include        <stdlib.h>
31 #include        <iomanip>
32
33 chainlist::List<int>* creating_int_list();
34 void find_all_examples(chainlist::List<int>*&, int);
35
36
37
38 template <typename T>
39 void test_me(stats::Distribution<T> hello){
40    std::cout  << "I recied an int and converted it to an object " << hello << std::endl;
41 }
42
43
44
45 int main ( int argc, char *argv[] ){
46    int a = 7;
47    test_me<int>(a);
48
49    return EXIT_SUCCESS;
50 }                               /* ----------  end of function main  ---------- */
51
52
53 chainlist::List<int> * creating_int_list(){
54    // chainlist::List<int>  set = new chainlist::List<int>;
55    chainlist::List<int> * set = new chainlist::List<int>;
56    int ran;
57    for(int i = 0; i < 100; ++i){
58       ran=rand();
59       set->insert(ran % 100);
60    }
61    set->display();
62    return set;
63 }
64
65 void find_all_examples ( chainlist::List<int>* & glob, int search_value )
66 {
67    std::cout << "Searching for " <<  search_value << " in list \n" ;
68    glob->display();
69    glob->find_value(search_value);
70    chainlist::Node<int> * found = glob->cursor();
71    if(found){
72       std::cout << "Found first value ==> '" << *found->value() << "' at node =='" << glob->cursor() << std::endl;
73       found = glob->find_next_value(search_value, found);
74       while( found ){
75          std::cout << "Found next value ==> '" << *(found->value()) << "' at node =='" << glob->cursor() << std::endl;
76          found = glob->find_next_value(search_value, found);
77       }
78    }
79
80
81    return ;
82 }              
83