void DFListTest::unmanagedListTest() { startFeatureTest("Unmanaged list tests"); DFPointerList pl; const char *msg1 = "1"; const char *msg2 = "2"; const char *msg3 = "3"; const char *msg4 = "4"; const char *msg0 = "0"; reportResult("Verify empty() true on list creation", pl.empty()); pl.pushBack((void *)msg1); pl.pushBack((void *)msg2); pl.pushBack((void *)msg3); pl.pushBack((void *)msg4); reportResult("Verify pushBack()", verifyList(pl, "1234")); DFPointerList::Index idx = nullptr; idx = pl.next(idx); idx = pl.next(idx); idx = pl.next(idx); // idx points to node containing msg3 idx = pl.erase(idx); pl.pushFront((void *)msg0); reportResult("Verify next() pushFront() and erase()", verifyList(pl, "0124")); pl.clear(); reportResult("Verify clear()", pl.empty()); }
void verify(struct localAlloc *local){ barrier(local->tid, local->global->numThreads); struct allocator *global=local->global; verifyList(entryHead); for(int i=0; i < global->numThreads ; ++i) { Entry* hptr0 = threadsDirties[i].HPs[0]; Entry* hptr1 = threadsDirties[i].HPs[1]; Entry* hptr2 = threadsDirties[i].HPs[2]; verifyList(hptr0); verifyList(hptr1); verifyList(hptr2); } barrier(local->tid, local->global->numThreads); }