Test program to check various functionality in FixedLengthList (see http://mbed.org/users/johnb/code/FixedLengthList/ )

Dependencies:   FixedLengthList mbed

Test code for FixedLengthList class

Files at this revision

API Documentation at this revision

Comitter:
johnb
Date:
Wed Jan 29 23:01:16 2014 +0000
Parent:
2:e00ea5f2e80c
Commit message:
Add tests for remove() method

Changed in this revision

FixedLengthList.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/FixedLengthList.lib	Sun Jan 19 13:28:52 2014 +0000
+++ b/FixedLengthList.lib	Wed Jan 29 23:01:16 2014 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/johnb/code/FixedLengthList/#d98987d1d67c
+http://mbed.org/users/johnb/code/FixedLengthList/#16c77b601175
--- a/main.cpp	Sun Jan 19 13:28:52 2014 +0000
+++ b/main.cpp	Wed Jan 29 23:01:16 2014 +0000
@@ -4,7 +4,7 @@
 
    @author John Bailey 
 
-   @copyright Copyright 2013 John Bailey
+   @copyright Copyright 2014 John Bailey
 
    @section LICENSE
    
@@ -143,6 +143,12 @@
     CHECK( list2.queue( 254 ) == false,   "queue() on a full list" );
     
     check_iterators();
+    
+    CHECK( list2.remove( 255 ) == false,  "remove() a non-existant item" );
+    CHECK( list2.available() == 0, "available() having tried to remove non-existent item from full list" ); 
+    CHECK( list2.remove( 243 ) == true,   "remove() a valid item" );
+    CHECK( list2.available() == 1, "available() having removed item from full list" ); 
+    CHECK( list2.inList( 243 ) == false,  "inList() for item which was just remove()d" ); 
 
     PRINTF("FixedLengthList test - Done\n");
 
@@ -166,4 +172,4 @@
     CHECK( it      != ilist.begin(),  "iterators: operator!=" );
     CHECK( it      == ilist.end(),    "iterators: operator==" );
 
-}
\ No newline at end of file
+}