Add a test for calloc().
This commit is contained in:
parent
9481487e3d
commit
6cd2a9ba81
23
plat/qemuppc/tests/calloc_c.c
Normal file
23
plat/qemuppc/tests/calloc_c.c
Normal file
|
@ -0,0 +1,23 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include "test.h"
|
||||
|
||||
int main(int argc, const char* argv[])
|
||||
{
|
||||
const char* p;
|
||||
int i;
|
||||
|
||||
ASSERT(0 == calloc(0, 0));
|
||||
ASSERT(0 == calloc(0, 1));
|
||||
ASSERT(0 == calloc(1, 0));
|
||||
ASSERT(0 == calloc(SIZE_MAX/2, 3));
|
||||
ASSERT(0 == calloc(SIZE_MAX/2, 2));
|
||||
ASSERT(0 != calloc(1, 1));
|
||||
|
||||
p = calloc(10, 1);
|
||||
for (i=0; i<10; i++)
|
||||
ASSERT(0 == p[i]);
|
||||
|
||||
finished();
|
||||
}
|
Loading…
Reference in a new issue