summaryrefslogtreecommitdiff
path: root/examples/utest/testcases/posix/stdlib_h/definitions/stdlib_h.c
blob: a7bca062d73d9cd9b3b845d35f66b6ab168cb6cf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
/*
 * Copyright (c) 2004, Bull SA. All rights reserved.
 * Created by:  [email protected]
 * This file is licensed under the GPL license.  For the full content
 * of this license, see the COPYING file at the top level of this
 * source tree.
 */

 /* test if stdlib.h exists and can be included */

// #define _POSIX_C_SOURCE 200809L

#include <stdlib.h>
#include <sys/time.h>

#ifndef __compar_fn_t_defined
#define __compar_fn_t_defined
typedef int (*__compar_fn_t) (const void *, const void *);
#endif

void                (*test_abort)(void);
int                 (*test_abs)(int);
double              (*test_atof)(const char *__nptr);
int                 (*test_atoi)(const char *__nptr);
long                (*test_atol)(const char *__nptr);
long long           (*test_atoll)(const char *__nptr);
void *              (*test_bsearch)(const void *__key, const void *__base, size_t __nmemb, size_t __size, __compar_fn_t _compar);
void *              (*test_calloc)(size_t, size_t);
div_t               (*test_div)(int __numer, int __denom);
void                (*test_free)(void *);
char *              (*test_getenv)(const char *__string);
long                (*test_labs)(long);
ldiv_t              (*test_ldiv)(long __numer, long __denom);
void *              (*test_malloc)(size_t);
void                (*test_qsort)(void *__base, size_t __nmemb, size_t __size, __compar_fn_t _compar);
int                 (*test_rand)(void);
int                 (*test_rand_r)(unsigned *__seed);
void *              (*test_realloc)(void *, size_t);
int                 (*test_setenv)(const char *__string, const char *__value, int __overwrite);
void                (*test_srand)(unsigned __seed);
double              (*test_strtod)(const char *__restrict __n, char **__restrict __end_PTR);
float               (*test_strtof)(const char *__restrict __n, char **__restrict __end_PTR);
long                (*test_strtol)(const char *__restrict __n, char **__restrict __end_PTR, int __base);
long double         (*test_strtold)(const char *__restrict, char **__restrict);
long long           (*test_strtoll)(const char *__restrict __n, char **__restrict __end_PTR, int __base);
unsigned long       (*test_strtoul)(const char *__restrict __n, char **__restrict __end_PTR, int __base);
unsigned long long  (*test_strtoull)(const char *__restrict __n, char **__restrict __end_PTR, int __base);
int                 (*test_unsetenv)(const char *__string);



__attribute__((unused)) static int test_defined()
{
    test_abort = abort;
    test_abs = abs;
    test_atof = atof;
    test_atoi = atoi;
    test_atol = atol;
    test_atoll = atoll;
    test_bsearch = bsearch;
    test_calloc = calloc;
    test_div = div;
    test_free = free;
    test_getenv = getenv;
    test_labs = labs;
    test_ldiv = ldiv;
    test_malloc = malloc;
    test_qsort = qsort;
    test_rand = rand;
    // test_rand_r = rand_r;
    test_realloc = realloc;
    // test_setenv = setenv;
    test_srand = srand;
    test_strtod = strtod;
    test_strtof = strtof;
    test_strtol = strtol;
    test_strtold = strtold;
    test_strtoll = strtoll;
    test_strtoul = strtoul;
    test_strtoull = strtoull;
    // test_unsetenv = unsetenv;

    return 0;
}