summaryrefslogtreecommitdiff
path: root/tests/test-strstr.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test-strstr.c')
-rw-r--r--tests/test-strstr.c66
1 files changed, 33 insertions, 33 deletions
diff --git a/tests/test-strstr.c b/tests/test-strstr.c
index 37f4bace65..c89a1ace41 100644
--- a/tests/test-strstr.c
+++ b/tests/test-strstr.c
@@ -27,15 +27,15 @@
#include "zerosize-ptr.h"
#define ASSERT(expr) \
- do \
- { \
- if (!(expr)) \
- { \
- fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
- fflush (stderr); \
- abort (); \
- } \
- } \
+ do \
+ { \
+ if (!(expr)) \
+ { \
+ fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
+ fflush (stderr); \
+ abort (); \
+ } \
+ } \
while (0)
int
@@ -111,16 +111,16 @@ main (int argc, char *argv[])
char *haystack = (char *) malloc (m + 1);
if (haystack != NULL)
{
- memset (haystack, 'A', m);
- haystack[0] = 'B';
- haystack[m] = '\0';
+ memset (haystack, 'A', m);
+ haystack[0] = 'B';
+ haystack[m] = '\0';
- for (; repeat > 0; repeat--)
- {
- ASSERT (strstr (haystack, needle) == haystack + 1);
- }
+ for (; repeat > 0; repeat--)
+ {
+ ASSERT (strstr (haystack, needle) == haystack + 1);
+ }
- free (haystack);
+ free (haystack);
}
}
@@ -135,15 +135,15 @@ main (int argc, char *argv[])
char *needle = (char *) malloc (m + 1);
if (needle != NULL)
{
- memset (needle, 'A', m);
- needle[m] = '\0';
+ memset (needle, 'A', m);
+ needle[m] = '\0';
- for (; repeat > 0; repeat--)
- {
- ASSERT (strstr (haystack, needle) == NULL);
- }
+ for (; repeat > 0; repeat--)
+ {
+ ASSERT (strstr (haystack, needle) == NULL);
+ }
- free (needle);
+ free (needle);
}
}
@@ -154,18 +154,18 @@ main (int argc, char *argv[])
char *needle = (char *) malloc (m + 2);
if (haystack != NULL && needle != NULL)
{
- const char *result;
+ const char *result;
- memset (haystack, 'A', 2 * m);
- haystack[2 * m] = 'B';
- haystack[2 * m + 1] = '\0';
+ memset (haystack, 'A', 2 * m);
+ haystack[2 * m] = 'B';
+ haystack[2 * m + 1] = '\0';
- memset (needle, 'A', m);
- needle[m] = 'B';
- needle[m + 1] = '\0';
+ memset (needle, 'A', m);
+ needle[m] = 'B';
+ needle[m + 1] = '\0';
- result = strstr (haystack, needle);
- ASSERT (result == haystack + m);
+ result = strstr (haystack, needle);
+ ASSERT (result == haystack + m);
}
free (needle);
free (haystack);