aboutsummaryrefslogtreecommitdiff
path: root/src/tests/list.cpp
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2007-07-03 00:28:59 +0000
committerMike Buland <eichlan@xagasoft.com>2007-07-03 00:28:59 +0000
commitac517a2b7625e0aa0862679e961c6349f859ea3b (patch)
treee3e27a6b9bd5e2be6150088495c91fc91786ad9d /src/tests/list.cpp
parentf8d4301e9fa4f3709258505941e37fab2eadadc6 (diff)
parentbd865cee5f89116c1f054cd0e5c275e97c2d0a9b (diff)
downloadlibbu++-ac517a2b7625e0aa0862679e961c6349f859ea3b.tar.gz
libbu++-ac517a2b7625e0aa0862679e961c6349f859ea3b.tar.bz2
libbu++-ac517a2b7625e0aa0862679e961c6349f859ea3b.tar.xz
libbu++-ac517a2b7625e0aa0862679e961c6349f859ea3b.zip
The reorg is being put in trunk, I think it's ready. Now we just get to find
out how many applications won't work anymore :)
Diffstat (limited to '')
-rw-r--r--src/tests/list.cpp53
1 files changed, 53 insertions, 0 deletions
diff --git a/src/tests/list.cpp b/src/tests/list.cpp
new file mode 100644
index 0000000..12807a5
--- /dev/null
+++ b/src/tests/list.cpp
@@ -0,0 +1,53 @@
1#include "bu/list.h"
2#include <list>
3
4typedef struct Bob
5{
6 int nID;
7} Bob;
8
9int main()
10{
11 Bu::List<int> l;
12
13 l.append( 0 );
14
15 for( int j = 3; j <= 21; j += 3 )
16 {
17 l.append( j );
18 l.prepend( -j );
19 }
20
21 for( Bu::List<int>::iterator i = l.begin(); i != l.end(); i++ )
22 {
23 printf("%d ", *i );
24 }
25 printf("\n");
26 for( Bu::List<int>::iterator i = l.begin(); i != l.end(); i++ )
27 {
28 l.erase( i );
29 if( i != l.end() )
30 printf("%d ", *i );
31 }
32
33 printf("\n\n");
34
35 Bu::List<Bob> lb;
36 for( int j = 0; j < 10; j++ )
37 {
38 Bob b;
39 b.nID = j;
40 lb.append( b );
41 }
42
43 const Bu::List<Bob> rb = lb;
44
45 for( Bu::List<Bob>::const_iterator i = rb.begin(); i != rb.end(); i++ )
46 {
47 //i->nID += 2;
48 //(*i).nID = 4;
49 printf("%d ", i->nID );
50 }
51 printf("\n\n");
52}
53