1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-29 02:56:11 +00:00
transmission/tests/libtransmission/peer-msgs-test.cc
Charles Kerr d09aba0e6a
refactor: remove tr_address_from_string() (#3524)
use tr_address::fromString() instead

* refactor: use tr_address.isIPv4()
2022-07-25 17:25:55 -05:00

38 lines
1 KiB
C++

// This file Copyright (C) 2013-2022 Mnemosyne LLC.
// It may be used under GPLv2 (SPDX: GPL-2.0), GPLv3 (SPDX: GPL-3.0),
// or any future license endorsed by Mnemosyne LLC.
// License text can be found in the licenses/ folder.
#include "transmission.h"
#include "peer-msgs.h"
#include "utils.h"
#include "gtest/gtest.h"
TEST(PeerMsgs, placeholder)
{
#if 0
auto infohash = tr_sha1_digest_t{};
tr_piece_index_t pieceCount = 1313;
size_t numwant;
size_t numgot;
tr_piece_index_t pieces[] = { 1059, 431, 808, 1217, 287, 376, 1188, 353, 508 };
tr_piece_index_t buf[16];
memset(std::data(infohash), 0xaa, std::size(infohash));
auto const addr = tr_address::fromString("80.4.4.200");
numwant = 7;
numgot = tr_generateAllowedSet(buf, numwant, pieceCount, infohash, &addr);
check_uint(numgot, ==, numwant);
check_mem(buf, ==, pieces, numgot);
numwant = 9;
numgot = tr_generateAllowedSet(buf, numwant, pieceCount, infohash, &addr);
check_uint(numgot, ==, numwant);
check_mem(buf, ==, pieces, numgot);
#endif
}