Browse Source

Merge #10278: [test] Add Unit Test for GetListenPort

1b14449 [test] Add Unit Test for GetListenPort (Jimmy Song)

Tree-SHA512: aea5f60fb3699680cc5acac9d9c8d8712634db9d629bbfa1815a29e5cf46c22f783886c608664baaa91b3282c52ce8069c358850cf4f90acf731a9e6c1701caa
0.15
Wladimir J. van der Laan 8 years ago
parent
commit
8254a8ae21
No known key found for this signature in database
GPG Key ID: 74810B012346C9A6
  1. 13
      src/test/net_tests.cpp

13
src/test/net_tests.cpp

@ -11,6 +11,7 @@ @@ -11,6 +11,7 @@
#include "net.h"
#include "netbase.h"
#include "chainparams.h"
#include "util.h"
class CAddrManSerializationMock : public CAddrMan
{
@ -72,6 +73,18 @@ CDataStream AddrmanToStream(CAddrManSerializationMock& _addrman) @@ -72,6 +73,18 @@ CDataStream AddrmanToStream(CAddrManSerializationMock& _addrman)
BOOST_FIXTURE_TEST_SUITE(net_tests, BasicTestingSetup)
BOOST_AUTO_TEST_CASE(cnode_listen_port)
{
// test default
unsigned short port = GetListenPort();
BOOST_CHECK(port == Params().GetDefaultPort());
// test set port
unsigned short altPort = 12345;
SoftSetArg("-port", std::to_string(altPort));
port = GetListenPort();
BOOST_CHECK(port == altPort);
}
BOOST_AUTO_TEST_CASE(caddrdb_read)
{
CAddrManUncorrupted addrmanUncorrupted;

Loading…
Cancel
Save