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

Annotation of /lbbs/src/test_article_view_log.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.4 - (hide annotations)
Tue Nov 4 13:49:51 2025 UTC (4 months, 1 week ago) by sysadm
Branch: MAIN
Changes since 1.3: +8 -16 lines
Content type: text/x-csrc
Update file header information comments

1 sysadm 1.4 /* SPDX-License-Identifier: GPL-3.0-or-later */
2     /*
3     * test_article_view_log
4     * - tester for data persistence and query of article view log
5     *
6     * Copyright (C) 2004-2025 by Leaflet <leaflet@leafok.com>
7     */
8 sysadm 1.1
9     #include "article_view_log.h"
10     #include <stdio.h>
11    
12     int main(int argc, char *argv[])
13     {
14     ARTICLE_VIEW_LOG view_log;
15     int32_t aid;
16     int i;
17    
18 sysadm 1.2 article_view_log_load(0, &view_log, 0);
19 sysadm 1.1
20 sysadm 1.3 for (i = MAX_VIEWED_AID_INC_CNT * 3; i > 0; i--)
21 sysadm 1.1 {
22 sysadm 1.3 if (i % MAX_VIEWED_AID_INC_CNT == 0 || i % MAX_VIEWED_AID_INC_CNT == MAX_VIEWED_AID_INC_CNT / 2)
23 sysadm 1.1 {
24     printf("Base cnt = %d, Inc cnt = %d\n", view_log.aid_base_cnt, view_log.aid_inc_cnt);
25     }
26    
27     aid = i * 5 + 7;
28     if (article_view_log_is_viewed(aid, &view_log) != 0)
29     {
30     printf("article_view_log_is_viewed(%d) != 0\n", aid);
31     break;
32     }
33     if (article_view_log_set_viewed(aid, &view_log) != 1)
34     {
35     printf("article_view_log_set_viewed(%d) != 1\n", aid);
36     break;
37     }
38     }
39    
40     printf("Base cnt = %d, Inc cnt = %d\n", view_log.aid_base_cnt, view_log.aid_inc_cnt);
41    
42 sysadm 1.2 article_view_log_unload(&view_log);
43 sysadm 1.4
44 sysadm 1.1 return 0;
45     }

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