Bool16 OSQueue::Test() { OSQueue theVictim; void *x = (void*)1; OSQueueElem theElem1(x); x = (void*)2; OSQueueElem theElem2(x); x = (void*)3; OSQueueElem theElem3(x); if (theVictim.GetHead() != NULL) return false; if (theVictim.GetTail() != NULL) return false; theVictim.EnQueue(&theElem1); if (theVictim.GetHead() != &theElem1) return false; if (theVictim.GetTail() != &theElem1) return false; OSQueueElem* theElem = theVictim.DeQueue(); if (theElem != &theElem1) return false; if (theVictim.GetHead() != NULL) return false; if (theVictim.GetTail() != NULL) return false; theVictim.EnQueue(&theElem1); theVictim.EnQueue(&theElem2); if (theVictim.GetHead() != &theElem1) return false; if (theVictim.GetTail() != &theElem2) return false; theElem = theVictim.DeQueue(); if (theElem != &theElem1) return false; if (theVictim.GetHead() != &theElem2) return false; if (theVictim.GetTail() != &theElem2) return false; theElem = theVictim.DeQueue(); if (theElem != &theElem2) return false; theVictim.EnQueue(&theElem1); theVictim.EnQueue(&theElem2); theVictim.EnQueue(&theElem3); if (theVictim.GetHead() != &theElem1) return false; if (theVictim.GetTail() != &theElem3) return false; theElem = theVictim.DeQueue(); if (theElem != &theElem1) return false; if (theVictim.GetHead() != &theElem2) return false; if (theVictim.GetTail() != &theElem3) return false; theElem = theVictim.DeQueue(); if (theElem != &theElem2) return false; if (theVictim.GetHead() != &theElem3) return false; if (theVictim.GetTail() != &theElem3) return false; theElem = theVictim.DeQueue(); if (theElem != &theElem3) return false; theVictim.EnQueue(&theElem1); theVictim.EnQueue(&theElem2); theVictim.EnQueue(&theElem3); OSQueueIter theIterVictim(&theVictim); if (theIterVictim.IsDone()) return false; if (theIterVictim.GetCurrent() != &theElem3) return false; theIterVictim.Next(); if (theIterVictim.IsDone()) return false; if (theIterVictim.GetCurrent() != &theElem2) return false; theIterVictim.Next(); if (theIterVictim.IsDone()) return false; if (theIterVictim.GetCurrent() != &theElem1) return false; theIterVictim.Next(); if (!theIterVictim.IsDone()) return false; if (theIterVictim.GetCurrent() != NULL) return false; theVictim.Remove(&theElem1); if (theVictim.GetHead() != &theElem2) return false; if (theVictim.GetTail() != &theElem3) return false; theVictim.Remove(&theElem1); if (theVictim.GetHead() != &theElem2) return false; if (theVictim.GetTail() != &theElem3) return false; theVictim.Remove(&theElem3); if (theVictim.GetHead() != &theElem2) return false; if (theVictim.GetTail() != &theElem2) return false; return true; }