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

Contents of /lbbs/src/test_article_view_log.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.7 - (show annotations)
Sat Jan 3 10:27:14 2026 UTC (2 months, 1 week ago) by sysadm
Branch: MAIN
CVS Tags: HEAD
Changes since 1.6: +1 -1 lines
Content type: text/x-csrc
Update copyright info

1 /* 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-2026 Leaflet <leaflet@leafok.com>
7 */
8
9 #ifdef HAVE_CONFIG_H
10 #include "config.h"
11 #endif
12
13 #include "article_view_log.h"
14 #include <stdio.h>
15
16 int main(int argc, char *argv[])
17 {
18 ARTICLE_VIEW_LOG view_log;
19 int32_t aid;
20 int i;
21
22 article_view_log_load(0, &view_log, 0);
23
24 for (i = MAX_VIEWED_AID_INC_CNT * 3; i > 0; i--)
25 {
26 if (i % MAX_VIEWED_AID_INC_CNT == 0 || i % MAX_VIEWED_AID_INC_CNT == MAX_VIEWED_AID_INC_CNT / 2)
27 {
28 printf("Base cnt = %d, Inc cnt = %d\n", view_log.aid_base_cnt, view_log.aid_inc_cnt);
29 }
30
31 aid = i * 5 + 7;
32 if (article_view_log_is_viewed(aid, &view_log) != 0)
33 {
34 printf("article_view_log_is_viewed(%d) != 0\n", aid);
35 break;
36 }
37 if (article_view_log_set_viewed(aid, &view_log) != 1)
38 {
39 printf("article_view_log_set_viewed(%d) != 1\n", aid);
40 break;
41 }
42 }
43
44 printf("Base cnt = %d, Inc cnt = %d\n", view_log.aid_base_cnt, view_log.aid_inc_cnt);
45
46 article_view_log_unload(&view_log);
47
48 return 0;
49 }

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