summaryrefslogtreecommitdiff
path: root/src/tests/list.cpp
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2007-07-11 21:48:41 +0000
committerMike Buland <eichlan@xagasoft.com>2007-07-11 21:48:41 +0000
commitd05de564091c24677a94e16963dad20be4b00ca0 (patch)
tree102e2a27c55011979292ff3cc3ff3f3049da1de3 /src/tests/list.cpp
parent264ce2905eee70abbb472e9d93d1dd377692dfdc (diff)
downloadlibbu++-d05de564091c24677a94e16963dad20be4b00ca0.tar.gz
libbu++-d05de564091c24677a94e16963dad20be4b00ca0.tar.bz2
libbu++-d05de564091c24677a94e16963dad20be4b00ca0.tar.xz
libbu++-d05de564091c24677a94e16963dad20be4b00ca0.zip
I guess I fixed some list stuff...
Diffstat (limited to 'src/tests/list.cpp')
-rw-r--r--src/tests/list.cpp19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/tests/list.cpp b/src/tests/list.cpp
index 12807a5..edbe288 100644
--- a/src/tests/list.cpp
+++ b/src/tests/list.cpp
@@ -18,6 +18,21 @@ int main()
18 l.prepend( -j ); 18 l.prepend( -j );
19 } 19 }
20 20
21 {
22 Bu::List<int>::iterator i = l.begin();
23 Bu::List<int>::iterator j = i;
24 int a, b;
25 a = *j;
26 printf("end: %s\n", (j != l.end())?"no":"yes");
27 j--;
28 printf("end: %s\n", (j != l.end())?"no":"yes");
29 j++;
30 printf("end: %s\n", (j != l.end())?"no":"yes");
31 i = j;
32 b = *i;
33 printf("%d -> %d\n", a, b );
34 }
35
21 for( Bu::List<int>::iterator i = l.begin(); i != l.end(); i++ ) 36 for( Bu::List<int>::iterator i = l.begin(); i != l.end(); i++ )
22 { 37 {
23 printf("%d ", *i ); 38 printf("%d ", *i );
@@ -25,9 +40,11 @@ int main()
25 printf("\n"); 40 printf("\n");
26 for( Bu::List<int>::iterator i = l.begin(); i != l.end(); i++ ) 41 for( Bu::List<int>::iterator i = l.begin(); i != l.end(); i++ )
27 { 42 {
43 Bu::List<int>::iterator j = i; j--;
28 l.erase( i ); 44 l.erase( i );
45 i = j;
29 if( i != l.end() ) 46 if( i != l.end() )
30 printf("%d ", *i ); 47 printf("!%d ", *i );
31 } 48 }
32 49
33 printf("\n\n"); 50 printf("\n\n");