void SwapTwoLists::run() { SList newList; SList otherList; std::string str1 = "foo"; std::string str2 = "bar"; std::string str3 = "baz"; std::string str4 = "far"; std::string str5 = "faz"; newList.push_front(str1); newList.push_front(str2); newList.push_front(str3); otherList.push_front(str4); otherList.push_front(str5); newList.swap(otherList); checkEquals(newList.front(), str5); newList.pop_front(); checkEquals(newList.front(), str4); checkEquals(otherList.front(), str3); otherList.pop_front(); checkEquals(otherList.front(), str2); otherList.pop_front(); checkEquals(otherList.front(), str1); }
void test_pop_front(Test* test) { std::string s("hello"); SList* list =new SList("hello","world"); std::string act = list->pop_front(); test->equals(act,s); delete list; }