head	1.3;
access;
symbols
	r2_1:1.3
	r2_0:1.3
	r1_1_beta:1.3
	r0_11:1.3;
locks; strict;
comment	@//@;


1.3
date	94.04.27.18.26.09;	author rjj;	state Exp;
branches;
next	1.2;

1.2
date	93.11.14.19.50.57;	author rjj;	state Exp;
branches;
next	1.1;

1.1
date	93.11.11.01.18.02;	author rjj;	state Exp;
branches;
next	;


desc
@Added new tests and debugged lists some more.
@


1.3
log
@Changed T operator[](int) const  to operator().
@
text
@// -*- C++ -*-
//      Copyright 1993, Center for Computer Vision and Visualization,
//      University of Florida.  All rights reserved.

#include "ia.h"
#include "List.h"

static char tests_list_c_rcsid[] = "$Id: test-list.c,v 1.2 1993/11/14 19:50:57 rjj Exp rjj $";

// $Log: test-list.c,v $
//Revision 1.2  1993/11/14  19:50:57  rjj
//Changed 'emptyp()' to 'empty()'.
//
//Revision 1.1  1993/11/11  01:18:02  rjj
//Initial revision
//

#define lilen(k) \
    cout << "\nli" << k << ".length() = " << li##k.length()

#define hd(dstr,d) cout << "\n" << dstr << ".head() = " << d.head()

    int lint;
#define prtd(dstr, d) \
    cout << "\n" << dstr << "\t<"; \
    for (lint=0; lint < d.length();  lint++ ) \
	{ cout << d[lint] << " "; }; \
    cout << ">";
					

main() {
    IA::abort_on_throw = 0;

    cout << "Allocating li, li0 .. li4\n";
    
    IA_List<int> li,
	li0(0),
	li1(0,1),
	li2(0,1,2),
	li3(0,1,2,3),
	li4(0,1,2,3,4);

    cout << "\nAllocating liter4(li)\n";
    IA_ListIter<int>
	liter(li),
	liter0(li0),
	liter1(li1),
	liter2(li2),
	liter3(li3),
	liter4(li4);

    int lvec[10];
    for (int i=0; i<10; i++) {
	lvec[i] = i*i + i;
    }
    IA_List<int> longL(lvec, 10);
    IA_ListIter<int> ldIter(longL);



#define ITERATORS
#ifdef  ITERATORS


//    lilen();
/*    lilen(0);
    lilen(1);
    lilen(2);
    lilen(3);
    lilen(4);
    */
    int value;
    cout << "\nEntering while loop for li";
    while ( liter(value) ) {
	cout << "\n\tliter returned: " << value;
    }
    cout << "\nEntering while loop for li0";
    while ( liter0(value) ) {
	cout << "\n\tliter0 returned: " << value;
    }
    cout << "\nEntering while loop for li1";
    while ( liter1(value) ) {
	cout << "\n\tliter1 returned: " << value;
    }
    cout << "\nEntering while loop for li2";
    while ( liter2(value) ) {
	cout << "\n\tliter2 returned: " << value;
    }
    cout << "\nEntering while loop for li3";
    while ( liter3(value) ) {
	cout << "\n\tliter3 returned: " << value;
    }
    cout << "\nEntering while loop for li4";
    while ( liter4(value) ) {
	cout << "\n\tliter4 returned: " << value;
    }
#undef ITERATORS
#endif


#define VARITERATORS
#ifdef  VARITERATORS
    cout << "\n\nPlaying with long vectors\n";
    cout << "\nEntering while loop for ldIter";
    while ( ldIter(value) ) {
	cout << "\n\tldIter returned: " << value;
    }
#undef VARITERATORSA
#endif


#define OPERATORS
#ifdef  OPERATORS

    hd("li0", li0);
    hd("li1", li1);

    prtd("li3",li3);
    prtd("longL",longL);

    IA_List<int> tailL=longL;
    while( !tailL.empty() ) {
	prtd("tailL",tailL);
	tailL.tail(tailL);
    }
    prtd("tailL",tailL);


    IA_List<int> plus2thru7, plus3thru2, outOfBounds;

    longL.sub(2,7,plus2thru7);
    prtd("plus2thru7",plus2thru7);

    longL.sub(3,2,plus3thru2);
    prtd("plus3thru2",plus3thru2);

    longL.sub(13,18,outOfBounds);
    prtd("outOfBounds",outOfBounds);

#undef  OPERATORS
#endif

#define FUNCTIONS
#ifdef  FUNCTIONS
    cout << "\n\n";
    concat(plus2thru7,plus3thru2,outOfBounds);
    prtd("concat(plus2thru7,plus3thru2,outOfBounds)",outOfBounds);
#undef  FUNCTIONS
#endif


    cout << "\n";
}

@


1.2
log
@Changed 'emptyp()' to 'empty()'.
@
text
@d8 1
a8 1
static char tests_list_c_rcsid[] = "$Id: test-list.c,v 1.1 1993/11/11 01:18:02 rjj Exp rjj $";
d11 3
d32 1
a32 1
    IA::exit_on_throw = 0;
@


1.1
log
@Initial revision
@
text
@d8 1
a8 1
static char tests_list_c_rcsid[] = "$Id$";
d10 4
a13 1
// $Log$
d119 1
a119 1
    while( !tailL.emptyp() ) {
@
