void VectorFileNamesTests::filenamesNotReplacedTest() { QStringList notImages; notImages << "/home/file1.tar.gz" << "/home/file2.tar.gz"; QStringList vectorsExpected; QStringList vectorsActual = Helpers::convertToVectorFilenames(notImages); CompareLists(vectorsActual, vectorsExpected); }
/* Compare two linked lists A and B Return 1 if they are identical and 0 if they are not. Node is defined as struct Node { int data; struct Node *next; } */ int CompareLists(Node *headA, Node* headB) { if(headA == NULL and headB == NULL) return 1; else if(headA == NULL) return 0; else if(headB == NULL) return 0; if(headA->data == headB->data) return CompareLists(headA->next, headB->next); return 0; }
void VectorFileNamesTests::simpleFilenamesTiffTest() { QStringList images; images << "/home/file1.tiff" << "/home/file2.tiff"; QStringList vectorsExpected; vectorsExpected << "/home/file1.eps" << "/home/file1.ai" << "/home/file2.eps" << "/home/file2.ai"; QStringList vectorsActual = Helpers::convertToVectorFilenames(images); CompareLists(vectorsActual, vectorsExpected); }
int CompareLists(Node *headA, Node* headB) { if (headA == NULL && headB == NULL) return 1; else if ((headA == NULL && headB != NULL) || (headA != NULL && headB == NULL)) return 0; else if (headA->data == headB->data) return CompareLists(headA->next, headB->next); else return 0; }
bool LinkedListExercises::CompareLists(const LinkedList<int>& rBaseList, const LinkedList<int>& rTargetList) { return CompareLists(rBaseList.mHead, rTargetList.mHead); }