test: tests for magnet links with bad/junk values (#2483)

Co-authored-by: Srinidhi Kaushik <shrinidhi.kaushik@gmail.com>
This commit is contained in:
Charles Kerr 2022-01-23 13:01:48 -06:00 committed by GitHub
parent c5bc3091cc
commit 85566c372e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 22 additions and 1 deletions

View File

@ -30,6 +30,27 @@ TEST(MagnetMetainfo, magnetParse)
"&tr=http%3A%2F%2Ftracker.opentracker.org%2Fannounce"
"&ws=http%3A%2F%2Fserver.webseed.org%2Fpath%2Fto%2Ffile"sv;
auto constexpr UriHexWithEmptyValue =
"magnet:?xt=urn:btih:"
"d2354010a3ca4ade5b7427bb093a62a3899ff381"
"&empty"
"&dn=Display%20Name"
"&tr=http%3A%2F%2Ftracker.openbittorrent.com%2Fannounce"
"&tr=http%3A%2F%2Ftracker.opentracker.org%2Fannounce"
"&ws=http%3A%2F%2Fserver.webseed.org%2Fpath%2Fto%2Ffile"sv;
auto constexpr UriHexWithJunkValues =
"magnet:?xt=urn:btih:"
"d2354010a3ca4ade5b7427bb093a62a3899ff381"
"&empty"
"&empty_again"
"&dn=Display%20Name"
"&tr=http%3A%2F%2Ftracker.openbittorrent.com%2Fannounce"
"&empty_again"
"&="
"&ws=http%3A%2F%2Fserver.webseed.org%2Fpath%2Fto%2Ffile"
"&tr=http%3A%2F%2Ftracker.opentracker.org%2Fannounce"sv;
auto constexpr UriBase32 =
"magnet:?xt=urn:btih:"
"2I2UAEFDZJFN4W3UE65QSOTCUOEZ744B"
@ -38,7 +59,7 @@ TEST(MagnetMetainfo, magnetParse)
"&ws=http%3A%2F%2Fserver.webseed.org%2Fpath%2Fto%2Ffile"
"&tr=http%3A%2F%2Ftracker.opentracker.org%2Fannounce"sv;
for (auto const& uri : { UriHex, UriBase32 })
for (auto const& uri : { UriHex, UriHexWithEmptyValue, UriHexWithJunkValues, UriBase32 })
{
auto mm = tr_magnet_metainfo{};