source: trunk/libtransmission/history-test.c

Last change on this file was 14241, checked in by jordan, 7 years ago

Copyedit the license's revised text: (1) remove unnecessary repitition use of the word 'license' from the top of the header and source files (2) add the standard 'we hope it's useful, but no warranty' clause to COPYING (3) make explicit that linking OpenSSL is allowed (see https://people.gnome.org/~markmc/openssl-and-the-gpl.html for background) (4) sync the Qt and GTK+ clients' license popups with COPYING's revised text

  • Property svn:keywords set to Date Rev Author Id
File size: 931 bytes
Line 
1/*
2 * This file Copyright (C) 2013-2014 Mnemosyne LLC
3 *
4 * It may be used under the GNU GPL versions 2 or 3
5 * or any future license endorsed by Mnemosyne LLC.
6 *
7 * $Id: history-test.c 14241 2014-01-21 03:10:30Z mikedld $
8 */
9
10#include <string.h> /* memset () */
11
12#include "transmission.h"
13#include "history.h"
14
15#include "libtransmission-test.h"
16
17static int
18test1 (void)
19{
20    tr_recentHistory h;
21
22    memset (&h, 0, sizeof (tr_recentHistory));
23
24    tr_historyAdd (&h, 10000, 1);
25    check_int_eq (0, (int)tr_historyGet (&h, 12000, 1000));
26    check_int_eq (1, (int)tr_historyGet (&h, 12000, 3000));
27    check_int_eq (1, (int)tr_historyGet (&h, 12000, 5000));
28    tr_historyAdd (&h, 20000, 1);
29    check_int_eq (0, (int)tr_historyGet (&h, 22000,  1000));
30    check_int_eq (1, (int)tr_historyGet (&h, 22000,  3000));
31    check_int_eq (2, (int)tr_historyGet (&h, 22000, 15000));
32    check_int_eq (2, (int)tr_historyGet (&h, 22000, 20000));
33
34    return 0;
35}
36
37MAIN_SINGLE_TEST (test1)
Note: See TracBrowser for help on using the repository browser.