/[LeafOK_CVS]/lbbs/src/test_section_list.c
ViewVC logotype

Diff of /lbbs/src/test_section_list.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.35 by sysadm, Fri Oct 24 02:00:59 2025 UTC Revision 1.40 by sysadm, Wed Nov 5 06:14:01 2025 UTC
# Line 1  Line 1 
1  /***************************************************************************  /* SPDX-License-Identifier: GPL-3.0-or-later */
2                                          test_section_list.c  -  description  /*
3                                                           -------------------   * test_section_list
4          Copyright            : (C) 2004-2025 by Leaflet   *   - tester for data models and basic operations of section and article
5          Email                : leaflet@leafok.com   *
6   ***************************************************************************/   * Copyright (C) 2004-2025  Leaflet <leaflet@leafok.com>
7     */
 /***************************************************************************  
  *                                                                         *  
  *   This program is free software; you can redistribute it and/or modify  *  
  *   it under the terms of the GNU General Public License as published by  *  
  *   the Free Software Foundation; either version 3 of the License, or     *  
  *   (at your option) any later version.                                   *  
  *                                                                         *  
  ***************************************************************************/  
8    
9  #include "bbs.h"  #include "bbs.h"
10  #include "log.h"  #include "log.h"
# Line 23  Line 15 
15  #include <stdio.h>  #include <stdio.h>
16  #include <unistd.h>  #include <unistd.h>
17    
18  #define ARTICLE_BLOCK_SHM_FILE "~article_block_shm.dat"  static const char ARTICLE_BLOCK_SHM_FILE[] = "~article_block_shm.dat";
19  #define SECTION_LIST_SHM_FILE "~section_list_shm.dat"  static const char SECTION_LIST_SHM_FILE[] = "~section_list_shm.dat";
20  #define TRIE_DICT_SHM_FILE "~trie_dict_shm.dat"  static const char TRIE_DICT_SHM_FILE[] = "~trie_dict_shm.dat";
21  #define USER_LIST_SHM_FILE "~user_list_shm.dat"  static const char USER_LIST_SHM_FILE[] = "~user_list_shm.dat";
22    
23  const char *sname[] = {  const char *sname[] = {
24          "Test",          "Test",
# Line 76  int main(int argc, char *argv[]) Line 68  int main(int argc, char *argv[])
68          log_error_redir(STDERR_FILENO);          log_error_redir(STDERR_FILENO);
69    
70          // - 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
71          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;
72    
73          if ((fp = fopen(ARTICLE_BLOCK_SHM_FILE, "w")) == NULL)          if ((fp = fopen(ARTICLE_BLOCK_SHM_FILE, "w")) == NULL)
74          {          {
# Line 562  int main(int argc, char *argv[]) Line 554  int main(int argc, char *argv[])
554                                  (p_section[i]->visible_article_count % BBS_article_limit_per_page ? 1 : 0) !=                                  (p_section[i]->visible_article_count % BBS_article_limit_per_page ? 1 : 0) !=
555                          p_section[i]->page_count)                          p_section[i]->page_count)
556                  {                  {
557                          printf("Inconsistent page count in section %d offset %d, %d != %d, "                          printf("#1 Inconsistent page count in section %d offset %d, %d != %d, "
558                                     "visible_article_count = %d, last_page_visible_count = %d\n",                                     "visible_article_count = %d, last_page_visible_count = %d\n",
559                                     i, j,                                     i, j,
560                                     p_section[i]->visible_article_count / BBS_article_limit_per_page +                                     p_section[i]->visible_article_count / BBS_article_limit_per_page +
# Line 645  int main(int argc, char *argv[]) Line 637  int main(int argc, char *argv[])
637                                  (p_section[i]->visible_article_count % BBS_article_limit_per_page ? 1 : 0) !=                                  (p_section[i]->visible_article_count % BBS_article_limit_per_page ? 1 : 0) !=
638                          p_section[i]->page_count)                          p_section[i]->page_count)
639                  {                  {
640                          printf("Inconsistent page count in section %d offset %d, %d != %d, "                          printf("#2 Inconsistent page count in section %d offset %d, %d != %d, "
641                                     "visible_article_count = %d, last_page_visible_count = %d\n",                                     "visible_article_count = %d, last_page_visible_count = %d\n",
642                                     i, j,                                     i, j,
643                                     p_section[i]->visible_article_count / BBS_article_limit_per_page +                                     p_section[i]->visible_article_count / BBS_article_limit_per_page +
# Line 714  int main(int argc, char *argv[]) Line 706  int main(int argc, char *argv[])
706                                  (p_section[i]->visible_article_count % BBS_article_limit_per_page ? 1 : 0) !=                                  (p_section[i]->visible_article_count % BBS_article_limit_per_page ? 1 : 0) !=
707                          p_section[i]->page_count)                          p_section[i]->page_count)
708                  {                  {
709                          printf("Inconsistent page count in section %d offset %d, %d != %d, "                          printf("#3 Inconsistent page count in section %d offset %d, %d != %d, "
710                                     "visible_article_count = %d, last_page_visible_count = %d\n",                                     "visible_article_count = %d, last_page_visible_count = %d\n",
711                                     i, j,                                     i, j,
712                                     p_section[i]->visible_article_count / BBS_article_limit_per_page +                                     p_section[i]->visible_article_count / BBS_article_limit_per_page +


Legend:
Removed lines/characters  
Changed lines/characters
  Added lines/characters

webmaster@leafok.com
ViewVC Help
Powered by ViewVC 1.3.0-beta1