aboutsummaryrefslogtreecommitdiff
path: root/src/tests/list.cpp
diff options
context:
space:
mode:
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");