/* program to allow experimentation of stack implementations */

#include <stdlib.h>
#include <stdio.h>
#include <string.h>

#include "stack.h"
#include "stack-buffer.h" /* for MAX_STRING_LENGTH */


int
main (void)
{
  /* set up a stack variable */
  struct string_stack * pStack = initialize();
 
  /* create one random string */
  char myString[MAX_STRING_LENGTH];
  for (int c=0 ; c<MAX_STRING_LENGTH ; c++)
    myString[c] = (rand() % 26)+'A';
  
  /* push the same string onto the stack several times */
  while ( !isFull(pStack) )
    {
      printf("%d ",size(pStack));
      push(pStack, myString);
    }
  printf("\n");
  
  /* pop the strings off the stack */
  while ( !isEmpty(pStack) )
    {
      printf("%d ",size(pStack));
      pop(pStack);
    }
  printf("\n");

  return 0;
}
