Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions
_TestDeque Class Reference

List of all members.

Public Member Functions

 _TestDeque ()
int SelfTest ()
 conduct automated self test for this class
nsresult OriginalTest ()
nsresult OriginalFlaw ()
nsresult AssignFlaw ()

Detailed Description

Definition at line 45 of file TestDeque.cpp.


Constructor & Destructor Documentation

_TestDeque::_TestDeque ( ) [inline]

Definition at line 47 of file TestDeque.cpp.

               {
    SelfTest();
  }

Here is the call graph for this function:


Member Function Documentation

Definition at line 147 of file TestDeque.cpp.

                                {
  nsDeque src(new _Dealloc),dest(new _Dealloc);
  return NS_OK;
}

Here is the caller graph for this function:

Test 1. Origin near end, semi full, call Peek(). you start, mCapacity is 8

Definition at line 109 of file TestDeque.cpp.

                                  {
  int ints[200];
  int i=0;
  int* temp;
  nsDeque secondDeque(new _Dealloc);
  printf("fill array\n");
  for (i=32; i; --i)
    ints[i]=i*3+10;
  printf("push 6 times\n");
  for (i=0; i<6; i++)
    secondDeque.Push(&ints[i]);
  printf("popfront 4 times:\n");
  for (i=4; i; --i) {
    temp=(int*)secondDeque.PopFront();
    printf("%d\t",*temp);
  }
  printf("push 4 times\n");
  for (int j=4; j; --j)
    secondDeque.Push(&ints[++i]);
  printf("origin should now be about 4\n");
  printf("and size should be 6\n");
  printf("origin+size>capacity\n");

   /*<akk> Oh, I see ... it's a circular buffer */
  printf("but the old code wasn't behaving accordingly.\n");

   /*right*/
  printf("we shouldn't crash or anything interesting, ");

  temp=(int*)secondDeque.Peek();
  printf("peek: %d\n",*temp);
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 78 of file TestDeque.cpp.

                                  {
  int ints[200];
  int count=sizeof(ints)/sizeof(int);
  int i=0;
  int* temp;
  nsDeque theDeque(new _Dealloc); //construct a simple one...
 
  for (i=0;i<count;i++) { //initialize'em
    ints[i]=10*(1+i);
  }
  for (i=0;i<70;i++) {
    theDeque.Push(&ints[i]);
  }
  for (i=0;i<56;i++) {
    temp=(int*)theDeque.Pop();
  }
  for (i=0;i<55;i++) {
    theDeque.Push(&ints[i]);
  }
  for (i=0;i<35;i++) {
    temp=(int*)theDeque.Pop();
  }
  for (i=0;i<35;i++) {
    theDeque.Push(&ints[i]);
  }
  for (i=0;i<38;i++) {
    temp=(int*)theDeque.Pop();
  }
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

conduct automated self test for this class

Parameters:
@return

Definition at line 69 of file TestDeque.cpp.

                         {
  /* the old deque should have failed a bunch of these tests */
  int results=0;
  results+=OriginalTest();
  results+=OriginalFlaw();
  results+=AssignFlaw();
  return results;
}

Here is the call graph for this function:

Here is the caller graph for this function:


The documentation for this class was generated from the following file: