Permalink
Browse files

[test] use std::endl instead of \n with std::cout

  • Loading branch information...
Montellese committed Sep 7, 2012
1 parent 76f1504 commit 39af00252648b4cafa117798301d02a00c1a19d8
@@ -73,17 +73,17 @@ TEST_F(TestFileFactory, Read)
std::vector<CStdString>::iterator it;
for (it = urls.begin(); it < urls.end(); it++)
{
- std::cout << "Testing URL: " << *it << "\n";
+ std::cout << "Testing URL: " << *it << std::endl;
ASSERT_TRUE(file.Open(*it));
std::cout << "file.GetLength(): " <<
- testing::PrintToString(file.GetLength()) << "\n";
+ testing::PrintToString(file.GetLength()) << std::endl;
std::cout << "file.Seek(file.GetLength() / 2, SEEK_CUR) return value: " <<
- testing::PrintToString(file.Seek(file.GetLength() / 2, SEEK_CUR)) << "\n";
+ testing::PrintToString(file.Seek(file.GetLength() / 2, SEEK_CUR)) << std::endl;
std::cout << "file.Seek(0, SEEK_END) return value: " <<
- testing::PrintToString(file.Seek(0, SEEK_END)) << "\n";
+ testing::PrintToString(file.Seek(0, SEEK_END)) << std::endl;
std::cout << "file.Seek(0, SEEK_SET) return value: " <<
- testing::PrintToString(file.Seek(0, SEEK_SET)) << "\n";
- std::cout << "File contents:\n";
+ testing::PrintToString(file.Seek(0, SEEK_SET)) << std::endl;
+ std::cout << "File contents:" << std::endl;
while ((size = file.Read(buf, sizeof(buf))) > 0)
{
str.Format(" %08X", count);
@@ -104,7 +104,7 @@ TEST_F(TestFileFactory, Read)
else
std::cout << ".";
}
- std::cout << "]\n";
+ std::cout << "]" << std::endl;
}
file.Close();
}
@@ -127,24 +127,24 @@ TEST_F(TestFileFactory, Write)
std::vector<CStdString>::iterator it;
for (it = urls.begin(); it < urls.end(); it++)
{
- std::cout << "Testing URL: " << *it << "\n";
+ std::cout << "Testing URL: " << *it << std::endl;
std::cout << "Writing...";
ASSERT_TRUE(file.OpenForWrite(*it, true));
while ((size = inputfile.Read(buf, sizeof(buf))) > 0)
{
EXPECT_GE(file.Write(buf, size), 0);
}
file.Close();
- std::cout << "done.\n";
- std::cout << "Reading...\n";
+ std::cout << "done." << std::endl;
+ std::cout << "Reading..." << std::endl;
ASSERT_TRUE(file.Open(*it));
EXPECT_EQ(inputfile.GetLength(), file.GetLength());
std::cout << "file.Seek(file.GetLength() / 2, SEEK_CUR) return value: " <<
- testing::PrintToString(file.Seek(file.GetLength() / 2, SEEK_CUR)) << "\n";
+ testing::PrintToString(file.Seek(file.GetLength() / 2, SEEK_CUR)) << std::endl;
std::cout << "file.Seek(0, SEEK_END) return value: " <<
- testing::PrintToString(file.Seek(0, SEEK_END)) << "\n";
+ testing::PrintToString(file.Seek(0, SEEK_END)) << std::endl;
std::cout << "file.Seek(0, SEEK_SET) return value: " <<
- testing::PrintToString(file.Seek(0, SEEK_SET)) << "\n";
+ testing::PrintToString(file.Seek(0, SEEK_SET)) << std::endl;
std::cout << "File contents:\n";
while ((size = file.Read(buf, sizeof(buf))) > 0)
{
@@ -166,7 +166,7 @@ TEST_F(TestFileFactory, Write)
else
std::cout << ".";
}
- std::cout << "]\n";
+ std::cout << "]" << std::endl;
}
file.Close();
}
@@ -130,8 +130,7 @@ TEST(TestRarFile, CorruptedFile)
reffilepath = XBMC_REF_FILE_PATH("xbmc/filesystem/test/reffile.txt.rar");
ASSERT_TRUE((file = XBMC_CREATECORRUPTEDFILE(reffilepath, ".rar")) != NULL);
- std::cout << "Reference file generated at '" << XBMC_TEMPFILEPATH(file) <<
- "'\n";
+ std::cout << "Reference file generated at '" << XBMC_TEMPFILEPATH(file) << "'" << std::endl;
URIUtils::CreateArchivePath(strrarpath, "rar", XBMC_TEMPFILEPATH(file), "");
if (!XFILE::CDirectory::GetDirectory(strrarpath, itemlist, "",
@@ -156,14 +155,14 @@ TEST(TestRarFile, CorruptedFile)
return;
}
std::cout << "file->GetLength(): " <<
- testing::PrintToString(file->GetLength()) << "\n";
+ testing::PrintToString(file->GetLength()) << std::endl;
std::cout << "file->Seek(file->GetLength() / 2, SEEK_CUR) return value: " <<
- testing::PrintToString(file->Seek(file->GetLength() / 2, SEEK_CUR)) << "\n";
+ testing::PrintToString(file->Seek(file->GetLength() / 2, SEEK_CUR)) << std::endl;
std::cout << "file->Seek(0, SEEK_END) return value: " <<
- testing::PrintToString(file->Seek(0, SEEK_END)) << "\n";
+ testing::PrintToString(file->Seek(0, SEEK_END)) << std::endl;
std::cout << "file->Seek(0, SEEK_SET) return value: " <<
- testing::PrintToString(file->Seek(0, SEEK_SET)) << "\n";
- std::cout << "File contents:\n";
+ testing::PrintToString(file->Seek(0, SEEK_SET)) << std::endl;
+ std::cout << "File contents:" << std::endl;
while ((size = file->Read(buf, sizeof(buf))) > 0)
{
str.Format(" %08X", count);
@@ -184,7 +183,7 @@ TEST(TestRarFile, CorruptedFile)
else
std::cout << ".";
}
- std::cout << "]\n";
+ std::cout << "]" << std::endl;
}
file->Close();
XBMC_DELETETEMPFILE(file);
@@ -152,8 +152,7 @@ TEST_F(TestZipFile, CorruptedFile)
reffilepath = XBMC_REF_FILE_PATH("xbmc/filesystem/test/reffile.txt.zip");
ASSERT_TRUE((file = XBMC_CREATECORRUPTEDFILE(reffilepath, ".zip")) != NULL);
- std::cout << "Reference file generated at '" << XBMC_TEMPFILEPATH(file) <<
- "'\n";
+ std::cout << "Reference file generated at '" << XBMC_TEMPFILEPATH(file) << "'" << std::endl;
URIUtils::CreateArchivePath(strzippath, "zip", XBMC_TEMPFILEPATH(file), "");
if (!XFILE::CDirectory::GetDirectory(strzippath, itemlist, "",
@@ -178,14 +177,14 @@ TEST_F(TestZipFile, CorruptedFile)
return;
}
std::cout << "file->GetLength(): " <<
- testing::PrintToString(file->GetLength()) << "\n";
+ testing::PrintToString(file->GetLength()) << std::endl;
std::cout << "file->Seek(file->GetLength() / 2, SEEK_CUR) return value: " <<
- testing::PrintToString(file->Seek(file->GetLength() / 2, SEEK_CUR)) << "\n";
+ testing::PrintToString(file->Seek(file->GetLength() / 2, SEEK_CUR)) << std::endl;
std::cout << "file->Seek(0, SEEK_END) return value: " <<
- testing::PrintToString(file->Seek(0, SEEK_END)) << "\n";
+ testing::PrintToString(file->Seek(0, SEEK_END)) << std::endl;
std::cout << "file->Seek(0, SEEK_SET) return value: " <<
- testing::PrintToString(file->Seek(0, SEEK_SET)) << "\n";
- std::cout << "File contents:\n";
+ testing::PrintToString(file->Seek(0, SEEK_SET)) << std::endl;
+ std::cout << "File contents:" << std::endl;
while ((size = file->Read(buf, sizeof(buf))) > 0)
{
str.Format(" %08X", count);
@@ -206,7 +205,7 @@ TEST_F(TestZipFile, CorruptedFile)
else
std::cout << ".";
}
- std::cout << "]\n";
+ std::cout << "]" << std::endl;
}
file->Close();
XBMC_DELETETEMPFILE(file);
@@ -98,5 +98,5 @@ TEST(TestCPUInfo, getUsedPercentage_output)
CCPUInfo c;
Sleep(1); /* TODO: Support option from main that sets this parameter */
int r = c.getUsedPercentage();
- std::cout << "Percentage: " << testing::PrintToString(r) << "\n";
+ std::cout << "Percentage: " << testing::PrintToString(r) << std::endl;
}
@@ -74,7 +74,7 @@ TEST_F(TestDownloadQueue, RequestContent)
count = 0;
for (it = urls.begin(); it < urls.end(); it++)
{
- std::cout << "Testing URL: " << *it << "\n";
+ std::cout << "Testing URL: " << *it << std::endl;
TICKET t = queue.RequestContent(*it, &observer);
EXPECT_EQ(count, t.dwItemId);
count++;
@@ -99,7 +99,7 @@ TEST_F(TestDownloadQueue, RequestFile)
count = 0;
for (it = urls.begin(); it < urls.end(); it++)
{
- std::cout << "Testing URL: " << *it << "\n";
+ std::cout << "Testing URL: " << *it << std::endl;
TICKET t = queue.RequestFile(*it, &observer);
EXPECT_EQ(count, t.dwItemId);
count++;
@@ -73,9 +73,9 @@ TEST_F(TestDownloadQueueManager, RequestContent)
count = 0;
for (it = urls.begin(); it < urls.end(); it++)
{
- std::cout << "Testing URL: " << *it << "\n";
+ std::cout << "Testing URL: " << *it << std::endl;
TICKET t = g_DownloadManager.RequestContent(*it, &observer);
- std::cout << " Ticket Item ID: " << t.dwItemId << "\n";
+ std::cout << " Ticket Item ID: " << t.dwItemId << std::endl;
count++;
}
@@ -95,9 +95,9 @@ TEST_F(TestDownloadQueueManager, RequestFile)
count = 0;
for (it = urls.begin(); it < urls.end(); it++)
{
- std::cout << "Testing URL: " << *it << "\n";
+ std::cout << "Testing URL: " << *it << std::endl;
TICKET t = g_DownloadManager.RequestFile(*it, &observer);
- std::cout << " Ticket Item ID: " << t.dwItemId << "\n";
+ std::cout << " Ticket Item ID: " << t.dwItemId << std::endl;
count++;
}
@@ -283,10 +283,9 @@ TEST(TestFileOperationJob, GetFunctions)
EXPECT_TRUE(XFILE::CFile::Exists(tmpfilepath));
EXPECT_TRUE(XFILE::CFile::Exists(destfile));
- fprintf(stdout, "GetAverageSpeed(): %s\n", job.GetAverageSpeed().c_str());
- fprintf(stdout, "GetCurrentOperation(): %s\n",
- job.GetCurrentOperation().c_str());
- fprintf(stdout, "GetCurrentFile(): %s\n", job.GetCurrentFile().c_str());
+ std::cout << "GetAverageSpeed(): " << job.GetAverageSpeed() << std::endl;
+ std::cout << "GetCurrentOperation(): " << job.GetCurrentOperation() << std::endl;
+ std::cout << "GetCurrentFile(): " << job.GetCurrentFile() << std::endl;
EXPECT_FALSE(job.GetItems().IsEmpty());
EXPECT_TRUE(XBMC_DELETETEMPFILE(tmpfile));
@@ -47,7 +47,7 @@ TEST(TestPerformanceSample, General)
EXPECT_GT(a.getFreq(), (int64_t)0);
std::cout << "Estimated Error: " <<
- testing::PrintToString(a.GetEstimatedError()) << "\n";
- std::cout << "Start: " << testing::PrintToString(a.getStart()) << "\n";
- std::cout << "Frequency: " << testing::PrintToString(a.getFreq()) << "\n";
+ testing::PrintToString(a.GetEstimatedError()) << std::endl;
+ std::cout << "Start: " << testing::PrintToString(a.getStart()) << std::endl;
+ std::cout << "Frequency: " << testing::PrintToString(a.getFreq()) << std::endl;
}
@@ -39,12 +39,12 @@ TEST(TestStopWatch, Start)
EXPECT_EQ(0.0f, a.GetElapsedSeconds());
EXPECT_EQ(0.0f, a.GetElapsedMilliseconds());
- std::cout << "Calling Start()\n";
+ std::cout << "Calling Start()" << std::endl;
a.Start();
thread.Sleep(1000);
EXPECT_TRUE(a.IsRunning());
- std::cout << "Elapsed Seconds: " << a.GetElapsedSeconds() << "\n";
- std::cout << "Elapsed Milliseconds: " << a.GetElapsedMilliseconds() << "\n";
+ std::cout << "Elapsed Seconds: " << a.GetElapsedSeconds() << std::endl;
+ std::cout << "Elapsed Milliseconds: " << a.GetElapsedMilliseconds() << std::endl;
}
TEST(TestStopWatch, Stop)
@@ -56,12 +56,12 @@ TEST(TestStopWatch, Stop)
EXPECT_EQ(0.0f, a.GetElapsedSeconds());
EXPECT_EQ(0.0f, a.GetElapsedMilliseconds());
- std::cout << "Calling Start()\n";
+ std::cout << "Calling Start()" << std::endl;
a.Start();
thread.Sleep(1000);
EXPECT_TRUE(a.IsRunning());
- std::cout << "Elapsed Seconds: " << a.GetElapsedSeconds() << "\n";
- std::cout << "Elapsed Milliseconds: " << a.GetElapsedMilliseconds() << "\n";
+ std::cout << "Elapsed Seconds: " << a.GetElapsedSeconds() << std::endl;
+ std::cout << "Elapsed Milliseconds: " << a.GetElapsedMilliseconds() << std::endl;
a.Stop();
EXPECT_FALSE(a.IsRunning());
@@ -78,19 +78,19 @@ TEST(TestStopWatch, StartZero)
EXPECT_EQ(0.0f, a.GetElapsedSeconds());
EXPECT_EQ(0.0f, a.GetElapsedMilliseconds());
- std::cout << "Calling StartZero()\n";
+ std::cout << "Calling StartZero()" << std::endl;
a.StartZero();
thread.Sleep(1000);
EXPECT_TRUE(a.IsRunning());
- std::cout << "Elapsed Seconds: " << a.GetElapsedSeconds() << "\n";
- std::cout << "Elapsed Milliseconds: " << a.GetElapsedMilliseconds() << "\n";
+ std::cout << "Elapsed Seconds: " << a.GetElapsedSeconds() << std::endl;
+ std::cout << "Elapsed Milliseconds: " << a.GetElapsedMilliseconds() << std::endl;
- std::cout << "Calling StartZero()\n";
+ std::cout << "Calling StartZero()" << std::endl;
a.StartZero();
thread.Sleep(1000);
EXPECT_TRUE(a.IsRunning());
- std::cout << "Elapsed Seconds: " << a.GetElapsedSeconds() << "\n";
- std::cout << "Elapsed Milliseconds: " << a.GetElapsedMilliseconds() << "\n";
+ std::cout << "Elapsed Seconds: " << a.GetElapsedSeconds() << std::endl;
+ std::cout << "Elapsed Milliseconds: " << a.GetElapsedMilliseconds() << std::endl;
}
TEST(TestStopWatch, Reset)
@@ -102,17 +102,17 @@ TEST(TestStopWatch, Reset)
EXPECT_EQ(0.0f, a.GetElapsedSeconds());
EXPECT_EQ(0.0f, a.GetElapsedMilliseconds());
- std::cout << "Calling StartZero()\n";
+ std::cout << "Calling StartZero()" << std::endl;
a.StartZero();
thread.Sleep(1000);
EXPECT_TRUE(a.IsRunning());
- std::cout << "Elapsed Seconds: " << a.GetElapsedSeconds() << "\n";
- std::cout << "Elapsed Milliseconds: " << a.GetElapsedMilliseconds() << "\n";
+ std::cout << "Elapsed Seconds: " << a.GetElapsedSeconds() << std::endl;
+ std::cout << "Elapsed Milliseconds: " << a.GetElapsedMilliseconds() << std::endl;
- std::cout << "Calling Reset()\n";
+ std::cout << "Calling Reset()" << std::endl;
a.Reset();
thread.Sleep(1000);
EXPECT_TRUE(a.IsRunning());
- std::cout << "Elapsed Seconds: " << a.GetElapsedSeconds() << "\n";
- std::cout << "Elapsed Milliseconds: " << a.GetElapsedMilliseconds() << "\n";
+ std::cout << "Elapsed Seconds: " << a.GetElapsedSeconds() << std::endl;
+ std::cout << "Elapsed Milliseconds: " << a.GetElapsedMilliseconds() << std::endl;
}
@@ -428,7 +428,7 @@ TEST(TestStringUtils, WordToDigits)
TEST(TestStringUtils, CreateUUID)
{
- std::cout << "CreateUUID(): " << StringUtils::CreateUUID() << "\n";
+ std::cout << "CreateUUID(): " << StringUtils::CreateUUID() << std::endl;
}
TEST(TestStringUtils, ValidateUUID)
Oops, something went wrong.

0 comments on commit 39af002

Please sign in to comment.