2014-01-19 01:09:44 +00:00
|
|
|
/*
|
|
|
|
* This file Copyright (C) 2013-2014 Mnemosyne LLC
|
|
|
|
*
|
|
|
|
* It may be used under the GNU Public License v2 or v3 licenses,
|
|
|
|
* or any future license endorsed by Mnemosyne LLC.
|
|
|
|
*
|
|
|
|
* $Id:$
|
|
|
|
*/
|
|
|
|
|
2012-10-14 18:02:47 +00:00
|
|
|
#include "transmission.h"
|
|
|
|
|
|
|
|
#include "libtransmission-test.h"
|
|
|
|
|
|
|
|
static int
|
2012-12-05 17:29:46 +00:00
|
|
|
test1 (void)
|
2012-10-14 18:02:47 +00:00
|
|
|
{
|
|
|
|
tr_info inf;
|
|
|
|
tr_ctor * ctor;
|
|
|
|
const char * magnet_link;
|
|
|
|
tr_parse_result parse_result;
|
|
|
|
|
|
|
|
/* background info @ http://wiki.theory.org/BitTorrent_Magnet-URI_Webseeding */
|
|
|
|
magnet_link = "magnet:?"
|
|
|
|
"xt=urn:btih:14FFE5DD23188FD5CB53A1D47F1289DB70ABF31E"
|
|
|
|
"&dn=ubuntu+12+04+1+desktop+32+bit"
|
|
|
|
"&tr=http%3A%2F%2Ftracker.publicbt.com%2Fannounce"
|
|
|
|
"&tr=udp%3A%2F%2Ftracker.publicbt.com%3A80"
|
|
|
|
"&ws=http://transmissionbt.com ";
|
|
|
|
ctor = tr_ctorNew (NULL);
|
|
|
|
tr_ctorSetMetainfoFromMagnetLink (ctor, magnet_link);
|
|
|
|
parse_result = tr_torrentParse (ctor, &inf);
|
|
|
|
check_int_eq (inf.fileCount, 0); /* cos it's a magnet link */
|
|
|
|
check_int_eq (parse_result, TR_PARSE_OK);
|
|
|
|
check_int_eq (inf.trackerCount, 2);
|
|
|
|
check_streq ("http://tracker.publicbt.com/announce", inf.trackers[0].announce);
|
|
|
|
check_streq ("udp://tracker.publicbt.com:80", inf.trackers[1].announce);
|
|
|
|
check_int_eq (inf.webseedCount, 1);
|
|
|
|
check_streq ("http://transmissionbt.com", inf.webseeds[0]);
|
|
|
|
|
|
|
|
/* cleanup */
|
|
|
|
tr_metainfoFree (&inf);
|
|
|
|
tr_ctorFree (ctor);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2012-12-05 17:29:46 +00:00
|
|
|
MAIN_SINGLE_TEST (test1)
|