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

Last change on this file since 13569 was 13569, checked in by jordan, 10 years ago

retrofit some of the tests to use the more expressive test API

File size: 805 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_eq( 0, (int)tr_historyGet( &h, 12000, 1000 ) );
19    check_int_eq( 1, (int)tr_historyGet( &h, 12000, 3000 ) );
20    check_int_eq( 1, (int)tr_historyGet( &h, 12000, 5000 ) );
21    tr_historyAdd( &h, 20000, 1 );
22    check_int_eq( 0, (int)tr_historyGet( &h, 22000,  1000 ) );
23    check_int_eq( 1, (int)tr_historyGet( &h, 22000,  3000 ) );
24    check_int_eq( 2, (int)tr_historyGet( &h, 22000, 15000 ) );
25    check_int_eq( 2, (int)tr_historyGet( &h, 22000, 20000 ) );
26
27    return 0;
28}
29
30MAIN_SINGLE_TEST(test1)
Note: See TracBrowser for help on using the repository browser.