mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-11 12:22:39 -03:00
Declare TorReply parsing functions in torcontrol_tests
Rather than including the implementation file into the test, which is bad practice.
This commit is contained in:
parent
d82c5d15c5
commit
97c112d4ca
2 changed files with 11 additions and 4 deletions
|
@ -3,10 +3,18 @@
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
//
|
//
|
||||||
#include <test/test_bitcoin.h>
|
#include <test/test_bitcoin.h>
|
||||||
#include <torcontrol.cpp>
|
#include <torcontrol.h>
|
||||||
|
|
||||||
#include <boost/test/unit_test.hpp>
|
#include <boost/test/unit_test.hpp>
|
||||||
|
|
||||||
|
#include <map>
|
||||||
|
#include <string>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
|
|
||||||
|
std::pair<std::string, std::string> SplitTorReplyLine(const std::string& s);
|
||||||
|
std::map<std::string, std::string> ParseTorReplyMapping(const std::string& s);
|
||||||
|
|
||||||
|
|
||||||
BOOST_FIXTURE_TEST_SUITE(torcontrol_tests, BasicTestingSetup)
|
BOOST_FIXTURE_TEST_SUITE(torcontrol_tests, BasicTestingSetup)
|
||||||
|
|
||||||
|
|
|
@ -251,7 +251,7 @@ bool TorControlConnection::Command(const std::string &cmd, const ReplyHandlerCB&
|
||||||
* Grammar is implicitly defined in https://spec.torproject.org/control-spec by
|
* Grammar is implicitly defined in https://spec.torproject.org/control-spec by
|
||||||
* the server reply formats for PROTOCOLINFO (S3.21) and AUTHCHALLENGE (S3.24).
|
* the server reply formats for PROTOCOLINFO (S3.21) and AUTHCHALLENGE (S3.24).
|
||||||
*/
|
*/
|
||||||
static std::pair<std::string,std::string> SplitTorReplyLine(const std::string &s)
|
std::pair<std::string,std::string> SplitTorReplyLine(const std::string &s)
|
||||||
{
|
{
|
||||||
size_t ptr=0;
|
size_t ptr=0;
|
||||||
std::string type;
|
std::string type;
|
||||||
|
@ -270,7 +270,7 @@ static std::pair<std::string,std::string> SplitTorReplyLine(const std::string &s
|
||||||
* the server reply formats for PROTOCOLINFO (S3.21), AUTHCHALLENGE (S3.24),
|
* the server reply formats for PROTOCOLINFO (S3.21), AUTHCHALLENGE (S3.24),
|
||||||
* and ADD_ONION (S3.27). See also sections 2.1 and 2.3.
|
* and ADD_ONION (S3.27). See also sections 2.1 and 2.3.
|
||||||
*/
|
*/
|
||||||
static std::map<std::string,std::string> ParseTorReplyMapping(const std::string &s)
|
std::map<std::string,std::string> ParseTorReplyMapping(const std::string &s)
|
||||||
{
|
{
|
||||||
std::map<std::string,std::string> mapping;
|
std::map<std::string,std::string> mapping;
|
||||||
size_t ptr=0;
|
size_t ptr=0;
|
||||||
|
@ -773,4 +773,3 @@ void StopTorControl()
|
||||||
gBase = nullptr;
|
gBase = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue