1#include "transmission.h" 2 3#undef VERBOSE 4#include "libtransmission-test.h" 5 6static int 7test1( void ) 8{ 9 tr_info inf; 10 tr_ctor * ctor; 11 const char * magnet_link; 12 tr_parse_result parse_result; 13 14 /* background info @ http://wiki.theory.org/BitTorrent_Magnet-URI_Webseeding */ 15 magnet_link = "magnet:?" 16 "xt=urn:btih:14FFE5DD23188FD5CB53A1D47F1289DB70ABF31E" 17 "&dn=ubuntu+12+04+1+desktop+32+bit" 18 "&tr=http%3A%2F%2Ftracker.publicbt.com%2Fannounce" 19 "&tr=udp%3A%2F%2Ftracker.publicbt.com%3A80" 20 "&ws=http://transmissionbt.com "; 21 ctor = tr_ctorNew (NULL); 22 tr_ctorSetMetainfoFromMagnetLink (ctor, magnet_link); 23 parse_result = tr_torrentParse (ctor, &inf); 24 check_int_eq (inf.fileCount, 0); /* cos it's a magnet link */ 25 check_int_eq (parse_result, TR_PARSE_OK); 26 check_int_eq (inf.trackerCount, 2); 27 check_streq ("http://tracker.publicbt.com/announce", inf.trackers[0].announce); 28 check_streq ("udp://tracker.publicbt.com:80", inf.trackers[1].announce); 29 check_int_eq (inf.webseedCount, 1); 30 check_streq ("http://transmissionbt.com", inf.webseeds[0]); 31 32 /* cleanup */ 33 tr_metainfoFree (&inf); 34 tr_ctorFree (ctor); 35 return 0; 36} 37 38MAIN_SINGLE_TEST(test1) 39