/* main.c - This is the test driver program for. */
/* Copyright (C) 2018 Robin Miyagi https://www.linuxprogramming.ca/
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation; either version 3 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */
/*
 * Project includes.
 */
#include <slab.h>

/*
 * System includes.
 */
#ifndef _GNU_SOURCE
# define _GNU_SOURCE
#endif
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <errno.h>
#include <error.h>

int
main
(void)
{
#define COUNT 0x100
  t_slab* slab;
  int i;
  int* ptr;
  
  slab = slab_new (sizeof (int));
  for (i = 0; i < COUNT; ++i)
    {
      ptr = slab_alloc (slab);
      *ptr = rand ();
      printf ("The lucky number is %d\n", *ptr);
    }
  for (i = 0; i < COUNT; ++i)
    {
      ptr = slab_alloc (slab);
      *ptr = rand ();
      printf ("The lucky number is %d\n", *ptr);
      slab_free (slab, ptr);
    }
  slab_delete (slab);
  
#undef COUNT
}
