Replaced STL streams with LLVM's raw_ostream (#344)

std::cout and std::printf were replaced with llvm::outs() and std::cerr was replaced with llvm::errs().
This commit is contained in:
Tyler Veness
2017-06-30 22:33:43 -04:00
committed by Peter Johnson
parent c57a7f0a41
commit 9d93820717
27 changed files with 118 additions and 118 deletions

View File

@@ -10,6 +10,7 @@
#include "TestBench.h"
#include "Timer.h"
#include "gtest/gtest.h"
#include "llvm/raw_ostream.h"
using namespace frc;
@@ -21,21 +22,21 @@ void notifierHandler(void*) { notifierCounter++; }
* Test if the Wait function works
*/
TEST(NotifierTest, DISABLED_TestTimerNotifications) {
std::cout << "NotifierTest..." << std::endl;
llvm::outs() << "NotifierTest...\n";
notifierCounter = 0;
std::cout << "notifier(notifierHandler, nullptr)..." << std::endl;
llvm::outs() << "notifier(notifierHandler, nullptr)...\n";
Notifier notifier(notifierHandler, nullptr);
std::cout << "Start Periodic..." << std::endl;
llvm::outs() << "Start Periodic...\n";
notifier.StartPeriodic(1.0);
std::cout << "Wait..." << std::endl;
llvm::outs() << "Wait...\n";
Wait(10.5);
std::cout << "...Wait" << std::endl;
llvm::outs() << "...Wait\n";
EXPECT_EQ(10u, notifierCounter) << "Received " << notifierCounter
<< " notifications in 10.5 seconds";
std::cout << "Received " << notifierCounter
<< " notifications in 10.5 seconds";
llvm::outs() << "Received " << notifierCounter
<< " notifications in 10.5 seconds";
std::cout << "...NotifierTest" << std::endl;
llvm::outs() << "...NotifierTest\n";
}

View File

@@ -12,6 +12,7 @@
#include "LiveWindow/LiveWindow.h"
#include "Timer.h"
#include "gtest/gtest.h"
#include "llvm/raw_ostream.h"
using namespace frc;
@@ -26,7 +27,7 @@ class TestEnvironment : public testing::Environment {
m_alreadySetUp = true;
if (!HAL_Initialize(0)) {
std::cerr << "FATAL ERROR: HAL could not be initialized" << std::endl;
llvm::errs() << "FATAL ERROR: HAL could not be initialized\n";
std::exit(-1);
}
@@ -37,7 +38,7 @@ class TestEnvironment : public testing::Environment {
HAL_ObserveUserProgramStarting();
LiveWindow::GetInstance()->SetEnabled(false);
std::cout << "Waiting for enable" << std::endl;
llvm::outs() << "Waiting for enable\n";
while (!DriverStation::GetInstance().IsEnabled()) {
Wait(0.1);