2323#include < kj/test.h>
2424#include < stdexcept>
2525
26- #include < boost/test/unit_test.hpp>
27-
26+ #include < test/util/framework.hpp>
2827static_assert (ipc::capnp::messages::MAX_MONEY == MAX_MONEY );
2928static_assert (ipc::capnp::messages::MAX_DOUBLE == std::numeric_limits<double >::max());
3029static_assert (ipc::capnp::messages::DEFAULT_BLOCK_RESERVED_WEIGHT == DEFAULT_BLOCK_RESERVED_WEIGHT );
@@ -47,8 +46,8 @@ static std::string TempPath(std::string_view pattern)
4746 std::string temp{fs::PathToString (fs::path{fs::temp_directory_path ()} / fs::PathFromString (std::string{pattern}))};
4847 temp.push_back (' \0 ' );
4948 int fd{mkstemp (temp.data ())};
50- BOOST_CHECK_GE (fd, 0 );
51- BOOST_CHECK_EQUAL (close (fd), 0 );
49+ CHECK (fd >= 0 );
50+ CHECK (close (fd) == 0 );
5251 temp.resize (temp.size () - 1 );
5352 fs::remove (fs::PathFromString (temp));
5453 return temp;
@@ -87,17 +86,17 @@ void IpcPipeTest()
8786 std::unique_ptr<mp::ProxyClient<gen::FooInterface>> foo{foo_promise.get_future ().get ()};
8887
8988 // Test: make sure arguments were sent and return value is received
90- BOOST_CHECK_EQUAL (foo->add (1 , 2 ), 3 );
89+ CHECK (foo->add (1 , 2 ) == 3 );
9190
9291 COutPoint txout1{Txid::FromUint256 (uint256{100 }), 200 };
9392 COutPoint txout2{foo->passOutPoint (txout1)};
94- BOOST_CHECK ( txout1 == txout2);
93+ CHECK (( txout1 == txout2) );
9594
9695 UniValue uni1{UniValue::VOBJ };
9796 uni1.pushKV (" i" , 1 );
9897 uni1.pushKV (" s" , " two" );
9998 UniValue uni2{foo->passUniValue (uni1)};
100- BOOST_CHECK_EQUAL (uni1.write (), uni2.write ());
99+ CHECK (uni1.write () == uni2.write ());
101100
102101 CMutableTransaction mtx;
103102 mtx.version = 2 ;
@@ -106,15 +105,15 @@ void IpcPipeTest()
106105 mtx.vout .emplace_back (COIN , CScript ());
107106 CTransactionRef tx1{MakeTransactionRef (mtx)};
108107 CTransactionRef tx2{foo->passTransaction (tx1)};
109- BOOST_CHECK ( *Assert (tx1) == *Assert (tx2));
108+ CHECK (( *Assert (tx1) == *Assert (tx2) ));
110109
111110 std::vector<char > vec1{' H' , ' e' , ' l' , ' l' , ' o' };
112111 std::vector<char > vec2{foo->passVectorChar (vec1)};
113- BOOST_CHECK_EQUAL (std::string_view (vec1.begin (), vec1.end ()), std::string_view (vec2.begin (), vec2.end ()));
112+ CHECK (std::string_view (vec1.begin (), vec1.end ()) == std::string_view (vec2.begin (), vec2.end ()));
114113
115114 auto script1{CScript () << OP_11 };
116115 auto script2{foo->passScript (script1)};
117- BOOST_CHECK_EQUAL (HexStr (script1), HexStr (script2));
116+ CHECK (HexStr (script1) == HexStr (script2));
118117
119118 // Test cleanup: disconnect and join thread
120119 foo.reset ();
@@ -125,7 +124,7 @@ void IpcPipeTest()
125124void IpcSocketPairTest ()
126125{
127126 int fds[2 ];
128- BOOST_CHECK_EQUAL (socketpair (AF_UNIX , SOCK_STREAM , 0 , fds), 0 );
127+ CHECK (socketpair (AF_UNIX , SOCK_STREAM , 0 , fds) == 0 );
129128 std::unique_ptr<interfaces::Init> init{std::make_unique<TestInit>()};
130129 std::unique_ptr<ipc::Protocol> protocol{ipc::capnp::MakeCapnpProtocol ()};
131130 std::promise<void > promise;
@@ -135,10 +134,10 @@ void IpcSocketPairTest()
135134 promise.get_future ().wait ();
136135 std::unique_ptr<interfaces::Init> remote_init{protocol->connect (fds[1 ], " test-connect" )};
137136 std::unique_ptr<interfaces::Echo> remote_echo{remote_init->makeEcho ()};
138- BOOST_CHECK_EQUAL (remote_echo->echo (" echo test" ), " echo test" );
137+ CHECK (remote_echo->echo (" echo test" ) == " echo test" );
139138 remote_echo.reset ();
140139 remote_init->stop ();
141- BOOST_CHECK (static_cast <TestInit*>(init.get ())->stop_called .load ());
140+ CHECK (static_cast <TestInit*>(init.get ())->stop_called .load ());
142141 remote_init.reset ();
143142 thread.join ();
144143}
@@ -151,24 +150,24 @@ void IpcSocketTest(const fs::path& datadir)
151150 std::unique_ptr<ipc::Process> process{ipc::MakeProcess ()};
152151
153152 std::string invalid_bind{" invalid:" };
154- BOOST_CHECK_THROW (process->bind (datadir, " test_bitcoin" , invalid_bind), std::invalid_argument);
155- BOOST_CHECK_THROW (process->connect (datadir, " test_bitcoin" , invalid_bind), std::invalid_argument);
153+ CHECK_THROWS_AS (process->bind (datadir, " test_bitcoin" , invalid_bind), std::invalid_argument);
154+ CHECK_THROWS_AS (process->connect (datadir, " test_bitcoin" , invalid_bind), std::invalid_argument);
156155
157156 auto bind_and_listen{[&](const std::string& bind_address) {
158157 std::string address{bind_address};
159158 int serve_fd = process->bind (datadir, " test_bitcoin" , address);
160- BOOST_CHECK_GE (serve_fd, 0 );
161- BOOST_CHECK_EQUAL (address, bind_address);
159+ CHECK (serve_fd >= 0 );
160+ CHECK (address == bind_address);
162161 protocol->listen (serve_fd, " test-serve" , *init);
163162 }};
164163
165164 auto connect_and_test{[&](const std::string& connect_address) {
166165 std::string address{connect_address};
167166 int connect_fd{process->connect (datadir, " test_bitcoin" , address)};
168- BOOST_CHECK_EQUAL (address, connect_address);
167+ CHECK (address == connect_address);
169168 std::unique_ptr<interfaces::Init> remote_init{protocol->connect (connect_fd, " test-connect" )};
170169 std::unique_ptr<interfaces::Echo> remote_echo{remote_init->makeEcho ()};
171- BOOST_CHECK_EQUAL (remote_echo->echo (" echo test" ), " echo test" );
170+ CHECK (remote_echo->echo (" echo test" ) == " echo test" );
172171 }};
173172
174173 // Need to specify explicit socket addresses outside the data directory, because the data
0 commit comments