Skip to content

Commit

Permalink
Make C++ examples able to run GradleRIO unit tests (#1490)
Browse files Browse the repository at this point in the history
Closes #1484
  • Loading branch information
ThadHouse authored and PeterJohnson committed Dec 17, 2018
1 parent d84240d commit 6e8f8be
Show file tree
Hide file tree
Showing 21 changed files with 42 additions and 0 deletions.
Expand Up @@ -27,4 +27,6 @@ class Robot : public frc::TimedRobot {
}
};

#ifndef RUNNING_FRC_TESTS
int main() { return frc::StartRobot<Robot>(); }
#endif
Expand Up @@ -60,4 +60,6 @@ class Robot : public frc::TimedRobot {
}
};

#ifndef RUNNING_FRC_TESTS
int main() { return frc::StartRobot<Robot>(); }
#endif
2 changes: 2 additions & 0 deletions wpilibcExamples/src/main/cpp/examples/CANPDP/cpp/Robot.cpp
Expand Up @@ -37,4 +37,6 @@ class Robot : public frc::TimedRobot {
frc::PowerDistributionPanel m_pdp;
};

#ifndef RUNNING_FRC_TESTS
int main() { return frc::StartRobot<Robot>(); }
#endif
2 changes: 2 additions & 0 deletions wpilibcExamples/src/main/cpp/examples/Encoder/cpp/Robot.cpp
Expand Up @@ -80,4 +80,6 @@ class Robot : public frc::TimedRobot {
frc::Encoder m_encoder{1, 2, false, frc::Encoder::k4X};
};

#ifndef RUNNING_FRC_TESTS
int main() { return frc::StartRobot<Robot>(); }
#endif
2 changes: 2 additions & 0 deletions wpilibcExamples/src/main/cpp/examples/GearsBot/cpp/Robot.cpp
Expand Up @@ -42,4 +42,6 @@ void Robot::TeleopPeriodic() { frc::Scheduler::GetInstance()->Run(); }

void Robot::TestPeriodic() {}

#ifndef RUNNING_FRC_TESTS
int main() { return frc::StartRobot<Robot>(); }
#endif
Expand Up @@ -55,4 +55,6 @@ class Robot : public frc::TimedRobot {
frc::Timer m_timer;
};

#ifndef RUNNING_FRC_TESTS
int main() { return frc::StartRobot<Robot>(); }
#endif
2 changes: 2 additions & 0 deletions wpilibcExamples/src/main/cpp/examples/Gyro/cpp/Robot.cpp
Expand Up @@ -55,4 +55,6 @@ class Robot : public frc::TimedRobot {
frc::Joystick m_joystick{kJoystickPort};
};

#ifndef RUNNING_FRC_TESTS
int main() { return frc::StartRobot<Robot>(); }
#endif
Expand Up @@ -58,4 +58,6 @@ class Robot : public frc::TimedRobot {
frc::Joystick m_joystick{kJoystickPort};
};

#ifndef RUNNING_FRC_TESTS
int main() { return frc::StartRobot<Robot>(); }
#endif
2 changes: 2 additions & 0 deletions wpilibcExamples/src/main/cpp/examples/HidRumble/cpp/Robot.cpp
Expand Up @@ -30,4 +30,6 @@ class Robot : public frc::TimedRobot {
frc::XboxController m_hid{0};
};

#ifndef RUNNING_FRC_TESTS
int main() { return frc::StartRobot<Robot>(); }
#endif
Expand Up @@ -73,4 +73,6 @@ class Robot : public frc::TimedRobot {
}
};

#ifndef RUNNING_FRC_TESTS
int main() { return frc::StartRobot<Robot>(); }
#endif
Expand Up @@ -48,4 +48,6 @@ class Robot : public frc::TimedRobot {
frc::Joystick m_stick{kJoystickChannel};
};

#ifndef RUNNING_FRC_TESTS
int main() { return frc::StartRobot<Robot>(); }
#endif
Expand Up @@ -26,4 +26,6 @@ class Robot : public frc::TimedRobot {
frc::Spark m_motor{0};
};

#ifndef RUNNING_FRC_TESTS
int main() { return frc::StartRobot<Robot>(); }
#endif
Expand Up @@ -48,4 +48,6 @@ class Robot : public frc::TimedRobot {
frc::Encoder m_encoder{0, 1};
};

#ifndef RUNNING_FRC_TESTS
int main() { return frc::StartRobot<Robot>(); }
#endif
2 changes: 2 additions & 0 deletions wpilibcExamples/src/main/cpp/examples/PacGoat/cpp/Robot.cpp
Expand Up @@ -80,4 +80,6 @@ void Robot::Log() {
drivetrain.GetRightEncoder().GetDistance());
}

#ifndef RUNNING_FRC_TESTS
int main() { return frc::StartRobot<Robot>(); }
#endif
Expand Up @@ -73,4 +73,6 @@ class Robot : public frc::TimedRobot {

constexpr std::array<double, 3> Robot::kSetPoints;

#ifndef RUNNING_FRC_TESTS
int main() { return frc::StartRobot<Robot>(); }
#endif
Expand Up @@ -27,4 +27,6 @@ class Robot : public frc::TimedRobot {
}
};

#ifndef RUNNING_FRC_TESTS
int main() { return frc::StartRobot<Robot>(); }
#endif
2 changes: 2 additions & 0 deletions wpilibcExamples/src/main/cpp/examples/Relay/cpp/Robot.cpp
Expand Up @@ -55,4 +55,6 @@ class Robot : public frc::TimedRobot {
static constexpr int kRelayReverseButton = 2;
};

#ifndef RUNNING_FRC_TESTS
int main() { return frc::StartRobot<Robot>(); }
#endif
Expand Up @@ -79,4 +79,6 @@ class Robot : public frc::TimedRobot {
nt::NetworkTableEntry m_maxSpeed;
};

#ifndef RUNNING_FRC_TESTS
int main() { return frc::StartRobot<Robot>(); }
#endif
2 changes: 2 additions & 0 deletions wpilibcExamples/src/main/cpp/examples/Solenoid/cpp/Robot.cpp
Expand Up @@ -67,4 +67,6 @@ class Robot : public frc::TimedRobot {
static constexpr int kDoubleSolenoidReverse = 3;
};

#ifndef RUNNING_FRC_TESTS
int main() { return frc::StartRobot<Robot>(); }
#endif
Expand Up @@ -50,4 +50,6 @@ class Robot : public frc::TimedRobot {
frc::DifferentialDrive m_robotDrive{m_left, m_right};
};

#ifndef RUNNING_FRC_TESTS
int main() { return frc::StartRobot<Robot>(); }
#endif
Expand Up @@ -80,4 +80,6 @@ class Robot : public frc::TimedRobot {
frc::PIDController m_pidController{kP, kI, kD, m_ultrasonic, m_pidOutput};
};

#ifndef RUNNING_FRC_TESTS
int main() { return frc::StartRobot<Robot>(); }
#endif

0 comments on commit 6e8f8be

Please sign in to comment.