/[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.10 by sysadm, Thu May 22 11:10:19 2025 UTC Revision 1.11 by sysadm, Thu May 22 14:12:33 2025 UTC
# Line 346  int main(int argc, char *argv[]) Line 346  int main(int argc, char *argv[])
346    
347          printf("Testing #4 ...\n");          printf("Testing #4 ...\n");
348    
349          for (i = 0; i < BBS_max_section; i++)          for (i = 0; i < section_count; i++)
350          {          {
351                  step = i % 10 + 1;                  step = i % 10 + 1;
352                  for (j = group_count; j < BBS_article_limit_per_section; j += step)                  for (j = group_count; j < BBS_article_limit_per_section; j += step)
# Line 367  int main(int argc, char *argv[]) Line 367  int main(int argc, char *argv[])
367                                  break;                                  break;
368                          }                          }
369    
                         if (page * BBS_article_limit_per_page + offset != j)  
                         {  
                                 printf("Inconsistent article offset %d in section %d page %d offset %d\n", j, i, page, offset);  
                                 break;  
                         }  
   
370                          if (section_list_set_article_visible(p_section[i], last_aid, 0) != 1)                          if (section_list_set_article_visible(p_section[i], last_aid, 0) != 1)
371                          {                          {
372                                  printf("Error set article %d invisible in section %d offset %d\n", last_aid, i, j);                                  printf("Error set article %d invisible in section %d offset %d\n", last_aid, i, j);
# Line 380  int main(int argc, char *argv[]) Line 374  int main(int argc, char *argv[])
374                          }                          }
375                  }                  }
376    
377                    last_aid = p_section[i]->p_article_head->aid;
378                    if (section_list_calculate_page(p_section[i], last_aid) < 0)
379                    {
380                            printf("section_list_calculate_page(aid = %d) error in section %d offset %d\n", last_aid, i, j);
381                            break;
382                    }
383    
384                    if (p_section[i]->visible_article_count / BBS_article_limit_per_page +
385                                    (p_section[i]->visible_article_count % BBS_article_limit_per_page ? 1 : 0) !=
386                            p_section[i]->page_count)
387                    {
388                            printf("Inconsistent page count in section %d offset %d, %d != %d, "
389                                       "visible_article_count = %d, last_page_visible_count = %d\n",
390                                       i, j,
391                                       p_section[i]->visible_article_count / BBS_article_limit_per_page +
392                                               (p_section[i]->visible_article_count % BBS_article_limit_per_page ? 1 : 0),
393                                       p_section[i]->page_count, p_section[i]->visible_article_count,
394                                       p_section[i]->last_page_visible_article_count);
395                            break;
396                    }
397    
398                  affected_count = (BBS_article_limit_per_section - group_count) / step + ((BBS_article_limit_per_section - group_count) % step ? 1 : 0);                  affected_count = (BBS_article_limit_per_section - group_count) / step + ((BBS_article_limit_per_section - group_count) % step ? 1 : 0);
399                  if (p_section[i]->article_count - p_section[i]->visible_article_count != affected_count)                  if (p_section[i]->article_count - p_section[i]->visible_article_count != affected_count)
400                  {                  {


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

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