Skip to content

Commit

Permalink
Merge pull request #99 from bitshares/jmj_1246
Browse files Browse the repository at this point in the history
Fix some compiler warnings
  • Loading branch information
jmjatlanta authored Jan 2, 2019
2 parents 0468884 + 1ed9b4f commit df7b4e6
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion tests/network/http/websocket_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ BOOST_AUTO_TEST_CASE(websocket_test)
server.listen( port );
listen_ok = true;
}
catch( std::exception )
catch( std::exception& ignore )
{
// if the port is busy, listen() will throw a std::exception, do nothing here.
}
Expand Down
2 changes: 1 addition & 1 deletion tests/stacktrace_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ BOOST_AUTO_TEST_CASE(static_variant_depth_test)
int count = 0;
for( const auto& line : lines )
if( line.find("_svdt_visitor") != std::string::npos ) count++;
BOOST_CHECK_LT( 3, count ); // test.visit(), static_variant::visit, function object, visitor
BOOST_CHECK_LT( 2, count ); // test.visit(), static_variant::visit, function object, visitor
BOOST_CHECK_GT( 8, count ); // some is implementation-dependent
}
#endif
Expand Down
24 changes: 12 additions & 12 deletions tests/thread/parallel_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ BOOST_AUTO_TEST_CASE( do_something_parallel )
{ // check that thread_local_storage counter works
std::sort( pair.second.begin(), pair.second.end() );
for( size_t i = 0; i < pair.second.size(); i++ )
BOOST_CHECK_EQUAL( i, pair.second[i] );
BOOST_CHECK_EQUAL( (int64_t)i, pair.second[i] );
}
}

