source: trunk/libtransmission/history-test.c @ 13442

Last change on this file since 13442 was 13442, checked in by jordan, 9 years ago

(trunk, libtransmission) #4934 "Create a test harness and use it for current tests" -- patch by gvdl

File size: 770 bytes
Line 
1#include <stdio.h>
2#include <string.h> /* memset() */
3
4#include "transmission.h"
5#include "history.h"
6
7#undef VERBOSE
8#include "libtransmission-test.h"
9
10static int
11test1( void )
12{
13    tr_recentHistory h;
14
15    memset( &h, 0, sizeof( tr_recentHistory ) );
16
17    tr_historyAdd( &h, 10000, 1 );
18    check( (int)tr_historyGet( &h, 12000, 1000 ) == 0 );
19    check( (int)tr_historyGet( &h, 12000, 3000 ) == 1 );
20    check( (int)tr_historyGet( &h, 12000, 5000 ) == 1 );
21    tr_historyAdd( &h, 20000, 1 );
22    check( (int)tr_historyGet( &h, 22000,  1000 ) == 0 );
23    check( (int)tr_historyGet( &h, 22000,  3000 ) == 1 );
24    check( (int)tr_historyGet( &h, 22000, 15000 ) == 2 );
25    check( (int)tr_historyGet( &h, 22000, 20000 ) == 2 );
26
27    return 0;
28}
29
30MAIN_SINGLE_TEST(test1)
Note: See TracBrowser for help on using the repository browser.