macros.h | macros.h | |||
---|---|---|---|---|
/* Common macros used by gnulib tests. | /* Common macros used by gnulib tests. | |||
Copyright (C) 2006-2010 Free Software Foundation, Inc. | Copyright (C) 2006-2014 Free Software Foundation, Inc. | |||
This program is free software: you can redistribute it and/or modify | 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 | it under the terms of the GNU General Public License as published by | |||
the Free Software Foundation; either version 3 of the License, or | the Free Software Foundation; either version 3 of the License, or | |||
(at your option) any later version. | (at your option) any later version. | |||
This program is distributed in the hope that it will be useful, | This program is distributed in the hope that it will be useful, | |||
but WITHOUT ANY WARRANTY; without even the implied warranty of | but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
GNU General Public License for more details. | GNU General Public License for more details. | |||
skipping to change at line 50 | skipping to change at line 50 | |||
debugger (provided core dumps are enabled: "ulimit -c unlimited"). | debugger (provided core dumps are enabled: "ulimit -c unlimited"). | |||
- For the sake of platforms where no debugger is available (such as | - For the sake of platforms where no debugger is available (such as | |||
some mingw systems), an error message is printed on the error | some mingw systems), an error message is printed on the error | |||
stream that includes the source location of the ASSERT invocation. | stream that includes the source location of the ASSERT invocation. | |||
*/ | */ | |||
#define ASSERT(expr) \ | #define ASSERT(expr) \ | |||
do \ | do \ | |||
{ \ | { \ | |||
if (!(expr)) \ | if (!(expr)) \ | |||
{ \ | { \ | |||
fprintf (ASSERT_STREAM, "%s:%d: assertion failed\n", | fprintf (ASSERT_STREAM, "%s:%d: assertion '%s' failed\n", \ | |||
\ | __FILE__, __LINE__, #expr); \ | |||
__FILE__, __LINE__); | ||||
\ | ||||
fflush (ASSERT_STREAM); \ | fflush (ASSERT_STREAM); \ | |||
abort (); \ | abort (); \ | |||
} \ | } \ | |||
} \ | } \ | |||
while (0) | while (0) | |||
/* SIZEOF (array) | /* SIZEOF (array) | |||
returns the number of elements of an array. It works for arrays that ar e | returns the number of elements of an array. It works for arrays that ar e | |||
declared outside functions and for local variables of array type. It do es | declared outside functions and for local variables of array type. It do es | |||
*not* work for function parameters of array type, because they are actua lly | *not* work for function parameters of array type, because they are actua lly | |||
parameters of pointer type. */ | parameters of pointer type. */ | |||
#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) | #define SIZEOF(array) (sizeof (array) / sizeof (array[0])) | |||
/* STREQ (str1, str2) | ||||
Return true if two strings compare equal. */ | ||||
#define STREQ(a, b) (strcmp (a, b) == 0) | ||||
/* Some numbers in the interval [0,1). */ | ||||
extern const float randomf[1000]; | ||||
extern const double randomd[1000]; | ||||
extern const long double randoml[1000]; | ||||
End of changes. 3 change blocks. | ||||
5 lines changed or deleted | 3 lines changed or added | |||
This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/ |