Expand Down Expand Up @@ -205,7 +205,7 @@ BOOST_AUTO_TEST_CASE( serial_valve )
auto p1 = fc::async([&counter,&valve,syncer,waiter] () {
valve.do_serial( [syncer,waiter](){ syncer->set_value();
fc::future<void>( fc::shared_ptr<fc::promise<void>>( waiter, true ) ).wait(); },
[&counter](){ BOOST_CHECK_EQUAL( 0, counter.load() );
[&counter](){ BOOST_CHECK_EQUAL( 0u, counter.load() );
counter.fetch_add(1); } );
});
fc::future<void>( fc::shared_ptr<fc::promise<void>>( syncer, true ) ).wait();
Expand All @@ -215,7 +215,7 @@ BOOST_AUTO_TEST_CASE( serial_valve )
syncer = new fc::promise<void>();
auto p2 = fc::async([&counter,&valve,syncer] () {
valve.do_serial( [syncer](){ syncer->set_value(); },
[&counter](){ BOOST_CHECK_EQUAL( 1, counter.load() );
[&counter](){ BOOST_CHECK_EQUAL( 1u, counter.load() );
counter.fetch_add(1); } );
});
fc::future<void>( fc::shared_ptr<fc::promise<void>>( syncer, true ) ).wait();
Expand All @@ -233,7 +233,7 @@ BOOST_AUTO_TEST_CASE( serial_valve )

BOOST_CHECK( p1.ready() );
BOOST_CHECK( p2.ready() );
BOOST_CHECK_EQUAL( 2, counter.load() );
BOOST_CHECK_EQUAL( 2u, counter.load() );
}

{ // Triple test, f3 finishes first, then f1, finally f2
Expand All @@ -243,7 +243,7 @@ BOOST_AUTO_TEST_CASE( serial_valve )
auto p1 = fc::async([&counter,&valve,syncer,waiter] () {
valve.do_serial( [&syncer,waiter](){ syncer->set_value();
fc::future<void>( fc::shared_ptr<fc::promise<void>>( waiter, true ) ).wait(); },
[&counter](){ BOOST_CHECK_EQUAL( 0, counter.load() );
[&counter](){ BOOST_CHECK_EQUAL( 0u, counter.load() );
counter.fetch_add(1); } );
});
fc::future<void>( fc::shared_ptr<fc::promise<void>>( syncer, true ) ).wait();
Expand All @@ -254,7 +254,7 @@ BOOST_AUTO_TEST_CASE( serial_valve )
auto p2 = fc::async([&counter,&valve,syncer] () {
valve.do_serial( [&syncer](){ syncer->set_value();
fc::usleep( fc::milliseconds(100) ); },
[&counter](){ BOOST_CHECK_EQUAL( 1, counter.load() );
[&counter](){ BOOST_CHECK_EQUAL( 1u, counter.load() );
counter.fetch_add(1); } );
});
fc::future<void>( fc::shared_ptr<fc::promise<void>>( syncer, true ) ).wait();
Expand All @@ -264,7 +264,7 @@ BOOST_AUTO_TEST_CASE( serial_valve )
syncer = new fc::promise<void>();
auto p3 = fc::async([&counter,&valve,syncer] () {
valve.do_serial( [syncer](){ syncer->set_value(); },
[&counter](){ BOOST_CHECK_EQUAL( 2, counter.load() );
[&counter](){ BOOST_CHECK_EQUAL( 2u, counter.load() );
counter.fetch_add(1); } );
});
fc::future<void>( fc::shared_ptr<fc::promise<void>>( syncer, true ) ).wait();
Expand All @@ -284,7 +284,7 @@ BOOST_AUTO_TEST_CASE( serial_valve )
BOOST_CHECK( p1.ready() );
BOOST_CHECK( p2.ready() );
BOOST_CHECK( p3.ready() );
BOOST_CHECK_EQUAL( 3, counter.load() );
BOOST_CHECK_EQUAL( 3u, counter.load() );
}

{ // Triple test again but with invocations from different threads
Expand All @@ -294,7 +294,7 @@ BOOST_AUTO_TEST_CASE( serial_valve )
auto p1 = fc::do_parallel([&counter,&valve,syncer,waiter] () {
valve.do_serial( [&syncer,waiter](){ syncer->set_value();
fc::future<void>( fc::shared_ptr<fc::promise<void>>( waiter, true ) ).wait(); },
[&counter](){ BOOST_CHECK_EQUAL( 0, counter.load() );
[&counter](){ BOOST_CHECK_EQUAL( 0u, counter.load() );
counter.fetch_add(1); } );
});
fc::future<void>( fc::shared_ptr<fc::promise<void>>( syncer, true ) ).wait();
Expand All @@ -305,7 +305,7 @@ BOOST_AUTO_TEST_CASE( serial_valve )
auto p2 = fc::do_parallel([&counter,&valve,syncer] () {
valve.do_serial( [&syncer](){ syncer->set_value();
fc::usleep( fc::milliseconds(100) ); },
[&counter](){ BOOST_CHECK_EQUAL( 1, counter.load() );
[&counter](){ BOOST_CHECK_EQUAL( 1u, counter.load() );
counter.fetch_add(1); } );
});
fc::future<void>( fc::shared_ptr<fc::promise<void>>( syncer, true ) ).wait();
Expand All @@ -315,7 +315,7 @@ BOOST_AUTO_TEST_CASE( serial_valve )
syncer = new fc::promise<void>();
auto p3 = fc::do_parallel([&counter,&valve,syncer] () {
valve.do_serial( [syncer](){ syncer->set_value(); },
[&counter](){ BOOST_CHECK_EQUAL( 2, counter.load() );
[&counter](){ BOOST_CHECK_EQUAL( 2u, counter.load() );
counter.fetch_add(1); } );
});
fc::future<void>( fc::shared_ptr<fc::promise<void>>( syncer, true ) ).wait();
Expand All @@ -335,7 +335,7 @@ BOOST_AUTO_TEST_CASE( serial_valve )
BOOST_CHECK( p1.ready() );
BOOST_CHECK( p2.ready() );
BOOST_CHECK( p3.ready() );
BOOST_CHECK_EQUAL( 3, counter.load() );
BOOST_CHECK_EQUAL( 3u, counter.load() );
}
}

Expand Down

0 comments on commit df7b4e6

Please sign in to comment.