Fixes warnings thrown by cpplint.py (#154)

* Fixed cpplint.py [runtime/int] warnings

* Fixed cpplint.py [readability/casting] warnings

* Fixed cpplint.py [readability/namespace] warnings

* Fixed cpplint.py [readability/braces] warnings

* Fixed cpplint.py [whitespace/braces] warnings

* Fixed cpplint.py [runtime/explicit] warnings

* Fixed cpplint.py [runtime/printf] warnings

* Fixed cpplint.py [readability/inheritance] warnings

* Fixed cpplint.py [whitespace/tab] warnings

* Fixed cpplint.py [build/storage_class] warnings

* Fixed cpplint.py [readability/multiline_comment] warnings

* Fixed cpplint.py [whitespace/semicolon] warnings

* Fixed cpplint.py [readability/check] warnings

* Fixed cpplint.py [runtime/arrays] warnings

* Ran format.py
This commit is contained in:
Tyler Veness
2016-07-10 17:47:44 -07:00
committed by Peter Johnson
parent e44a6e227a
commit 0cb288ffba
141 changed files with 670 additions and 626 deletions

View File

@@ -24,12 +24,12 @@ class AnalogLoopTest : public testing::Test {
AnalogInput* m_input;
AnalogOutput* m_output;
virtual void SetUp() override {
void SetUp() override {
m_input = new AnalogInput(TestBench::kFakeAnalogOutputChannel);
m_output = new AnalogOutput(TestBench::kAnalogOutputChannel);
}
virtual void TearDown() override {
void TearDown() override {
delete m_input;
delete m_output;
}
@@ -104,7 +104,7 @@ TEST_F(AnalogLoopTest, AnalogTriggerCounterWorks) {
}
static void InterruptHandler(uint32_t interruptAssertedMask, void* param) {
*(int*)param = 12345;
*reinterpret_cast<int*>(param) = 12345;
}
TEST_F(AnalogLoopTest, AsynchronusInterruptWorks) {

View File

@@ -22,13 +22,13 @@ class AnalogPotentiometerTest : public testing::Test {
AnalogOutput* m_fakePot;
AnalogPotentiometer* m_pot;
virtual void SetUp() override {
void SetUp() override {
m_fakePot = new AnalogOutput(TestBench::kAnalogOutputChannel);
m_pot =
new AnalogPotentiometer(TestBench::kFakeAnalogOutputChannel, kScale);
}
virtual void TearDown() override {
void TearDown() override {
delete m_fakePot;
delete m_pot;
}

View File

@@ -46,7 +46,7 @@ class CANJaguarTest : public testing::Test {
AnalogOutput* m_fakePotentiometer;
Relay* m_spike;
virtual void SetUp() override {
void SetUp() override {
m_spike = new Relay(TestBench::kCANJaguarRelayChannel, Relay::kForwardOnly);
m_spike->Set(Relay::kOn);
Wait(kSpikeTime);
@@ -66,7 +66,7 @@ class CANJaguarTest : public testing::Test {
Wait(kEncoderSettlingTime);
}
virtual void TearDown() override {
void TearDown() override {
delete m_jaguar;
delete m_fakeForwardLimit;
delete m_fakeReverseLimit;

View File

@@ -41,7 +41,7 @@ class ConditionVariableTest : public ::testing::Test {
// Information for when running with predicates.
std::atomic<bool> m_pred_var{false};
void ShortSleep(unsigned long time = 10) {
void ShortSleep(uint32_t time = 10) {
std::this_thread::sleep_for(std::chrono::milliseconds(time));
}

View File

@@ -28,7 +28,7 @@ class CounterTest : public testing::Test {
Victor* m_victor;
Jaguar* m_jaguar;
virtual void SetUp() override {
void SetUp() override {
m_talonCounter = new Counter(TestBench::kTalonEncoderChannelA);
m_victorCounter = new Counter(TestBench::kVictorEncoderChannelA);
m_jaguarCounter = new Counter(TestBench::kJaguarEncoderChannelA);
@@ -37,7 +37,7 @@ class CounterTest : public testing::Test {
m_jaguar = new Jaguar(TestBench::kJaguarChannel);
}
virtual void TearDown() override {
void TearDown() override {
delete m_talonCounter;
delete m_victorCounter;
delete m_jaguarCounter;

View File

@@ -31,12 +31,12 @@ class DIOLoopTest : public testing::Test {
DigitalInput* m_input;
DigitalOutput* m_output;
virtual void SetUp() override {
void SetUp() override {
m_input = new DigitalInput(TestBench::kLoop1InputChannel);
m_output = new DigitalOutput(TestBench::kLoop1OutputChannel);
}
virtual void TearDown() override {
void TearDown() override {
delete m_input;
delete m_output;
}
@@ -140,7 +140,7 @@ TEST_F(DIOLoopTest, FakeCounter) {
}
static void InterruptHandler(uint32_t interruptAssertedMask, void* param) {
*(int*)param = 12345;
*reinterpret_cast<int*>(param) = 12345;
}
TEST_F(DIOLoopTest, AsynchronousInterruptWorks) {

View File

@@ -27,7 +27,7 @@ class FakeEncoderTest : public testing::Test {
AnalogTrigger* m_indexAnalogTrigger;
std::shared_ptr<AnalogTriggerOutput> m_indexAnalogTriggerOutput;
virtual void SetUp() override {
void SetUp() override {
m_outputA = new DigitalOutput(TestBench::kLoop2OutputChannel);
m_outputB = new DigitalOutput(TestBench::kLoop1OutputChannel);
m_indexOutput = new AnalogOutput(TestBench::kAnalogOutputChannel);
@@ -42,7 +42,7 @@ class FakeEncoderTest : public testing::Test {
m_indexAnalogTrigger->CreateOutput(AnalogTriggerType::kState);
}
virtual void TearDown() override {
void TearDown() override {
delete m_outputA;
delete m_outputB;
delete m_indexOutput;

View File

@@ -38,7 +38,7 @@ std::ostream& operator<<(std::ostream& os, const FilterOutputTestType& type) {
class DataWrapper : public PIDSource {
public:
DataWrapper(double (*dataFunc)(double)) { m_dataFunc = dataFunc; }
explicit DataWrapper(double (*dataFunc)(double)) { m_dataFunc = dataFunc; }
virtual void SetPIDSourceType(PIDSourceType pidSource) {}

View File

@@ -44,7 +44,7 @@ class MotorEncoderTest : public testing::TestWithParam<MotorEncoderTestType> {
SpeedController* m_speedController;
Encoder* m_encoder;
virtual void SetUp() override {
void SetUp() override {
switch (GetParam()) {
case TEST_VICTOR:
m_speedController = new Victor(TestBench::kVictorChannel);
@@ -66,7 +66,7 @@ class MotorEncoderTest : public testing::TestWithParam<MotorEncoderTestType> {
}
}
virtual void TearDown() override {
void TearDown() override {
delete m_speedController;
delete m_encoder;
}

View File

@@ -37,7 +37,7 @@ class MotorInvertingTest
protected:
SpeedController* m_speedController;
Encoder* m_encoder;
virtual void SetUp() override {
void SetUp() override {
switch (GetParam()) {
case TEST_VICTOR:
m_speedController = new Victor(TestBench::kVictorChannel);
@@ -58,7 +58,7 @@ class MotorInvertingTest
break;
}
}
virtual void TearDown() override {
void TearDown() override {
delete m_speedController;
delete m_encoder;
}

View File

@@ -53,15 +53,15 @@ void SetProcessorAffinity(int core_id) {
CPU_SET(core_id, &cpuset);
pthread_t current_thread = pthread_self();
ASSERT_TRUE(
pthread_setaffinity_np(current_thread, sizeof(cpu_set_t), &cpuset) == 0);
ASSERT_EQ(pthread_setaffinity_np(current_thread, sizeof(cpu_set_t), &cpuset),
0);
}
void SetThreadRealtimePriorityOrDie(int priority) {
struct sched_param param;
// Set realtime priority for this thread
param.sched_priority = priority + sched_get_priority_min(SCHED_RR);
ASSERT_TRUE(pthread_setschedparam(pthread_self(), SCHED_RR, &param) == 0)
ASSERT_EQ(pthread_setschedparam(pthread_self(), SCHED_RR, &param), 0)
<< ": Failed to set scheduler priority.";
}
@@ -69,7 +69,7 @@ void SetThreadRealtimePriorityOrDie(int priority) {
template <typename MutexType>
class LowPriorityThread {
public:
LowPriorityThread(MutexType* mutex)
explicit LowPriorityThread(MutexType* mutex)
: m_mutex(mutex), m_hold_mutex(1), m_success(0) {}
void operator()() {
@@ -137,7 +137,7 @@ class BusyWaitingThread {
template <typename MutexType>
class HighPriorityThread {
public:
HighPriorityThread(MutexType* mutex) : m_mutex(mutex), m_success(0) {}
explicit HighPriorityThread(MutexType* mutex) : m_mutex(mutex) {}
void operator()() {
SetProcessorAffinity(0);
@@ -153,7 +153,7 @@ class HighPriorityThread {
private:
Notification m_started;
MutexType* m_mutex;
std::atomic<int> m_success;
std::atomic<int> m_success{0};
};
// Class to test a MutexType to see if it solves the priority inheritance

View File

@@ -37,7 +37,7 @@ class PCMTest : public testing::Test {
DoubleSolenoid* m_doubleSolenoid;
DigitalInput *m_fakeSolenoid1, *m_fakeSolenoid2;
virtual void SetUp() override {
void SetUp() override {
m_compressor = new Compressor();
m_fakePressureSwitch =
@@ -47,7 +47,7 @@ class PCMTest : public testing::Test {
m_fakeSolenoid2 = new DigitalInput(TestBench::kFakeSolenoid2Channel);
}
virtual void TearDown() override {
void TearDown() override {
delete m_compressor;
delete m_fakePressureSwitch;
delete m_fakeCompressor;

View File

@@ -23,10 +23,7 @@ class PIDToleranceTest : public testing::Test {
double val = 0;
void SetPIDSourceType(PIDSourceType pidSource) {}
PIDSourceType GetPIDSourceType() { return PIDSourceType::kDisplacement; }
double PIDGet() {
;
return val;
}
double PIDGet() { return val; }
};
class fakeOutput : public PIDOutput {
void PIDWrite(float output) {}
@@ -34,16 +31,16 @@ class PIDToleranceTest : public testing::Test {
fakeInput inp;
fakeOutput out;
PIDController* pid;
virtual void SetUp() override {
void SetUp() override {
pid = new PIDController(0.5, 0.0, 0.0, &inp, &out);
pid->SetInputRange(-range / 2, range / 2);
}
virtual void TearDown() override { delete pid; }
virtual void reset() { inp.val = 0; }
void TearDown() override { delete pid; }
void Reset() { inp.val = 0; }
};
TEST_F(PIDToleranceTest, Absolute) {
reset();
Reset();
pid->SetAbsoluteTolerance(tolerance);
pid->SetSetpoint(setpoint);
pid->Enable();
@@ -63,7 +60,7 @@ TEST_F(PIDToleranceTest, Absolute) {
}
TEST_F(PIDToleranceTest, Percent) {
reset();
Reset();
pid->SetPercentTolerance(tolerance);
pid->SetSetpoint(setpoint);
pid->Enable();

View File

@@ -24,14 +24,14 @@ class PowerDistributionPanelTest : public testing::Test {
Victor* m_victor;
Jaguar* m_jaguar;
virtual void SetUp() override {
void SetUp() override {
m_pdp = new PowerDistributionPanel();
m_talon = new Talon(TestBench::kTalonChannel);
m_victor = new Victor(TestBench::kVictorChannel);
m_jaguar = new Jaguar(TestBench::kJaguarChannel);
}
virtual void TearDown() override {
void TearDown() override {
delete m_pdp;
delete m_talon;
delete m_victor;

View File

@@ -21,19 +21,19 @@ class RelayTest : public testing::Test {
DigitalInput* m_forward;
DigitalInput* m_reverse;
virtual void SetUp() override {
void SetUp() override {
m_relay = new Relay(TestBench::kRelayChannel);
m_forward = new DigitalInput(TestBench::kFakeRelayForward);
m_reverse = new DigitalInput(TestBench::kFakeRelayReverse);
}
virtual void TearDown() override {
void TearDown() override {
delete m_relay;
delete m_forward;
delete m_reverse;
}
virtual void Reset() { m_relay->Set(Relay::kOff); }
void Reset() { m_relay->Set(Relay::kOff); }
};
/**
* Test the relay by setting it forward, reverse, off, and on.

View File

@@ -15,7 +15,7 @@ class TestEnvironment : public testing::Environment {
bool m_alreadySetUp = false;
public:
virtual void SetUp() override {
void SetUp() override {
/* Only set up once. This allows gtest_repeat to be used to
automatically repeat tests. */
if (m_alreadySetUp) return;
@@ -40,7 +40,7 @@ class TestEnvironment : public testing::Environment {
}
}
virtual void TearDown() override {}
void TearDown() override {}
};
testing::Environment* const environment =

View File

@@ -42,7 +42,7 @@ class TiltPanCameraTest : public testing::Test {
static void TearDownTestCase() { delete m_gyro; }
virtual void SetUp() override {
void SetUp() override {
m_tilt = new Servo(TestBench::kCameraTiltChannel);
m_pan = new Servo(TestBench::kCameraPanChannel);
m_spiAccel = new ADXL345_SPI(SPI::kOnboardCS0);
@@ -59,7 +59,7 @@ class TiltPanCameraTest : public testing::Test {
void GyroAngle();
void GyroCalibratedParameters();
virtual void TearDown() override {
void TearDown() override {
delete m_tilt;
delete m_pan;
delete m_spiAccel;

View File

@@ -17,9 +17,9 @@ class TimerTest : public testing::Test {
protected:
Timer* m_timer;
virtual void SetUp() override { m_timer = new Timer; }
void SetUp() override { m_timer = new Timer; }
virtual void TearDown() override { delete m_timer; }
void TearDown() override { delete m_timer; }
void Reset() { m_timer->Reset(); }
};

View File

@@ -17,7 +17,7 @@
class CommandTest : public testing::Test {
protected:
virtual void SetUp() override {
void SetUp() override {
RobotState::SetImplementation(DriverStation::GetInstance());
Scheduler::GetInstance()->SetEnabled(true);
}
@@ -48,9 +48,9 @@ class ASubsystem : public Subsystem {
Command* m_command = nullptr;
public:
ASubsystem(const std::string& name) : Subsystem(name) {}
explicit ASubsystem(const std::string& name) : Subsystem(name) {}
virtual void InitDefaultCommand() override {
void InitDefaultCommand() override {
if (m_command != nullptr) {
SetDefaultCommand(m_command);
}