| 3 |
* test_section_list |
* test_section_list |
| 4 |
* - tester for data models and basic operations of section and article |
* - tester for data models and basic operations of section and article |
| 5 |
* |
* |
| 6 |
* Copyright (C) 2004-2025 by Leaflet <leaflet@leafok.com> |
* Copyright (C) 2004-2025 Leaflet <leaflet@leafok.com> |
| 7 |
*/ |
*/ |
| 8 |
|
|
| 9 |
|
#ifdef HAVE_CONFIG_H |
| 10 |
|
#include "config.h" |
| 11 |
|
#endif |
| 12 |
|
|
| 13 |
#include "bbs.h" |
#include "bbs.h" |
| 14 |
#include "log.h" |
#include "log.h" |
| 15 |
#include "section_list.h" |
#include "section_list.h" |
| 19 |
#include <stdio.h> |
#include <stdio.h> |
| 20 |
#include <unistd.h> |
#include <unistd.h> |
| 21 |
|
|
| 22 |
#define ARTICLE_BLOCK_SHM_FILE "~article_block_shm.dat" |
static const char ARTICLE_BLOCK_SHM_FILE[] = "~article_block_shm.dat"; |
| 23 |
#define SECTION_LIST_SHM_FILE "~section_list_shm.dat" |
static const char SECTION_LIST_SHM_FILE[] = "~section_list_shm.dat"; |
| 24 |
#define TRIE_DICT_SHM_FILE "~trie_dict_shm.dat" |
static const char TRIE_DICT_SHM_FILE[] = "~trie_dict_shm.dat"; |
| 25 |
#define USER_LIST_SHM_FILE "~user_list_shm.dat" |
static const char USER_LIST_SHM_FILE[] = "~user_list_shm.dat"; |
| 26 |
|
|
| 27 |
const char *sname[] = { |
const char *sname[] = { |
| 28 |
"Test", |
"Test", |
| 72 |
log_error_redir(STDERR_FILENO); |
log_error_redir(STDERR_FILENO); |
| 73 |
|
|
| 74 |
// - 1 to make blocks allocated is less than required, to trigger error handling |
// - 1 to make blocks allocated is less than required, to trigger error handling |
| 75 |
block_count = BBS_article_limit_per_section * BBS_max_section / ARTICLE_PER_BLOCK; |
block_count = BBS_article_limit_per_section * BBS_max_section / BBS_article_count_per_block; |
| 76 |
|
|
| 77 |
if ((fp = fopen(ARTICLE_BLOCK_SHM_FILE, "w")) == NULL) |
if ((fp = fopen(ARTICLE_BLOCK_SHM_FILE, "w")) == NULL) |
| 78 |
{ |
{ |