1 | /* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. |
2 | |
3 | This program is free software; you can redistribute it and/or modify |
4 | it under the terms of the GNU General Public License as published by |
5 | the Free Software Foundation; version 2 of the License. |
6 | |
7 | This program is distributed in the hope that it will be useful, |
8 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
10 | GNU General Public License for more details. |
11 | |
12 | You should have received a copy of the GNU General Public License |
13 | along with this program; if not, write to the Free Software |
14 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ |
15 | |
16 | #include <my_global.h> |
17 | #include <my_sys.h> |
18 | #include "tap.h" |
19 | |
20 | int main(int argc __attribute__((unused)),char *argv[]) |
21 | { |
22 | void *p; |
23 | MY_INIT(argv[0]); |
24 | |
25 | plan(4); |
26 | |
27 | p= my_malloc(0, MYF(0)); |
28 | ok(p != NULL, "Zero-sized block allocation." ); |
29 | |
30 | p= my_realloc(p, 32, MYF(0)); |
31 | ok(p != NULL, "Reallocated zero-sized block." ); |
32 | |
33 | p= my_realloc(p, 16, MYF(0)); |
34 | ok(p != NULL, "Trimmed block." ); |
35 | |
36 | my_free(p); |
37 | p= NULL; |
38 | |
39 | ok((my_free(p), 1), "Free NULL pointer." ); |
40 | |
41 | my_end(0); |
42 | return exit_status(); |
43 | } |
44 | |
45 | |