projects
/
gnulib.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
New module attribute 'Applicability'.
[gnulib.git]
/
tests
/
test-mbsstr2.c
diff --git
a/tests/test-mbsstr2.c
b/tests/test-mbsstr2.c
index
d8699ca
..
667390f
100644
(file)
--- a/
tests/test-mbsstr2.c
+++ b/
tests/test-mbsstr2.c
@@
-1,5
+1,5
@@
/* Test of searching in a string.
/* Test of searching in a string.
- Copyright (C) 2007 Free Software Foundation, Inc.
+ Copyright (C) 2007
-2008
Free Software Foundation, Inc.
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
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
@@
-25,14
+25,15
@@
#include <stdlib.h>
#define ASSERT(expr) \
#include <stdlib.h>
#define ASSERT(expr) \
- do \
- { \
- if (!(expr)) \
- { \
+ do
\
+ {
\
+ if (!(expr))
\
+ {
\
fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
- abort (); \
- } \
- } \
+ fflush (stderr); \
+ abort (); \
+ } \
+ } \
while (0)
int
while (0)
int
@@
-83,16
+84,16
@@
main ()
char *haystack = (char *) malloc (m + 1);
if (haystack != NULL)
{
char *haystack = (char *) malloc (m + 1);
if (haystack != NULL)
{
- memset (haystack, 'A', m);
- haystack[0] = '\303'; haystack[1] = '\204';
- haystack[m] = '\0';
+
memset (haystack, 'A', m);
+
haystack[0] = '\303'; haystack[1] = '\204';
+
haystack[m] = '\0';
- for (; repeat > 0; repeat--)
- {
- ASSERT (mbsstr (haystack, needle) == haystack + 2);
- }
+
for (; repeat > 0; repeat--)
+
{
+
ASSERT (mbsstr (haystack, needle) == haystack + 2);
+
}
- free (haystack);
+
free (haystack);
}
}
}
}
@@
-111,15
+112,15
@@
main ()
char *needle = (char *) malloc (m + 1);
if (needle != NULL)
{
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 (mbsstr (haystack, needle) == NULL);
- }
+
for (; repeat > 0; repeat--)
+
{
+
ASSERT (mbsstr (haystack, needle) == NULL);
+
}
- free (needle);
+
free (needle);
}
}
}
}
@@
-130,23
+131,21
@@
main ()
char *needle = (char *) malloc (m + 3);
if (haystack != NULL && needle != NULL)
{
char *needle = (char *) malloc (m + 3);
if (haystack != NULL && needle != NULL)
{
- const char *result;
+
const char *result;
- memset (haystack, 'A', 2 * m);
- haystack[2 * m] = '\303'; haystack[2 * m + 1] = '\207';
- haystack[2 * m + 2] = '\0';
+
memset (haystack, 'A', 2 * m);
+
haystack[2 * m] = '\303'; haystack[2 * m + 1] = '\207';
+
haystack[2 * m + 2] = '\0';
- memset (needle, 'A', m);
- needle[m] = '\303'; needle[m + 1] = '\207';
- needle[m + 2] = '\0';
+
memset (needle, 'A', m);
+
needle[m] = '\303'; needle[m + 1] = '\207';
+
needle[m + 2] = '\0';
- result = mbsstr (haystack, needle);
- ASSERT (result == haystack + m);
+
result = mbsstr (haystack, needle);
+
ASSERT (result == haystack + m);
}
}
- if (needle != NULL)
- free (needle);
- if (haystack != NULL)
- free (haystack);
+ free (needle);
+ free (haystack);
}
return 0;
}
return 0;