void Git::userInfo(SList info) { /* git looks for commit user information in following order: - GIT_AUTHOR_NAME and GIT_AUTHOR_EMAIL environment variables - repository config file - global config file - your name, hostname and domain */ const QString env(QProcess::systemEnvironment().join(",")); QString user(env.section("GIT_AUTHOR_NAME", 1).section(",", 0, 0).section("=", 1).trimmed()); QString email(env.section("GIT_AUTHOR_EMAIL", 1).section(",", 0, 0).section("=", 1).trimmed()); info.clear(); info << "Environment" << user << email; errorReportingEnabled = false; // 'git config' could fail, see docs run("git config user.name", &user); run("git config user.email", &email); info << "Local config" << user << email; run("git config --global user.name", &user); run("git config --global user.email", &email); info << "Global config" << user << email; errorReportingEnabled = true; }
bool HistoryView::getLaneParentsChilds(SCRef sha, int x, SList p, SList c) { ListViewDelegate* lvd = static_cast<ListViewDelegate*>(itemDelegate()); uint lane = x / lvd->laneWidth(); int t = getLaneType(sha, lane); if (t == EMPTY || t == -1) return false; // first find the parents p.clear(); QString root; if (!isFreeLane(t)) { p = git->revLookup(sha, fh)->parents(); // pointer cannot be NULL root = sha; } else { SCRef par(git->getLaneParent(sha, lane)); if (par.isEmpty()) { dbs("ASSERT getLaneParentsChilds: parent not found"); return false; } p.append(par); root = p.first(); } // then find children c = git->getChilds(root); return true; }
bool CommitImpl::getFiles(SList selFiles) { // check for files to commit selFiles.clear(); QTreeWidgetItemIterator it(treeWidgetFiles); while (*it) { if ((*it)->checkState(0) == Qt::Checked) selFiles.append((*it)->text(0)); ++it; } return !selFiles.isEmpty(); }
void VarEdgeInserterDynCore::insert(edge eOrig, SList<adjEntry>& eip) { eip.clear(); node s = m_pr.copy(eOrig->source()); node t = m_pr.copy(eOrig->target()); // find path from s to t in BC-tree // call of blockInsert() is done when we have found the path // if no path is found, s and t are in different connected components // and thus an empty edge insertion path is correct! DynamicSPQRForest& dSPQRF = m_pBC->dynamicSPQRForest(); SList<node>& path = dSPQRF.findPath(s, t); if (!path.empty()) { SListIterator<node> it = path.begin(); node repS = dSPQRF.repVertex(s, *it); for (SListIterator<node> jt = it; it.valid(); ++it) { node repT = (++jt).valid() ? dSPQRF.cutVertex(*jt, *it) : dSPQRF.repVertex(t, *it); // less than 3 nodes requires no crossings (cannot build SPQR-tree // for a graph with less than 3 nodes!) if (dSPQRF.numberOfNodes(*it) > 3) { List<adjEntry> L; blockInsert(repS, repT, L); // call biconnected case // transform crossed edges to edges in G for (adjEntry kt : L) { edge e = kt->theEdge(); eip.pushBack(e->adjSource() == kt ? dSPQRF.original(e)->adjSource() : dSPQRF.original(e)->adjTarget()); } } if (jt.valid()) repS = dSPQRF.cutVertex(*it, *jt); } } delete &path; }
void unittest () { cout << "\nSTARTING UNIT TEST\n\n"; SList list; try { btassert<bool>(list.getSize() == 0); cout << "Passed TEST 1: default constructor (size) \n"; } catch (bool b) { cout << "# FAILED TEST 1: default constructor (size) #\n"; } try { btassert<bool>(list.toString() == ""); cout << "Passed TEST 2: toString \n"; } catch (bool b) { cout << "# FAILED TEST 2: toString #\n"; } list.removeHead(); try { btassert<bool>(list.getSize() == 0); cout << "Passed TEST 3: removeHead \n"; } catch (bool b) { cout << "# FAILED TEST 3: removeHead #\n"; } list.removeTail(); try { btassert<bool>(list.getSize() == 0); cout << "Passed TEST 4: removeTail \n"; } catch (bool b) { cout << "# FAILED TEST 4: removeTail #\n"; } list.insertHead(1); try { btassert<bool>(list.getSize() == 1); cout << "Passed TEST 5: insertHead \n"; } catch (bool b) { cout << "# FAILED TEST 5: insertHead #\n"; } try { btassert<bool>(list.toString() == "1"); cout << "Passed TEST 6: toString \n"; } catch (bool b) { cout << "# FAILED TEST 6: toString #\n"; } list.removeHead(); try { btassert<bool>(list.getSize() == 0); cout << "Passed TEST 7: removeHead \n"; } catch (bool b) { cout << "# FAILED TEST 7: removeHead #\n"; } list.insertTail(1); try { btassert<bool>(list.getSize() == 1); cout << "Passed TEST 8: insertTail \n"; } catch (bool b) { cout << "# FAILED TEST 8: insertTail #\n"; } try { btassert<bool>(list.toString() == "1"); cout << "Passed TEST 9: toString \n"; } catch (bool b) { cout << "# FAILED TEST 9: toString #\n"; } list.removeTail(); try { btassert<bool>(list.getSize() == 0); cout << "Passed TEST 10: removeTail \n"; } catch (bool b) { cout << "# FAILED TEST 10: removeTail #\n"; } list.insertHead(10); list.insertTail(20); try { btassert<bool>(list.toString() == "10,20" && list.getSize() == 2); cout << "Passed TEST 11: insertHead,insertTail,toString,getSize \n"; } catch (bool b) { cout << "# FAILED TEST 11: insertHead,insertTail,toString,getSize #\n"; } list.removeHead(); try { btassert<bool>(list.toString() == "20" && list.getSize() == 1); cout << "Passed TEST 12: removeHead,toString,getSize \n"; } catch (bool b) { cout << "# FAILED TEST 12: removeHead,toString,getSize #\n"; } list.insertHead(10); list.removeTail(); try { btassert<bool>(list.toString() == "10" && list.getSize() == 1); cout << "Passed TEST 13: insertHead,removeTail,toString,getSize \n"; } catch (bool b) { cout << "# FAILED TEST 13: insertHead,removeTail,toString,getSize #\n"; } list.clear(); try { btassert<bool>(list.toString() == "" && list.getSize() == 0); cout << "Passed TEST 13: clear,toString,getSize \n"; } catch (bool b) { cout << "# FAILED TEST 13: clear,toString,getSize #\n"; } list.insertHead(10); list.insertHead(5); list.insertTail(20); list.insertTail(25); try { btassert<bool>(list.toString() == "5,10,20,25" && list.getSize() == 4); cout << "Passed TEST 14: insertHeadx2,insertTailx2,toString,getSize \n"; } catch (bool b) { cout << "# FAILED TEST 14: insertHeadx2,insertTailx2,toString,getSize #\n"; } list.removeHead(); list.removeTail(); list.removeHead(); list.removeTail(); list.clear(); try { btassert<bool>(list.toString() == "" && list.getSize() == 0); cout << "Passed TEST 15: removeHeadx2,removeTailx2,toString,getSize \n"; } catch (bool b) { cout << "# FAILED TEST 15: removeHeadx2,removeTailx2,toString,getSize #\n"; } for (unsigned int i=0; i<1000; i++) list.insertHead(i); try { btassert<bool>(list.getSize() == 1000); cout << "Passed TEST 16: insertHead high load \n"; } catch (bool b) { cout << "# FAILED TEST 16: insertHead high load #\n"; } for (unsigned int i=0; i<1000; i++) list.removeHead(); try { btassert<bool>(list.getSize() == 0); cout << "Passed TEST 17: removeHead high load \n"; } catch (bool b) { cout << "# FAILED TEST 17: removeHead high load #\n"; } for (unsigned int i=0; i<1000; i++) list.insertTail(i); try { btassert<bool>(list.getSize() == 1000); cout << "Passed TEST 18: insertTail high load \n"; } catch (bool b) { cout << "# FAILED TEST 18: insertTail high load #\n"; } for (unsigned int i=0; i<1000; i++) list.removeTail(); try { btassert<bool>(list.getSize() == 0); cout << "Passed TEST 19: removeTail high load \n"; } catch (bool b) { cout << "# FAILED TEST 19: removeTail high load #\n"; } for (unsigned int i=0; i<1000; i++) { if (i%2) list.insertHead(i); else list.insertTail(i); } try { btassert<bool>(list.getSize() == 1000); cout << "Passed TEST 20: insertHead/insertTail high load \n"; } catch (bool b) { cout << "# FAILED TEST 20: insertHead/insertTail high load #\n"; } cout << "\nUNIT TEST COMPLETE\n\n"; }
/* * Unit testing functions. Do not alter. */ void unittest () { cout << "\nSTARTING UNIT TEST\n\n"; SList list; try { btassert<bool>(list.getSize() == 0); cout << "Passed TEST 1: default constructor (size) \n"; } catch (bool b) { cout << "# FAILED TEST 1: default constructor (size) #\n"; } try { btassert<bool>(list.toString() == ""); cout << "Passed TEST 2: toString \n"; } catch (bool b) { cout << "# FAILED TEST 2: toString #\n"; } list.removeHead(); try { btassert<bool>(list.getSize() == 0); cout << "Passed TEST 3: removeHead \n"; } catch (bool b) { cout << "# FAILED TEST 3: removeHead #\n"; } list.insertHead(1); try { btassert<bool>(list.getSize() == 1); cout << "Passed TEST 4: insertHead \n"; } catch (bool b) { cout << "# FAILED TEST 4: insertHead #\n"; } try { btassert<bool>(list.toString() == "1"); cout << "Passed TEST 5: toString \n"; } catch (bool b) { cout << "# FAILED TEST 5: toString #\n"; } list.removeHead(); try { btassert<bool>(list.getSize() == 0); cout << "Passed TEST 6: removeHead \n"; } catch (bool b) { cout << "# FAILED TEST 6: removeHead #\n"; } try { btassert<bool>(list.toString() == ""); cout << "Passed TEST 7: toString \n"; } catch (bool b) { cout << "# FAILED TEST 7: toString #\n"; } list.insertHead(10); list.insertHead(20); try { btassert<bool>(list.toString() == "20,10" && list.getSize() == 2); cout << "Passed TEST 8: insertHead,insertHead,toString,getSize \n"; } catch (bool b) { cout << "# FAILED TEST 8: insertHead,insertHead,toString,getSize #\n"; } list.removeHead(); try { btassert<bool>(list.toString() == "10" && list.getSize() == 1); cout << "Passed TEST 9: removeHead,toString,getSize \n"; } catch (bool b) { cout << "# FAILED TEST 9: removeHead,toString,getSize #\n"; } list.insertHead(5); try { btassert<bool>(list.toString() == "5,10" && list.getSize() == 2); cout << "Passed TEST 10: insertHead,toString,getSize \n"; } catch (bool b) { cout << "# FAILED TEST 10: insertHead,toString,getSize #\n"; } list.clear(); try { btassert<bool>(list.toString() == "" && list.getSize() == 0); cout << "Passed TEST 11: clear,toString,getSize \n"; } catch (bool b) { cout << "# FAILED TEST 11: clear,toString,getSize #\n"; } for (unsigned int i=0; i<1000; i++) list.insertHead(i); try { btassert<bool>(list.getSize() == 1000); cout << "Passed TEST 12: insertHead high load \n"; } catch (bool b) { cout << "# FAILED TEST 12: insertHead high load #\n"; } for (unsigned int i=0; i<1000; i++) list.removeHead(); try { btassert<bool>(list.getSize() == 0); cout << "Passed TEST 13: removeHead high load \n"; } catch (bool b) { cout << "# FAILED TEST 13: removeHead high load #\n"; } cout << "\nUNIT TEST COMPLETE\n\n"; }
/* * Unit testing functions. Do not alter. */ void unittest () { cout << "\nSTARTING UNIT TEST\n\n"; SList list; try { btassert<bool>(list.getSize() == 0); cout << "Passed TEST 1: default constructor (size) \n"; } catch (bool b) { cout << "# FAILED TEST 1: default constructor (size) #\n"; } try { btassert<bool>(list.toString() == ""); cout << "Passed TEST 2: toString \n"; } catch (bool b) { cout << "# FAILED TEST 2: toString #\n"; } list.insert(10); try { btassert<bool>(list.getSize() == 1 && list.toString() == "10"); cout << "Passed TEST 3: insert(10)/getSize/toString \n"; } catch (bool b) { cout << "# FAILED TEST 3: insert(10)/getSize/toString #\n"; } list.insert(50); try { btassert<bool>(list.getSize() == 2 && list.toString() == "10,50"); cout << "Passed TEST 4: insert(50)/getSize/toString \n"; } catch (bool b) { cout << "# FAILED TEST 4: insert(50)/getSize/toString #\n"; } list.insert(30); try { btassert<bool>(list.getSize() == 3 && list.toString() == "10,30,50"); cout << "Passed TEST 5: insert(30)/getSize/toString \n"; } catch (bool b) { cout << "# FAILED TEST 5: insert(30)/getSize/toString #\n"; } list.insert(5); try { btassert<bool>(list.getSize() == 4 && list.toString() == "5,10,30,50"); cout << "Passed TEST 6: insert(5)/getSize/toString \n"; } catch (bool b) { cout << "# FAILED TEST 6: insert(5)/getSize/toString #\n"; } list.insert(55); try { btassert<bool>(list.getSize() == 5 && list.toString() == "5,10,30,50,55"); cout << "Passed TEST 7: insert(55)/getSize/toString \n"; } catch (bool b) { cout << "# FAILED TEST 7: insert(55)/getSize/toString #\n"; } list.insert(20); try { btassert<bool>(list.getSize() == 6 && list.toString() == "5,10,20,30,50,55"); cout << "Passed TEST 8: insert(20)/getSize/toString \n"; } catch (bool b) { cout << "# FAILED TEST 8: insert(20)/getSize/toString #\n"; } list.insert(40); try { btassert<bool>(list.getSize() == 7 && list.toString() == "5,10,20,30,40,50,55"); cout << "Passed TEST 9: insert(40)/getSize/toString \n"; } catch (bool b) { cout << "# FAILED TEST 9: insert(40)/getSize/toString #\n"; } list.insert(30); try { btassert<bool>(list.getSize() == 8 && list.toString() == "5,10,20,30,30,40,50,55"); cout << "Passed TEST 10: insert(30)/getSize/toString \n"; } catch (bool b) { cout << "# FAILED TEST 10: insert(30)/getSize/toString #\n"; } list.insert(5); try { btassert<bool>(list.getSize() == 9 && list.toString() == "5,5,10,20,30,30,40,50,55"); cout << "Passed TEST 11: insert(5)/getSize/toString \n"; } catch (bool b) { cout << "# FAILED TEST 11: insert(5)/getSize/toString #\n"; } try { btassert<bool>(list.removeFirst(1) == false); cout << "Passed TEST 12: removeFirst(1) \n"; } catch (bool b) { cout << "# FAILED TEST 12: removeFirst(1) #\n"; } try { btassert<bool>(list.removeFirst(5) == true && list.getSize() == 8 && list.toString() == "5,10,20,30,30,40,50,55"); cout << "Passed TEST 13: removeFirst(5)/getSize/toString \n"; } catch (bool b) { cout << "# FAILED TEST 13: removeFirst(5)/getSize/toString #\n"; } try { btassert<bool>(list.removeFirst(30) == true && list.getSize() == 7 && list.toString() == "5,10,20,30,40,50,55"); cout << "Passed TEST 14: removeFirst(30)/getSize/toString \n"; } catch (bool b) { cout << "# FAILED TEST 14: removeFirst(30)/getSize/toString #\n"; } try { btassert<bool>(list.removeFirst(30) == true && list.getSize() == 6 && list.toString() == "5,10,20,40,50,55"); cout << "Passed TEST 15: removeFirst(30)/getSize/toString \n"; } catch (bool b) { cout << "# FAILED TEST 15: removeFirst(30)/getSize/toString #\n"; } try { btassert<bool>(list.removeFirst(55) == true && list.getSize() == 5 && list.toString() == "5,10,20,40,50"); cout << "Passed TEST 16: removeFirst(55)/getSize/toString \n"; } catch (bool b) { cout << "# FAILED TEST 16: removeFirst(55)/getSize/toString #\n"; } try { btassert<bool>(list.removeFirst(10) == true && list.getSize() == 4 && list.toString() == "5,20,40,50"); cout << "Passed TEST 17: removeFirst(10)/getSize/toString \n"; } catch (bool b) { cout << "# FAILED TEST 17: removeFirst(10)/getSize/toString #\n"; } list.removeHead(); try { btassert<bool>(list.getSize() == 3 && list.toString() == "20,40,50"); cout << "Passed TEST 18: removeHead/getSize/toString \n"; } catch (bool b) { cout << "# FAILED TEST 18: removeHead/getSize/toString #\n"; } list.removeTail(); try { btassert<bool>(list.getSize() == 2 && list.toString() == "20,40"); cout << "Passed TEST 19: removeTail/getSize/toString \n"; } catch (bool b) { cout << "# FAILED TEST 19: removeTail/getSize/toString #\n"; } list.clear(); try { btassert<bool>(list.getSize() == 0 && list.toString() == ""); cout << "Passed TEST 20: clear/getSize/toString \n"; } catch (bool b) { cout << "# FAILED TEST 20: clear/getSize/toString #\n"; } cout << "\nUNIT TEST COMPLETE\n\n"; }
bool Annotate::setAnnotation(SCRef diff, SCRef author, SCList prevAnn, SList newAnn, int ofs) { newAnn.clear(); QStringList::const_iterator cur(prevAnn.constBegin()); QString line; int idx = 0, num, lineNumStart, lineNumEnd; int curLineNum = 1; // warning, starts from 1 instead of 0 bool inHeader = true; while (getNextSection(diff, idx, line, "\n")) { char firstChar = line.at(0).toLatin1(); if (inHeader) { if (firstChar == '@') inHeader = false; else continue; } switch (firstChar) { case '@': // an unified diff fragment header has form '@@ -a,b +c,d @@' // where 'a' is old file line number and 'b' is old file // number of lines of the hunk, 'c' and 'd' are the same // for new file. If the file does not have enough lines // then also the form '@@ -a +c @@' is used. if (ofs == 0) lineNumStart = line.indexOf('-') + 1; else // in this case we are given diff fragments with // faked small files that span the fragment plus // some padding. So we use 'c' instead of 'a' to // find the beginning of our patch in the faked file, // this value will be offsetted by ofs later lineNumStart = line.indexOf('+') + 1; lineNumEnd = line.indexOf(',', lineNumStart); if (lineNumEnd == -1) // small file case lineNumEnd = line.indexOf(' ', lineNumStart); num = line.mid(lineNumStart, lineNumEnd - lineNumStart).toInt(); num -= ofs; // offset for range filter computation // diff lines start from 1, 0 is empty file, // instead QValueList::at() starts from 0 if (num < 0 || num > prevAnn.size()) { dbp("ASSERT setAnnotation: start line number is %1", num); isError = true; return false; } for ( ; curLineNum < num; ++curLineNum) { newAnn.append(*cur); ++cur; } break; case '+': newAnn.append(author); break; case '-': if (curLineNum > prevAnn.size()) { dbp("ASSERT setAnnotation: remove end of " "file, diff is %1", diff); isError = true; return false; } else { ++cur; ++curLineNum; } break; case '\\': // diff(1) produces a "\ No newline at end of file", but the // message is locale dependent, so just test the space after '\' if (line[1] == ' ') break; // fall through default: if (curLineNum > prevAnn.size()) { dbp("ASSERT setAnnotation: end of " "file reached, diff is %1", diff); isError = true; return false; } else { newAnn.append(*cur); ++cur; ++curLineNum; } break; } } // copy the tail for ( ; curLineNum <= prevAnn.size(); ++curLineNum) { newAnn.append(*cur); ++cur; } return true; }
/* * Unit testing functions. Do not alter. */ void unittest () { cout << "\nSTARTING UNIT TEST\n\n"; SList<int> intList; cout << "INTEGER LIST TEST\n\n"; try { btassert<bool>(intList.getSize() == 0); cout << "Passed TEST 1: default constructor (size) \n"; } catch (bool b) { cout << "# FAILED TEST 1: default constructor (size) #\n"; } try { btassert<bool>(intList.toString() == ""); cout << "Passed TEST 2: toString \n"; } catch (bool b) { cout << "# FAILED TEST 2: toString #\n"; } intList.insert(10); try { btassert<bool>(intList.getSize() == 1 && intList.toString() == "10"); cout << "Passed TEST 3: insert(10)/getSize/toString \n"; } catch (bool b) { cout << "# FAILED TEST 3: insert(10)/getSize/toString #\n"; } intList.insert(10); try { btassert<bool>(intList.getSize() == 2 && intList.toString() == "10,10"); cout << "Passed TEST 4: insert(10)/getSize/toString \n"; } catch (bool b) { cout << "# FAILED TEST 4: insert(10)/getSize/toString #\n"; } intList.insert(30); try { btassert<bool>(intList.getSize() == 3 && intList.toString() == "10,10,30"); cout << "Passed TEST 5: insert(30)/getSize/toString \n"; } catch (bool b) { cout << "# FAILED TEST 5: insert(30)/getSize/toString #\n"; } intList.insert(30); try { btassert<bool>(intList.getSize() == 4 && intList.toString() == "10,10,30,30"); cout << "Passed TEST 6: insert(30)/getSize/toString \n"; } catch (bool b) { cout << "# FAILED TEST 6: insert(30)/getSize/toString #\n"; } intList.insert(15); try { btassert<bool>(intList.getSize() == 5 && intList.toString() == "10,10,15,30,30"); cout << "Passed TEST 7: insert(15)/getSize/toString \n"; } catch (bool b) { cout << "# FAILED TEST 7: insert(15)/getSize/toString #\n"; } intList.insertHead(5); try { btassert<bool>(intList.getSize() == 6 && intList.toString() == "5,10,10,15,30,30"); cout << "Passed TEST 8: insertHead(5)/getSize/toString \n"; } catch (bool b) { cout << "# FAILED TEST 8: insertHead(5)/getSize/toString #\n"; } intList.insertTail(50); try { btassert<bool>(intList.getSize() == 7 && intList.toString() == "5,10,10,15,30,30,50"); cout << "Passed TEST 9: insertTail(50)/getSize/toString \n"; } catch (bool b) { cout << "# FAILED TEST 9: insertTail(50)/getSize/toString #\n"; } try { btassert<bool>(intList.removeFirst(1) == false); cout << "Passed TEST 10: removeFirst(1) \n"; } catch (bool b) { cout << "# FAILED TEST 10: removeFirst(1) #\n"; } try { btassert<bool>(intList.removeAll(100) == false); cout << "Passed TEST 11: removeAll(1) \n"; } catch (bool b) { cout << "# FAILED TEST 11: removeAll(1) #\n"; } try { btassert<bool>(intList.removeFirst(10) == true && intList.getSize() == 6 && intList.toString() == "5,10,15,30,30,50"); cout << "Passed TEST 12: removeFirst(10)/getSize/toString \n"; } catch (bool b) { cout << "# FAILED TEST 12: removeFirst(10)/getSize/toString #\n"; } try { btassert<bool>(intList.removeAll(30) == true && intList.getSize() == 4 && intList.toString() == "5,10,15,50"); cout << "Passed TEST 13: removeAll(30)/getSize/toString \n"; } catch (bool b) { cout << "# FAILED TEST 13: removeAll(30)/getSize/toString #\n"; } intList.removeHead(); try { btassert<bool>(intList.getSize() == 3 && intList.toString() == "10,15,50"); cout << "Passed TEST 14: removeHead/getSize/toString \n"; } catch (bool b) { cout << "# FAILED TEST 14: removeHead/getSize/toString #\n"; } intList.removeTail(); try { btassert<bool>(intList.getSize() == 2 && intList.toString() == "10,15"); cout << "Passed TEST 15: removeTail/getSize/toString \n"; } catch (bool b) { cout << "# FAILED TEST 15: removeTail/getSize/toString #\n"; } intList.clear(); try { btassert<bool>(intList.getSize() == 0 && intList.toString() == ""); cout << "Passed TEST 16: clear/getSize/toString \n"; } catch (bool b) { cout << "# FAILED TEST 16: clear/getSize/toString #\n"; } cout << "\nSTRING LIST TEST\n\n"; SList<string> stringList; try { btassert<bool>(stringList.getSize() == 0); cout << "Passed TEST 17: default constructor (size) \n"; } catch (bool b) { cout << "# FAILED TEST 17: default constructor (size) #\n"; } try { btassert<bool>(stringList.toString() == ""); cout << "Passed TEST 18: toString \n"; } catch (bool b) { cout << "# FAILED TEST 18: toString #\n"; } stringList.insert("hello"); try { btassert<bool>(stringList.getSize() == 1 && stringList.toString() == "hello"); cout << "Passed TEST 19: insert(\"hello\")/getSize/toString \n"; } catch (bool b) { cout << "# FAILED TEST 19: insert(\"hello\")/getSize/toString #\n"; } stringList.insert("hello"); try { btassert<bool>(stringList.getSize() == 2 && stringList.toString() == "hello,hello"); cout << "Passed TEST 20: insert(\"hello\")/getSize/toString \n"; } catch (bool b) { cout << "# FAILED TEST 20: insert(\"hello\")/getSize/toString #\n"; } stringList.insert("mellow"); try { btassert<bool>(stringList.getSize() == 3 && stringList.toString() == "hello,hello,mellow"); cout << "Passed TEST 21: insert(\"mellow\")/getSize/toString \n"; } catch (bool b) { cout << "# FAILED TEST 21: insert(\"mellow\")/getSize/toString #\n"; } stringList.insert("mellow"); try { btassert<bool>(stringList.getSize() == 4 && stringList.toString() == "hello,hello,mellow,mellow"); cout << "Passed TEST 22: insert(\"mellow\")/getSize/toString \n"; } catch (bool b) { cout << "# FAILED TEST 22: insert(\"mellow\")/getSize/toString #\n"; } stringList.insert("jello"); try { btassert<bool>(stringList.getSize() == 5 && stringList.toString() == "hello,hello,jello,mellow,mellow"); cout << "Passed TEST 23: insert(\"jello\")/getSize/toString \n"; } catch (bool b) { cout << "# FAILED TEST 23: insert(\"jello\")/getSize/toString #\n"; } stringList.insertHead("cello"); try { btassert<bool>(stringList.getSize() == 6 && stringList.toString() == "cello,hello,hello,jello,mellow,mellow"); cout << "Passed TEST 24: insertHead(\"cello\")/getSize/toString \n"; } catch (bool b) { cout << "# FAILED TEST 24: insertHead(\"cello\")/getSize/toString #\n"; } stringList.insertTail("yellow"); try { btassert<bool>(stringList.getSize() == 7 && stringList.toString() == "cello,hello,hello,jello,mellow,mellow,yellow"); cout << "Passed TEST 25: insertTail(\"yellow\")/getSize/toString \n"; } catch (bool b) { cout << "# FAILED TEST 25: insertTail(\"yellow\")/getSize/toString #\n"; } try { btassert<bool>(stringList.removeFirst("fellow") == false); cout << "Passed TEST 26: removeFirst(\"fellow\") \n"; } catch (bool b) { cout << "# FAILED TEST 26: removeFirst(\"fellow\") #\n"; } try { btassert<bool>(stringList.removeAll("bellow") == false); cout << "Passed TEST 27: removeAll(\"bellow\") \n"; } catch (bool b) { cout << "# FAILED TEST 27: removeAll(\"bellow\") #\n"; } try { btassert<bool>(stringList.removeFirst("hello") == true && stringList.getSize() == 6 && stringList.toString() == "cello,hello,jello,mellow,mellow,yellow"); cout << "Passed TEST 28: removeFirst(\"hello\")/getSize/toString \n"; } catch (bool b) { cout << "# FAILED TEST 28: removeFirst(\"hello\")/getSize/toString #\n"; } try { btassert<bool>(stringList.removeAll("mellow") == true && stringList.getSize() == 4 && stringList.toString() == "cello,hello,jello,yellow"); cout << "Passed TEST 29: removeAll(30)/getSize/toString \n"; } catch (bool b) { cout << "# FAILED TEST 29: removeAll(30)/getSize/toString #\n"; } stringList.removeHead(); try { btassert<bool>(stringList.getSize() == 3 && stringList.toString() == "hello,jello,yellow"); cout << "Passed TEST 30: removeHead/getSize/toString \n"; } catch (bool b) { cout << "# FAILED TEST 30: removeHead/getSize/toString #\n"; } stringList.removeTail(); try { btassert<bool>(stringList.getSize() == 2 && stringList.toString() == "hello,jello"); cout << "Passed TEST 31: removeTail/getSize/toString \n"; } catch (bool b) { cout << "# FAILED TEST 31: removeTail/getSize/toString #\n"; } stringList.clear(); try { btassert<bool>(stringList.getSize() == 0 && stringList.toString() == ""); cout << "Passed TEST 32: clear/getSize/toString \n"; } catch (bool b) { cout << "# FAILED TEST 32: clear/getSize/toString #\n"; } cout << "\nUNIT TEST COMPLETE\n\n"; }