2017-10-21 23:40:19 +00:00
|
|
|
/* Conformance Test 16.4.0.1: Verification of memset library function */
|
|
|
|
|
|
|
|
#include <stddef.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
2022-10-17 22:50:42 +00:00
|
|
|
int printf(const char *, ...);
|
|
|
|
|
|
|
|
int main (void)
|
2017-10-21 23:40:19 +00:00
|
|
|
{
|
|
|
|
char *rgn, *ptr1;
|
|
|
|
|
|
|
|
|
|
|
|
rgn = (char *) malloc (1024);
|
|
|
|
if (rgn == NULL)
|
|
|
|
goto Fail1;
|
|
|
|
|
|
|
|
ptr1 = (char *) memset (rgn, 'a', 1024);
|
|
|
|
if (ptr1 != rgn)
|
|
|
|
goto Fail;
|
|
|
|
|
2022-10-17 22:50:42 +00:00
|
|
|
for (; rgn != ptr1 + 1024; rgn++)
|
2017-10-21 23:40:19 +00:00
|
|
|
if (*rgn != 'a')
|
|
|
|
goto Fail;
|
|
|
|
|
2022-10-17 22:50:42 +00:00
|
|
|
free (ptr1);
|
2017-10-21 23:40:19 +00:00
|
|
|
|
|
|
|
printf ("Passed Conformance Test 16.4.0.1\n");
|
2022-10-17 22:50:42 +00:00
|
|
|
return 0;
|
2017-10-21 23:40:19 +00:00
|
|
|
|
|
|
|
Fail:
|
|
|
|
printf ("Failed Conformance Test 16.4.0.1\n");
|
2022-10-17 22:50:42 +00:00
|
|
|
return 0;
|
2017-10-21 23:40:19 +00:00
|
|
|
|
|
|
|
Fail1:
|
|
|
|
printf ("Unable to allocate memory for Conformance Test 16.4.0.1\n");
|
2022-10-17 22:50:42 +00:00
|
|
|
return 0;
|
2017-10-21 23:40:19 +00:00
|
|
|
}
|