| 1 |
/*************************************************************************** |
/* SPDX-License-Identifier: GPL-3.0-or-later */ |
| 2 |
test_memory_pool.c - description |
/* |
| 3 |
------------------- |
* test_memory_pool |
| 4 |
copyright : (C) 2004-2025 by Leaflet |
* - tester for memory pool |
| 5 |
email : leaflet@leafok.com |
* |
| 6 |
***************************************************************************/ |
* Copyright (C) 2004-2025 Leaflet <leaflet@leafok.com> |
| 7 |
|
*/ |
| 8 |
/*************************************************************************** |
|
| 9 |
* * |
#ifdef HAVE_CONFIG_H |
| 10 |
* This program is free software; you can redistribute it and/or modify * |
#include "config.h" |
| 11 |
* it under the terms of the GNU General Public License as published by * |
#endif |
|
* the Free Software Foundation; either version 3 of the License, or * |
|
|
* (at your option) any later version. * |
|
|
* * |
|
|
***************************************************************************/ |
|
| 12 |
|
|
|
#include "memory_pool.h" |
|
| 13 |
#include "log.h" |
#include "log.h" |
| 14 |
|
#include "memory_pool.h" |
| 15 |
#include <stdio.h> |
#include <stdio.h> |
|
#include <unistd.h> |
|
| 16 |
#include <string.h> |
#include <string.h> |
| 17 |
|
#include <unistd.h> |
| 18 |
|
|
| 19 |
#define NODE_SIZE 1023 |
enum _test_memory_pool_constant_t |
| 20 |
#define NODE_PER_CHUNK 1000 |
{ |
| 21 |
#define CHUNK_COUNT_LIMIT 100 |
NODE_SIZE = 1023, |
| 22 |
|
NODE_PER_CHUNK = 1000, |
| 23 |
|
CHUNK_COUNT_LIMIT = 100, |
| 24 |
|
}; |
| 25 |
|
|
| 26 |
int main(int argc, char *argv[]) |
int main(int argc, char *argv[]) |
| 27 |
{ |
{ |
| 83 |
{ |
{ |
| 84 |
for (k = (int)sizeof(void *); k < NODE_SIZE; k++) |
for (k = (int)sizeof(void *); k < NODE_SIZE; k++) |
| 85 |
{ |
{ |
| 86 |
if ((*(char *)(p_nodes[i] + k)) != 'A' + j - 1) |
if ((*((char *)p_nodes[i] + k)) != 'A' + j - 1) |
| 87 |
{ |
{ |
| 88 |
printf("Value of node[%d] at offset %d not equal to value set %c\n", |
printf("Value of node[%d] at offset %d not equal to value set %c\n", |
| 89 |
i, k, 'A' + j - 1); |
i, k, 'A' + j - 1); |