Skip to content
Snippets Groups Projects
Commit f1629fd9 authored by Federico's avatar Federico
Browse files

Testing IntrusiveList::removeFast

parent aa468561
Branches
No related tags found
2 merge requests!40Update to Miosix 2.7,!17Draft: Improved miosix build system and fixed cmake scripts
......@@ -375,6 +375,36 @@ int main()
emptyCheck(list);
emptyCheck(c);
//
// Testing removeFast
//
assert(list.removeFast(&a)==false); //Not present, list empty
emptyCheck(list);
emptyCheck(a);
list.push_front(&a);
assert(list.removeFast(&b)==false); //Not present, list not empty
oneItemCheck(list,a);
emptyCheck(b);
assert(list.removeFast(&a)==true); //Present, only element
emptyCheck(list);
emptyCheck(a);
list.push_front(&c);
list.push_front(&b);
list.push_front(&a);
assert(list.removeFast(&a)==true); //Present, at list head
twoItemCheck(list,b,c);
emptyCheck(a);
list.push_front(&a);
assert(list.removeFast(&b)==true); //Present, at in the middle
twoItemCheck(list,a,c);
emptyCheck(b);
assert(list.removeFast(&c)==true); //Present, at list tail
oneItemCheck(list,a);
emptyCheck(c);
list.pop_front(); //Just to end with empty list
emptyCheck(list);
emptyCheck(a);
cout<<"Test passed"<<endl;
return 0;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment