/[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.1 - (hide annotations)
Sat Jun 7 07:59:38 2025 UTC (9 months, 1 week ago) by sysadm
Branch: MAIN
Content type: text/x-csrc
Add article_view_log

1 sysadm 1.1 /***************************************************************************
2     test_article_view_log.c - description
3     -------------------
4     Copyright : (C) 2004-2025 by Leaflet
5     Email : leaflet@leafok.com
6     ***************************************************************************/
7    
8     /***************************************************************************
9     * *
10     * This program is free software; you can redistribute it and/or modify *
11     * it under the terms of the GNU General Public License as published by *
12     * the Free Software Foundation; either version 3 of the License, or *
13     * (at your option) any later version. *
14     * *
15     ***************************************************************************/
16    
17     #include "article_view_log.h"
18     #include <stdio.h>
19    
20     int main(int argc, char *argv[])
21     {
22     ARTICLE_VIEW_LOG view_log;
23     int32_t aid;
24     int i;
25    
26     view_log.aid_base = NULL;
27     view_log.aid_base_cnt = 0;
28     view_log.aid_inc_cnt = 0;
29    
30     for (i = MAX_AID_INC_CNT * 3; i > 0; i--)
31     {
32     if (i % MAX_AID_INC_CNT == 0 || i % MAX_AID_INC_CNT == MAX_AID_INC_CNT / 2)
33     {
34     printf("Base cnt = %d, Inc cnt = %d\n", view_log.aid_base_cnt, view_log.aid_inc_cnt);
35     }
36    
37     aid = i * 5 + 7;
38     if (article_view_log_is_viewed(aid, &view_log) != 0)
39     {
40     printf("article_view_log_is_viewed(%d) != 0\n", aid);
41     break;
42     }
43     if (article_view_log_set_viewed(aid, &view_log) != 1)
44     {
45     printf("article_view_log_set_viewed(%d) != 1\n", aid);
46     break;
47     }
48     }
49    
50     printf("Base cnt = %d, Inc cnt = %d\n", view_log.aid_base_cnt, view_log.aid_inc_cnt);
51    
52     return 0;
53     }

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