File tree Expand file tree Collapse file tree 1 file changed +60
-0
lines changed
Expand file tree Collapse file tree 1 file changed +60
-0
lines changed Original file line number Diff line number Diff line change 1+ /* SPDX-License-Identifier: GPL-2.0-or-later */
2+ /*
3+ * Copyright(c) 2025 John Sanpe <sanpeqf@gmail.com>
4+ */
5+
6+ #include <string.h>
7+ #include <bfdev/allocator.h>
8+ #include <bfdev/size.h>
9+
10+ #define TEST_SIZE BFDEV_SZ_64KiB
11+
12+ static int
13+ test_cleanup (void )
14+ {
15+ BFDEV_CLEAN (bfdev_free ) void * ptr ;
16+
17+ ptr = bfdev_malloc (NULL , TEST_SIZE );
18+ if (!ptr )
19+ return 1 ;
20+ bzero (ptr , TEST_SIZE );
21+
22+ return 0 ;
23+ }
24+
25+ static int
26+ test_class_malloc (void )
27+ {
28+ BFDEV_CLASS (bfdev_malloc , ptr )(TEST_SIZE );
29+
30+ if (!ptr )
31+ return 1 ;
32+ bzero (ptr , TEST_SIZE );
33+
34+ return 0 ;
35+ }
36+
37+ static int
38+ test_class_zalloc (void )
39+ {
40+ BFDEV_CLASS (bfdev_zalloc , ptr )(TEST_SIZE );
41+
42+ if (!ptr )
43+ return 1 ;
44+ bzero (ptr , TEST_SIZE );
45+
46+ return 0 ;
47+ }
48+
49+ int
50+ main (int argc , char const * argv [])
51+ {
52+ int retval ;
53+
54+ if ((retval = test_cleanup ()) ||
55+ (retval = test_class_malloc ()) ||
56+ (retval = test_class_zalloc ()))
57+ return retval ;
58+
59+ return 0 ;
60+ }
You can’t perform that action at this time.
0 commit comments