THRIFT-5766 Replace std::endl with "\n"
Patch: Carel Combrink
This closes #2943
diff --git a/lib/cpp/test/Benchmark.cpp b/lib/cpp/test/Benchmark.cpp
index 97a5317..ba8c345 100644
--- a/lib/cpp/test/Benchmark.cpp
+++ b/lib/cpp/test/Benchmark.cpp
@@ -53,7 +53,6 @@
using namespace apache::thrift::transport;
using namespace apache::thrift::protocol;
using std::cout;
- using std::endl;
OneOfEach ooe;
ooe.im_true = true;
@@ -84,7 +83,7 @@
ooe.write(&prot);
}
elapsed = timer.frame();
- cout << "Write big endian: " << num / (1000 * elapsed) << " kHz" << endl;
+ cout << "Write big endian: " << num / (1000 * elapsed) << " kHz" << '\n';
}
buf->getBuffer(&data, &datasize);
@@ -100,7 +99,7 @@
ooe2.read(&prot);
}
elapsed = timer.frame();
- cout << " Read big endian: " << num / (1000 * elapsed) << " kHz" << endl;
+ cout << " Read big endian: " << num / (1000 * elapsed) << " kHz" << '\n';
}
{
@@ -113,7 +112,7 @@
ooe.write(&prot);
}
elapsed = timer.frame();
- cout << "Write little endian: " << num / (1000 * elapsed) << " kHz" << endl;
+ cout << "Write little endian: " << num / (1000 * elapsed) << " kHz" << '\n';
}
{
@@ -127,7 +126,7 @@
ooe2.read(&prot);
}
elapsed = timer.frame();
- cout << " Read little endian: " << num / (1000 * elapsed) << " kHz" << endl;
+ cout << " Read little endian: " << num / (1000 * elapsed) << " kHz" << '\n';
}
{
@@ -140,7 +139,7 @@
ooe.write(&prot);
}
elapsed = timer.frame();
- cout << "Write big endian: " << num / (1000 * elapsed) << " kHz" << endl;
+ cout << "Write big endian: " << num / (1000 * elapsed) << " kHz" << '\n';
}
{
@@ -154,7 +153,7 @@
ooe2.read(&prot);
}
elapsed = timer.frame();
- cout << " Read big endian: " << num / (1000 * elapsed) << " kHz" << endl;
+ cout << " Read big endian: " << num / (1000 * elapsed) << " kHz" << '\n';
}
@@ -177,7 +176,7 @@
listDoublePerf.write(&prot);
elapsed = timer.frame();
- cout << "Double write big endian: " << num / (1000 * elapsed) << " kHz" << endl;
+ cout << "Double write big endian: " << num / (1000 * elapsed) << " kHz" << '\n';
}
buf->getBuffer(&data, &datasize);
@@ -191,7 +190,7 @@
listDoublePerf2.read(&prot);
elapsed = timer.frame();
- cout << " Double read big endian: " << num / (1000 * elapsed) << " kHz" << endl;
+ cout << " Double read big endian: " << num / (1000 * elapsed) << " kHz" << '\n';
}
{
@@ -202,7 +201,7 @@
listDoublePerf.write(&prot);
elapsed = timer.frame();
- cout << "Double write little endian: " << num / (1000 * elapsed) << " kHz" << endl;
+ cout << "Double write little endian: " << num / (1000 * elapsed) << " kHz" << '\n';
}
{
@@ -214,7 +213,7 @@
listDoublePerf2.read(&prot);
elapsed = timer.frame();
- cout << " Double read little endian: " << num / (1000 * elapsed) << " kHz" << endl;
+ cout << " Double read little endian: " << num / (1000 * elapsed) << " kHz" << '\n';
}
{
@@ -225,7 +224,7 @@
listDoublePerf.write(&prot);
elapsed = timer.frame();
- cout << "Double write big endian: " << num / (1000 * elapsed) << " kHz" << endl;
+ cout << "Double write big endian: " << num / (1000 * elapsed) << " kHz" << '\n';
}
{
@@ -237,7 +236,7 @@
listDoublePerf2.read(&prot);
elapsed = timer.frame();
- cout << " Double read big endian: " << num / (1000 * elapsed) << " kHz" << endl;
+ cout << " Double read big endian: " << num / (1000 * elapsed) << " kHz" << '\n';
}
diff --git a/lib/cpp/test/OneWayHTTPTest.cpp b/lib/cpp/test/OneWayHTTPTest.cpp
index 7823482..8789c2c 100644
--- a/lib/cpp/test/OneWayHTTPTest.cpp
+++ b/lib/cpp/test/OneWayHTTPTest.cpp
@@ -55,9 +55,6 @@
using apache::thrift::transport::TSocket;
using apache::thrift::transport::TTransportException;
using std::shared_ptr;
-using std::cout;
-using std::cerr;
-using std::endl;
using std::string;
namespace utf = boost::unit_test;
@@ -70,12 +67,12 @@
void roundTripRPC() override {
#ifdef ENABLE_STDERR_LOGGING
- cerr << "roundTripRPC()" << endl;
+ cerr << "roundTripRPC()" << '\n';
#endif
}
void oneWayRPC() override {
#ifdef ENABLE_STDERR_LOGGING
- cerr << "oneWayRPC()" << std::endl ;
+ cerr << "oneWayRPC()" << '\n';
#endif
}
};
@@ -201,7 +198,7 @@
int port = ss->getPort() ;
#ifdef ENABLE_STDERR_LOGGING
- cerr << "port " << port << endl ;
+ cerr << "port " << port << '\n';
#endif
{
diff --git a/lib/cpp/test/TMemoryBufferTest.cpp b/lib/cpp/test/TMemoryBufferTest.cpp
index 2f1aea6..53e5d15 100644
--- a/lib/cpp/test/TMemoryBufferTest.cpp
+++ b/lib/cpp/test/TMemoryBufferTest.cpp
@@ -36,8 +36,6 @@
using apache::thrift::transport::TMemoryBuffer;
using apache::thrift::transport::TTransportException;
using std::shared_ptr;
-using std::cout;
-using std::endl;
using std::string;
BOOST_AUTO_TEST_CASE(test_read_write_grow) {
diff --git a/lib/cpp/test/TServerSocketTest.cpp b/lib/cpp/test/TServerSocketTest.cpp
index 929defa..0860242 100644
--- a/lib/cpp/test/TServerSocketTest.cpp
+++ b/lib/cpp/test/TServerSocketTest.cpp
@@ -43,7 +43,7 @@
accepted->close();
sock1.close();
- std::cout << "An error message from getaddrinfo on the console is expected:" << std::endl;
+ std::cout << "An error message from getaddrinfo on the console is expected:" << '\n';
TServerSocket sock2("257.258.259.260", 0);
BOOST_CHECK_THROW(sock2.listen(), TTransportException);
sock2.close();
diff --git a/lib/cpp/test/ThrifttReadCheckTests.cpp b/lib/cpp/test/ThrifttReadCheckTests.cpp
index eb4ca01..481185e 100644
--- a/lib/cpp/test/ThrifttReadCheckTests.cpp
+++ b/lib/cpp/test/ThrifttReadCheckTests.cpp
@@ -55,8 +55,6 @@
using apache::thrift::transport::TBufferedTransport;
using apache::thrift::transport::TFramedTransport;
using std::shared_ptr;
-using std::cout;
-using std::endl;
using std::string;
using std::memset;
using namespace apache::thrift;
diff --git a/lib/cpp/test/concurrency/Tests.cpp b/lib/cpp/test/concurrency/Tests.cpp
index 45054a9..67de789 100644
--- a/lib/cpp/test/concurrency/Tests.cpp
+++ b/lib/cpp/test/concurrency/Tests.cpp
@@ -51,52 +51,52 @@
ThreadFactoryTests threadFactoryTests;
- std::cout << "ThreadFactory tests..." << std::endl;
+ std::cout << "ThreadFactory tests..." << '\n';
const int reapLoops = 2 * WEIGHT;
const int reapCount = 100 * WEIGHT;
const size_t floodLoops = 3;
const size_t floodCount = 500 * WEIGHT;
- std::cout << "\t\tThreadFactory reap N threads test: N = " << reapLoops << "x" << reapCount << std::endl;
+ std::cout << "\t\tThreadFactory reap N threads test: N = " << reapLoops << "x" << reapCount << '\n';
if (!threadFactoryTests.reapNThreads(reapLoops, reapCount)) {
- std::cerr << "\t\ttThreadFactory reap N threads FAILED" << std::endl;
+ std::cerr << "\t\ttThreadFactory reap N threads FAILED" << '\n';
return 1;
}
- std::cout << "\t\tThreadFactory flood N threads test: N = " << floodLoops << "x" << floodCount << std::endl;
+ std::cout << "\t\tThreadFactory flood N threads test: N = " << floodLoops << "x" << floodCount << '\n';
if (!threadFactoryTests.floodNTest(floodLoops, floodCount)) {
- std::cerr << "\t\ttThreadFactory flood N threads FAILED" << std::endl;
+ std::cerr << "\t\ttThreadFactory flood N threads FAILED" << '\n';
return 1;
}
- std::cout << "\t\tThreadFactory synchronous start test" << std::endl;
+ std::cout << "\t\tThreadFactory synchronous start test" << '\n';
if (!threadFactoryTests.synchStartTest()) {
- std::cerr << "\t\ttThreadFactory synchronous start FAILED" << std::endl;
+ std::cerr << "\t\ttThreadFactory synchronous start FAILED" << '\n';
return 1;
}
- std::cout << "\t\tThreadFactory monitor timeout test" << std::endl;
+ std::cout << "\t\tThreadFactory monitor timeout test" << '\n';
if (!threadFactoryTests.monitorTimeoutTest()) {
- std::cerr << "\t\ttThreadFactory monitor timeout FAILED" << std::endl;
+ std::cerr << "\t\ttThreadFactory monitor timeout FAILED" << '\n';
return 1;
}
}
if (runAll || args[0].compare("util") == 0) {
- std::cout << "Util tests..." << std::endl;
+ std::cout << "Util tests..." << '\n';
- std::cout << "\t\tUtil minimum time" << std::endl;
+ std::cout << "\t\tUtil minimum time" << '\n';
int64_t time00 = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::steady_clock::now().time_since_epoch()).count();
int64_t time01 = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::steady_clock::now().time_since_epoch()).count();
- std::cout << "\t\t\tMinimum time: " << time01 - time00 << "ms" << std::endl;
+ std::cout << "\t\t\tMinimum time: " << time01 - time00 << "ms" << '\n';
time00 = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::steady_clock::now().time_since_epoch()).count();
time01 = time00;
@@ -107,54 +107,54 @@
time01 = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::steady_clock::now().time_since_epoch()).count();
}
- std::cout << "\t\t\tscall per ms: " << count / (time01 - time00) << std::endl;
+ std::cout << "\t\t\tscall per ms: " << count / (time01 - time00) << '\n';
}
if (runAll || args[0].compare("timer-manager") == 0) {
- std::cout << "TimerManager tests..." << std::endl;
+ std::cout << "TimerManager tests..." << '\n';
- std::cout << "\t\tTimerManager test00" << std::endl;
+ std::cout << "\t\tTimerManager test00" << '\n';
TimerManagerTests timerManagerTests;
if (!timerManagerTests.test00()) {
- std::cerr << "\t\tTimerManager tests FAILED" << std::endl;
+ std::cerr << "\t\tTimerManager tests FAILED" << '\n';
return 1;
}
- std::cout << "\t\tTimerManager test01" << std::endl;
+ std::cout << "\t\tTimerManager test01" << '\n';
if (!timerManagerTests.test01()) {
- std::cerr << "\t\tTimerManager tests FAILED" << std::endl;
+ std::cerr << "\t\tTimerManager tests FAILED" << '\n';
return 1;
}
- std::cout << "\t\tTimerManager test02" << std::endl;
+ std::cout << "\t\tTimerManager test02" << '\n';
if (!timerManagerTests.test02()) {
- std::cerr << "\t\tTimerManager tests FAILED" << std::endl;
+ std::cerr << "\t\tTimerManager tests FAILED" << '\n';
return 1;
}
- std::cout << "\t\tTimerManager test03" << std::endl;
+ std::cout << "\t\tTimerManager test03" << '\n';
if (!timerManagerTests.test03()) {
- std::cerr << "\t\tTimerManager tests FAILED" << std::endl;
+ std::cerr << "\t\tTimerManager tests FAILED" << '\n';
return 1;
}
- std::cout << "\t\tTimerManager test04" << std::endl;
+ std::cout << "\t\tTimerManager test04" << '\n';
if (!timerManagerTests.test04()) {
- std::cerr << "\t\tTimerManager tests FAILED" << std::endl;
+ std::cerr << "\t\tTimerManager tests FAILED" << '\n';
return 1;
}
}
if (runAll || args[0].compare("thread-manager") == 0) {
- std::cout << "ThreadManager tests..." << std::endl;
+ std::cout << "ThreadManager tests..." << '\n';
{
size_t workerCount = 10 * WEIGHT;
@@ -163,26 +163,26 @@
ThreadManagerTests threadManagerTests;
- std::cout << "\t\tThreadManager api test:" << std::endl;
+ std::cout << "\t\tThreadManager api test:" << '\n';
if (!threadManagerTests.apiTest()) {
- std::cerr << "\t\tThreadManager apiTest FAILED" << std::endl;
+ std::cerr << "\t\tThreadManager apiTest FAILED" << '\n';
return 1;
}
std::cout << "\t\tThreadManager load test: worker count: " << workerCount
- << " task count: " << taskCount << " delay: " << delay << std::endl;
+ << " task count: " << taskCount << " delay: " << delay << '\n';
if (!threadManagerTests.loadTest(taskCount, delay, workerCount)) {
- std::cerr << "\t\tThreadManager loadTest FAILED" << std::endl;
+ std::cerr << "\t\tThreadManager loadTest FAILED" << '\n';
return 1;
}
std::cout << "\t\tThreadManager block test: worker count: " << workerCount
- << " delay: " << delay << std::endl;
+ << " delay: " << delay << '\n';
if (!threadManagerTests.blockTest(delay, workerCount)) {
- std::cerr << "\t\tThreadManager blockTest FAILED" << std::endl;
+ std::cerr << "\t\tThreadManager blockTest FAILED" << '\n';
return 1;
}
}
@@ -190,7 +190,7 @@
if (runAll || args[0].compare("thread-manager-benchmark") == 0) {
- std::cout << "ThreadManager benchmark tests..." << std::endl;
+ std::cout << "ThreadManager benchmark tests..." << '\n';
{
@@ -207,19 +207,19 @@
size_t taskCount = workerCount * tasksPerWorker;
std::cout << "\t\tThreadManager load test: worker count: " << workerCount
- << " task count: " << taskCount << " delay: " << delay << std::endl;
+ << " task count: " << taskCount << " delay: " << delay << '\n';
ThreadManagerTests threadManagerTests;
if (!threadManagerTests.loadTest(taskCount, delay, workerCount))
{
- std::cerr << "\t\tThreadManager loadTest FAILED" << std::endl;
+ std::cerr << "\t\tThreadManager loadTest FAILED" << '\n';
return 1;
}
}
}
}
- std::cout << "ALL TESTS PASSED" << std::endl;
+ std::cout << "ALL TESTS PASSED" << '\n';
return 0;
}
diff --git a/lib/cpp/test/concurrency/ThreadFactoryTests.h b/lib/cpp/test/concurrency/ThreadFactoryTests.h
index 23e46e3..a2d55fe 100644
--- a/lib/cpp/test/concurrency/ThreadFactoryTests.h
+++ b/lib/cpp/test/concurrency/ThreadFactoryTests.h
@@ -53,7 +53,7 @@
void run() override {
Synchronized s(_monitor);
-
+
if (--_count == 0) {
_monitor.notify();
}
@@ -82,7 +82,7 @@
threadFactory.newThread(shared_ptr<Runnable>(new ReapNTask(*monitor, activeCount))));
} catch (SystemResourceException& e) {
std::cout << "\t\t\tfailed to create " << lix* count + tix << " thread " << e.what()
- << std::endl;
+ << '\n';
throw;
}
}
@@ -96,7 +96,7 @@
(*thread)->start();
} catch (SystemResourceException& e) {
std::cout << "\t\t\tfailed to start " << lix* count + tix << " thread " << e.what()
- << std::endl;
+ << '\n';
throw;
}
}
@@ -107,11 +107,11 @@
monitor->wait(1000);
}
}
-
- std::cout << "\t\t\treaped " << lix* count << " threads" << std::endl;
+
+ std::cout << "\t\t\treaped " << lix* count << " threads" << '\n';
}
- std::cout << "\t\t\tSuccess!" << std::endl;
+ std::cout << "\t\t\tSuccess!" << '\n';
return true;
}
@@ -202,7 +202,7 @@
bool success = true;
- std::cout << "\t\t\t" << (success ? "Success" : "Failure") << "!" << std::endl;
+ std::cout << "\t\t\t" << (success ? "Success" : "Failure") << "!" << '\n';
return true;
}
@@ -239,7 +239,7 @@
std::cout << "\t\t\t" << (success ? "Success" : "Failure")
<< ": minimum required time to elapse " << count * timeout
<< "ms; actual elapsed time " << endTime - startTime << "ms"
- << std::endl;
+ << '\n';
return success;
}
@@ -250,14 +250,14 @@
~FloodTask() override {
if (_id % 10000 == 0) {
Synchronized sync(_mon);
- std::cout << "\t\tthread " << _id << " done" << std::endl;
+ std::cout << "\t\tthread " << _id << " done" << '\n';
}
}
void run() override {
if (_id % 10000 == 0) {
Synchronized sync(_mon);
- std::cout << "\t\tthread " << _id << " started" << std::endl;
+ std::cout << "\t\tthread " << _id << " started" << '\n';
}
}
const size_t _id;
@@ -270,7 +270,7 @@
bool success = false;
Monitor mon;
-
+
for (size_t lix = 0; lix < loop; lix++) {
ThreadFactory threadFactory = ThreadFactory();
@@ -287,14 +287,14 @@
} catch (TException& e) {
std::cout << "\t\t\tfailed to start " << lix* count + tix << " thread " << e.what()
- << std::endl;
+ << '\n';
return success;
}
}
Synchronized sync(mon);
- std::cout << "\t\t\tflooded " << (lix + 1) * count << " threads" << std::endl;
+ std::cout << "\t\t\tflooded " << (lix + 1) * count << " threads" << '\n';
success = true;
}
diff --git a/lib/cpp/test/concurrency/ThreadManagerTests.h b/lib/cpp/test/concurrency/ThreadManagerTests.h
index fee7c7c..b33fc27 100644
--- a/lib/cpp/test/concurrency/ThreadManagerTests.h
+++ b/lib/cpp/test/concurrency/ThreadManagerTests.h
@@ -76,7 +76,7 @@
{
Synchronized s(_monitor);
- // std::cout << "Thread " << _count << " completed " << std::endl;
+ // std::cout << "Thread " << _count << " completed " << '\n';
_count--;
if (_count % 10000 == 0) {
@@ -131,13 +131,13 @@
threadManager->add(*ix);
}
- std::cout << "\t\t\t\tloaded " << count << " tasks to execute" << std::endl;
+ std::cout << "\t\t\t\tloaded " << count << " tasks to execute" << '\n';
{
Synchronized s(monitor);
while (activeCount > 0) {
- std::cout << "\t\t\t\tactiveCount = " << activeCount << std::endl;
+ std::cout << "\t\t\t\tactiveCount = " << activeCount << '\n';
monitor.wait();
}
}
@@ -184,13 +184,13 @@
std::cout << "\t\t\tfirst start: " << firstTime << " Last end: " << lastTime
<< " min: " << minTime << "ms max: " << maxTime << "ms average: " << averageTime
- << "ms" << std::endl;
+ << "ms" << '\n';
bool success = (time01 - time00) >= ((int64_t)count * timeout) / (int64_t)workerCount;
std::cout << "\t\t\t" << (success ? "Success" : "Failure")
<< "! expected time: " << ((int64_t)count * timeout) / (int64_t)workerCount << "ms elapsed time: " << time01 - time00
- << "ms" << std::endl;
+ << "ms" << '\n';
return success;
}
@@ -307,7 +307,7 @@
}
std::cout << "\t\t\t"
- << "Pending tasks " << threadManager->pendingTaskCount() << std::endl;
+ << "Pending tasks " << threadManager->pendingTaskCount() << '\n';
{
Synchronized s(blockMonitor);
@@ -323,18 +323,18 @@
}
std::cout << "\t\t\t"
- << "Pending tasks " << threadManager->pendingTaskCount() << std::endl;
+ << "Pending tasks " << threadManager->pendingTaskCount() << '\n';
try {
threadManager->add(extraTask, 1);
} catch (TimedOutException&) {
std::cout << "\t\t\t"
- << "add timed out unexpectedly" << std::endl;
+ << "add timed out unexpectedly" << '\n';
throw TException("Unexpected timeout adding task");
} catch (TooManyPendingTasksException&) {
std::cout << "\t\t\t"
- << "add encountered too many pending exepctions" << std::endl;
+ << "add encountered too many pending exepctions" << '\n';
throw TException("Unexpected timeout adding task");
}
@@ -375,10 +375,10 @@
}
} catch (TException& e) {
- std::cout << "ERROR: " << e.what() << std::endl;
+ std::cout << "ERROR: " << e.what() << '\n';
}
- std::cout << "\t\t\t" << (success ? "Success" : "Failure") << std::endl;
+ std::cout << "\t\t\t" << (success ? "Success" : "Failure") << '\n';
return success;
}
@@ -390,7 +390,7 @@
sleep_(100);
int64_t b = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::steady_clock::now().time_since_epoch()).count();
if (b - a < 50 || b - a > 150) {
- std::cerr << "\t\t\texpected 100ms gap, found " << (b-a) << "ms gap instead." << std::endl;
+ std::cerr << "\t\t\texpected 100ms gap, found " << (b-a) << "ms gap instead." << '\n';
return false;
}
@@ -403,18 +403,18 @@
shared_ptr<ThreadManager> threadManager = ThreadManager::newSimpleThreadManager(1);
threadManager->threadFactory(threadFactory);
- std::cout << "\t\t\t\tstarting.. " << std::endl;
+ std::cout << "\t\t\t\tstarting.. " << '\n';
threadManager->start();
threadManager->setExpireCallback(expiredNotifier); // std::bind(&ThreadManagerTests::expiredNotifier, this));
-#define EXPECT(FUNC, COUNT) { size_t c = FUNC; if (c != COUNT) { std::cerr << "expected " #FUNC" to be " #COUNT ", but was " << c << std::endl; return false; } }
+#define EXPECT(FUNC, COUNT) { size_t c = FUNC; if (c != COUNT) { std::cerr << "expected " #FUNC" to be " #COUNT ", but was " << c << '\n'; return false; } }
EXPECT(threadManager->workerCount(), 1);
EXPECT(threadManager->idleWorkerCount(), 1);
EXPECT(threadManager->pendingTaskCount(), 0);
- std::cout << "\t\t\t\tadd 2nd worker.. " << std::endl;
+ std::cout << "\t\t\t\tadd 2nd worker.. " << '\n';
threadManager->addWorker();
@@ -422,7 +422,7 @@
EXPECT(threadManager->idleWorkerCount(), 2);
EXPECT(threadManager->pendingTaskCount(), 0);
- std::cout << "\t\t\t\tremove 2nd worker.. " << std::endl;
+ std::cout << "\t\t\t\tremove 2nd worker.. " << '\n';
threadManager->removeWorker();
@@ -430,7 +430,7 @@
EXPECT(threadManager->idleWorkerCount(), 1);
EXPECT(threadManager->pendingTaskCount(), 0);
- std::cout << "\t\t\t\tremove 1st worker.. " << std::endl;
+ std::cout << "\t\t\t\tremove 1st worker.. " << '\n';
threadManager->removeWorker();
@@ -438,7 +438,7 @@
EXPECT(threadManager->idleWorkerCount(), 0);
EXPECT(threadManager->pendingTaskCount(), 0);
- std::cout << "\t\t\t\tadd blocking task.. " << std::endl;
+ std::cout << "\t\t\t\tadd blocking task.. " << '\n';
// We're going to throw a blocking task into the mix
Monitor entryMonitor; // signaled when task is running
@@ -454,7 +454,7 @@
EXPECT(threadManager->idleWorkerCount(), 0);
EXPECT(threadManager->pendingTaskCount(), 1);
- std::cout << "\t\t\t\tadd other task.. " << std::endl;
+ std::cout << "\t\t\t\tadd other task.. " << '\n';
shared_ptr<ThreadManagerTests::Task> otherTask(
new ThreadManagerTests::Task(doneMonitor, activeCount, 0));
@@ -465,7 +465,7 @@
EXPECT(threadManager->idleWorkerCount(), 0);
EXPECT(threadManager->pendingTaskCount(), 2);
- std::cout << "\t\t\t\tremove blocking task specifically.. " << std::endl;
+ std::cout << "\t\t\t\tremove blocking task specifically.. " << '\n';
threadManager->remove(blockingTask);
@@ -473,11 +473,11 @@
EXPECT(threadManager->idleWorkerCount(), 0);
EXPECT(threadManager->pendingTaskCount(), 1);
- std::cout << "\t\t\t\tremove next pending task.." << std::endl;
+ std::cout << "\t\t\t\tremove next pending task.." << '\n';
shared_ptr<Runnable> nextTask = threadManager->removeNextPending();
if (nextTask != otherTask) {
- std::cerr << "\t\t\t\t\texpected removeNextPending to return otherTask" << std::endl;
+ std::cerr << "\t\t\t\t\texpected removeNextPending to return otherTask" << '\n';
return false;
}
@@ -485,15 +485,15 @@
EXPECT(threadManager->idleWorkerCount(), 0);
EXPECT(threadManager->pendingTaskCount(), 0);
- std::cout << "\t\t\t\tremove next pending task (none left).." << std::endl;
+ std::cout << "\t\t\t\tremove next pending task (none left).." << '\n';
nextTask = threadManager->removeNextPending();
if (nextTask) {
- std::cerr << "\t\t\t\t\texpected removeNextPending to return an empty Runnable" << std::endl;
+ std::cerr << "\t\t\t\t\texpected removeNextPending to return an empty Runnable" << '\n';
return false;
}
- std::cout << "\t\t\t\tadd 2 expired tasks and 1 not.." << std::endl;
+ std::cout << "\t\t\t\tadd 2 expired tasks and 1 not.." << '\n';
shared_ptr<ThreadManagerTests::Task> expiredTask(
new ThreadManagerTests::Task(doneMonitor, activeCount, 0));
@@ -509,28 +509,28 @@
EXPECT(threadManager->pendingTaskCount(), 3);
EXPECT(threadManager->expiredTaskCount(), 0);
- std::cout << "\t\t\t\tremove expired tasks.." << std::endl;
+ std::cout << "\t\t\t\tremove expired tasks.." << '\n';
if (!m_expired.empty()) {
- std::cerr << "\t\t\t\t\texpected m_expired to be empty" << std::endl;
+ std::cerr << "\t\t\t\t\texpected m_expired to be empty" << '\n';
return false;
}
threadManager->removeExpiredTasks();
if (m_expired.size() != 2) {
- std::cerr << "\t\t\t\t\texpected m_expired to be set" << std::endl;
+ std::cerr << "\t\t\t\t\texpected m_expired to be set" << '\n';
return false;
}
if (m_expired.front() != expiredTask) {
- std::cerr << "\t\t\t\t\texpected m_expired[0] to be the expired task" << std::endl;
+ std::cerr << "\t\t\t\t\texpected m_expired[0] to be the expired task" << '\n';
return false;
}
m_expired.pop_front();
if (m_expired.front() != expiredTask) {
- std::cerr << "\t\t\t\t\texpected m_expired[1] to be the expired task" << std::endl;
+ std::cerr << "\t\t\t\t\texpected m_expired[1] to be the expired task" << '\n';
return false;
}
@@ -543,23 +543,23 @@
EXPECT(threadManager->pendingTaskCount(), 0);
EXPECT(threadManager->expiredTaskCount(), 2);
- std::cout << "\t\t\t\tadd expired task (again).." << std::endl;
+ std::cout << "\t\t\t\tadd expired task (again).." << '\n';
threadManager->add(expiredTask, 0, 1); // expires in 1ms
sleep_(50); // make sure enough time elapses for it to expire - the shortest expiration time is 1ms
- std::cout << "\t\t\t\tadd worker to consume expired task.." << std::endl;
+ std::cout << "\t\t\t\tadd worker to consume expired task.." << '\n';
threadManager->addWorker();
sleep_(100); // make sure it has time to spin up and expire the task
if (m_expired.empty()) {
- std::cerr << "\t\t\t\t\texpected m_expired to be set" << std::endl;
+ std::cerr << "\t\t\t\t\texpected m_expired to be set" << '\n';
return false;
}
if (m_expired.front() != expiredTask) {
- std::cerr << "\t\t\t\t\texpected m_expired to be the expired task" << std::endl;
+ std::cerr << "\t\t\t\t\texpected m_expired to be the expired task" << '\n';
return false;
}
@@ -570,16 +570,16 @@
EXPECT(threadManager->pendingTaskCount(), 0);
EXPECT(threadManager->expiredTaskCount(), 3);
- std::cout << "\t\t\t\ttry to remove too many workers" << std::endl;
+ std::cout << "\t\t\t\ttry to remove too many workers" << '\n';
try {
threadManager->removeWorker(2);
- std::cerr << "\t\t\t\t\texpected InvalidArgumentException" << std::endl;
+ std::cerr << "\t\t\t\t\texpected InvalidArgumentException" << '\n';
return false;
} catch (const InvalidArgumentException&) {
/* expected */
}
- std::cout << "\t\t\t\tremove worker.. " << std::endl;
+ std::cout << "\t\t\t\tremove worker.. " << '\n';
threadManager->removeWorker();
@@ -588,7 +588,7 @@
EXPECT(threadManager->pendingTaskCount(), 0);
EXPECT(threadManager->expiredTaskCount(), 3);
- std::cout << "\t\t\t\tadd blocking task.. " << std::endl;
+ std::cout << "\t\t\t\tadd blocking task.. " << '\n';
threadManager->add(blockingTask);
@@ -596,7 +596,7 @@
EXPECT(threadManager->idleWorkerCount(), 0);
EXPECT(threadManager->pendingTaskCount(), 1);
- std::cout << "\t\t\t\tadd worker.. " << std::endl;
+ std::cout << "\t\t\t\tadd worker.. " << '\n';
threadManager->addWorker();
{
@@ -610,7 +610,7 @@
EXPECT(threadManager->idleWorkerCount(), 0);
EXPECT(threadManager->pendingTaskCount(), 0);
- std::cout << "\t\t\t\tunblock task and remove worker.. " << std::endl;
+ std::cout << "\t\t\t\tunblock task and remove worker.. " << '\n';
{
Synchronized s(blockMonitor);
@@ -623,7 +623,7 @@
EXPECT(threadManager->idleWorkerCount(), 0);
EXPECT(threadManager->pendingTaskCount(), 0);
- std::cout << "\t\t\t\tcleanup.. " << std::endl;
+ std::cout << "\t\t\t\tcleanup.. " << '\n';
blockingTask.reset();
threadManager.reset();
diff --git a/lib/cpp/test/concurrency/TimerManagerTests.h b/lib/cpp/test/concurrency/TimerManagerTests.h
index 2d1a262..9a53232 100644
--- a/lib/cpp/test/concurrency/TimerManagerTests.h
+++ b/lib/cpp/test/concurrency/TimerManagerTests.h
@@ -46,7 +46,7 @@
_success(false),
_done(false) {}
- ~Task() override { std::cerr << this << std::endl; }
+ ~Task() override { std::cerr << this << '\n'; }
void run() override {
@@ -84,7 +84,7 @@
timerManager.threadFactory(shared_ptr<ThreadFactory>(new ThreadFactory()));
timerManager.start();
if (timerManager.state() != TimerManager::STARTED) {
- std::cerr << "timerManager is not in the STARTED state, but should be" << std::endl;
+ std::cerr << "timerManager is not in the STARTED state, but should be" << '\n';
return false;
}
@@ -104,15 +104,15 @@
}
if (!task->_done) {
- std::cerr << "task is not done, but it should have executed" << std::endl;
+ std::cerr << "task is not done, but it should have executed" << '\n';
return false;
}
- std::cout << "\t\t\t" << (task->_success ? "Success" : "Failure") << "!" << std::endl;
+ std::cout << "\t\t\t" << (task->_success ? "Success" : "Failure") << "!" << '\n';
}
if (orphanTask->_done) {
- std::cerr << "orphan task is done, but it should not have executed" << std::endl;
+ std::cerr << "orphan task is done, but it should not have executed" << '\n';
return false;
}