/**
 * \file TestAlloc.cpp
 * Fonctions de test de bonne allocation memoire.
 * 
 * @author Nicolas Janey
 * @author nicolas.janey@univ-fcomte.fr
 * @version 1.0, 01/01/10
 */

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

void testAllocAndExit(void *p,char *fct) {
  if ( !p ) {
    printf("Bad alloc : %s\n",fct);
    exit(1); }
}

void testAllocAndExit(void *p,char *fct,int val) {
  if ( !p ) {
    printf("Bad alloc : %s : %d\n",fct,val);
    exit(1); }
}

void testAllocAndExit(void *p,char *fct,int val1,int val2) {
  if ( !p ) {
    printf("Bad alloc : %s : %d %d\n",fct,val1,val2);
    exit(1); }
}

int testAllocAndGo(void *p,char *fct) {
  if ( !p ) {
    printf("Bad alloc : %s\n",fct); }
  return(( p ) ? 1 : 0);
}

int testAllocAndGo(void *p,char *fct,int val) {
  if ( !p ) {
    printf("Bad alloc : %s : %d\n",fct,val); }
  return(( p ) ? 1 : 0);
}

int testAllocAndGo(void *p,char *fct,int val1,int val2) {
  if ( !p ) {
    printf("Bad alloc : %s : %d %d\n",fct,val1,val2); }
  return(( p ) ? 1 : 0);
}
