- Timestamp:
- 2008-06-21T23:51:18Z (16 years ago)
- Branches:
- master
- Children:
- 424e663
- Parents:
- 3e6764a
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tests/check_jabber_util.c
r3e6764a r98de2cc 11 11 static void check_buddy_add(int l) 12 12 { 13 struct jabber_buddy *budw1, *budw2, *budw3, *budw4, *budn; 14 int i; 13 struct jabber_buddy *budw1, *budw2, *budw3, *budn, *bud; 15 14 16 15 budw1 = jabber_buddy_add( ic, "wilmer@gaast.net/BitlBee" ); 17 16 budw1->last_act = time( NULL ) - 100; 18 budw2 = jabber_buddy_add( ic, " wilmer@gaast.net/Telepathy" );17 budw2 = jabber_buddy_add( ic, "WILMER@gaast.net/Telepathy" ); 19 18 budw2->priority = 2; 20 19 budw2->last_act = time( NULL ); 21 budw3 = jabber_buddy_add( ic, "wilmer@ gaast.net/Druif" );20 budw3 = jabber_buddy_add( ic, "wilmer@GAAST.NET/bitlbee" ); 22 21 budw3->last_act = time( NULL ) - 200; 23 22 budw3->priority = 4; 24 23 /* TODO(wilmer): Shouldn't this just return budw3? */ 25 fail_if( jabber_buddy_add( ic, "wilmer@gaast.net/ druif" ) != NULL );24 fail_if( jabber_buddy_add( ic, "wilmer@gaast.net/Telepathy" ) != NULL ); 26 25 27 26 budn = jabber_buddy_add( ic, "nekkid@lamejab.net" ); … … 29 28 fail_if( jabber_buddy_add( ic, "nekkid@lamejab.net/Illegal" ) ); 30 29 30 /* Case sensitivity: Case only matters after the / */ 31 fail_if( jabber_buddy_by_jid( ic, "wilmer@gaast.net/BitlBee", 0 ) == 32 jabber_buddy_by_jid( ic, "wilmer@gaast.net/bitlbee", 0 ) ); 33 fail_if( jabber_buddy_by_jid( ic, "wilmer@gaast.net/telepathy", 0 ) ); 34 31 35 fail_unless( jabber_buddy_by_jid( ic, "wilmer@gaast.net/BitlBee", 0 ) == budw1 ); 32 fail_unless( jabber_buddy_by_jid( ic, " wilmer@gaast.net/bitlbee", GET_BUDDY_EXACT ) == budw1 );33 fail_unless( jabber_buddy_by_jid( ic, "wilmer@ gaast.net/BitlBee", GET_BUDDY_CREAT ) == budw1 );36 fail_unless( jabber_buddy_by_jid( ic, "WILMER@GAAST.NET/BitlBee", GET_BUDDY_EXACT ) == budw1 ); 37 fail_unless( jabber_buddy_by_jid( ic, "wilmer@GAAST.NET/BitlBee", GET_BUDDY_CREAT ) == budw1 ); 34 38 35 39 fail_if( jabber_buddy_by_jid( ic, "wilmer@gaast.net", GET_BUDDY_EXACT ) ); 36 fail_unless( jabber_buddy_by_jid( ic, "wilmer@gaast.net", GET_BUDDY_FIRST ) == budw1 ); 37 fail_unless( jabber_buddy_by_jid( ic, "wilmer@gaast.net", 0 ) == budw3 ); 40 fail_unless( jabber_buddy_by_jid( ic, "WILMER@gaast.net", 0 ) == budw3 ); 41 42 /* Check O_FIRST and see if it's indeed the first item from the list. */ 43 fail_unless( ( bud = jabber_buddy_by_jid( ic, "wilmer@gaast.net", GET_BUDDY_FIRST ) ) == budw1 ); 44 fail_unless( bud->next == budw2 && bud->next->next == budw3 && bud->next->next->next == NULL ); 38 45 46 /* Change the resource_select setting, now we should get a different resource. */ 39 47 set_setstr( &ic->acc->set, "resource_select", "activity" ); 40 fail_unless( jabber_buddy_by_jid( ic, "wilmer@ gaast.net", 0 ) == budw2 );48 fail_unless( jabber_buddy_by_jid( ic, "wilmer@GAAST.NET", 0 ) == budw2 ); 41 49 50 /* Some testing of bare JID handling (which is horrible). */ 42 51 fail_if( jabber_buddy_by_jid( ic, "nekkid@lamejab.net/Illegal", 0 ) ); 43 fail_if( jabber_buddy_by_jid( ic, " nekkid@lamejab.net/Illegal", GET_BUDDY_CREAT ) );52 fail_if( jabber_buddy_by_jid( ic, "NEKKID@LAMEJAB.NET/Illegal", GET_BUDDY_CREAT ) ); 44 53 fail_unless( jabber_buddy_by_jid( ic, "nekkid@lamejab.net", 0 ) == budn ); 45 fail_unless( jabber_buddy_by_jid( ic, " nekkid@lamejab.net", GET_BUDDY_EXACT ) == budn );46 fail_unless( jabber_buddy_by_jid( ic, "nekkid@ lamejab.net", GET_BUDDY_CREAT ) == budn );54 fail_unless( jabber_buddy_by_jid( ic, "NEKKID@lamejab.net", GET_BUDDY_EXACT ) == budn ); 55 fail_unless( jabber_buddy_by_jid( ic, "nekkid@LAMEJAB.NET", GET_BUDDY_CREAT ) == budn ); 47 56 48 jabber_buddy_remove( ic, "wilmer@gaast.net/telepathy" ); 57 /* More case sensitivity testing, and see if remove works properly. */ 58 fail_if( jabber_buddy_remove( ic, "wilmer@gaast.net/telepathy" ) ); 59 fail_if( jabber_buddy_by_jid( ic, "wilmer@GAAST.NET/telepathy", GET_BUDDY_CREAT ) == budw2 ); 60 fail_unless( jabber_buddy_remove( ic, "wilmer@gaast.net/Telepathy" ) ); 61 fail_unless( jabber_buddy_remove( ic, "wilmer@gaast.net/telepathy" ) ); 49 62 fail_unless( jabber_buddy_by_jid( ic, "wilmer@gaast.net", 0 ) == budw1 ); 50 63 … … 52 65 fail_unless( jabber_buddy_by_jid( ic, "wilmer@gaast.net", 0 ) == budw1 ); 53 66 67 /* Check if remove_bare() indeed gets rid of all. */ 54 68 fail_unless( jabber_buddy_remove_bare( ic, "wilmer@gaast.net" ) ); 55 69 fail_if( jabber_buddy_by_jid( ic, "wilmer@gaast.net", 0 ) );
Note: See TracChangeset
for help on using the changeset viewer.