/* atol.c
*
* Copyright (C) 2006-2008 Guillaume Duranceau
* This file is part of the CROCOS test suite.
*/
#include "atol.h"
#include "exit.h"
#define TEST_ATOL(str, res, error) if (atol (str) != (res)) ERROR (error);
void main () {
char *str1 = "0";
long res1 = 0;
char *str2 = "1 ";
long res2 = 1;
char *str3 = "-123abc";
long res3 = -123;
char *str4 = " \n\t\r 39B1";
long res4 = 39;
char *str5 = "\t-1 1";
long res5 = -1;
char *str6 = "-(";
long res6 = 0;
char *str7 = " \n-";
long res7 = 0;
TEST_ATOL (str1, res1, 1);
TEST_ATOL (str2, res2, 2);
TEST_ATOL (str3, res3, 3);
TEST_ATOL (str4, res4, 4);
TEST_ATOL (str5, res5, 5);
TEST_ATOL (str6, res6, 6);
TEST_ATOL (str7, res7, 7);
OK;
}