From 8d218dbca4f0c27be896f7197eecc1a3b4bb8a8d Mon Sep 17 00:00:00 2001 From: Thad House Date: Sun, 27 May 2018 23:07:03 -0700 Subject: [PATCH] Add support for unit testing from GradleRIO for C++ projects (#1094) In order for this to properly work, we need to remove the main code. Then the test component will actually have the main in it. Example tests will be added later. --- .../src/main/cpp/templates/commandbased/cpp/Robot.cpp | 2 ++ wpilibcExamples/src/main/cpp/templates/iterative/cpp/Robot.cpp | 2 ++ wpilibcExamples/src/main/cpp/templates/sample/cpp/Robot.cpp | 2 ++ wpilibcExamples/src/main/cpp/templates/timed/cpp/Robot.cpp | 2 ++ 4 files changed, 8 insertions(+) diff --git a/wpilibcExamples/src/main/cpp/templates/commandbased/cpp/Robot.cpp b/wpilibcExamples/src/main/cpp/templates/commandbased/cpp/Robot.cpp index ed2f2764a4..6541648966 100644 --- a/wpilibcExamples/src/main/cpp/templates/commandbased/cpp/Robot.cpp +++ b/wpilibcExamples/src/main/cpp/templates/commandbased/cpp/Robot.cpp @@ -72,4 +72,6 @@ void Robot::TeleopPeriodic() { frc::Scheduler::GetInstance()->Run(); } void Robot::TestPeriodic() {} +#ifndef RUNNING_FRC_TESTS int main() { return frc::StartRobot(); } +#endif diff --git a/wpilibcExamples/src/main/cpp/templates/iterative/cpp/Robot.cpp b/wpilibcExamples/src/main/cpp/templates/iterative/cpp/Robot.cpp index dd3454651f..d1450a4c82 100644 --- a/wpilibcExamples/src/main/cpp/templates/iterative/cpp/Robot.cpp +++ b/wpilibcExamples/src/main/cpp/templates/iterative/cpp/Robot.cpp @@ -55,4 +55,6 @@ void Robot::TeleopPeriodic() {} void Robot::TestPeriodic() {} +#ifndef RUNNING_FRC_TESTS int main() { return frc::StartRobot(); } +#endif diff --git a/wpilibcExamples/src/main/cpp/templates/sample/cpp/Robot.cpp b/wpilibcExamples/src/main/cpp/templates/sample/cpp/Robot.cpp index a050d6781b..d7efdb882f 100644 --- a/wpilibcExamples/src/main/cpp/templates/sample/cpp/Robot.cpp +++ b/wpilibcExamples/src/main/cpp/templates/sample/cpp/Robot.cpp @@ -87,4 +87,6 @@ void Robot::OperatorControl() { */ void Robot::Test() {} +#ifndef RUNNING_FRC_TESTS int main() { return frc::StartRobot(); } +#endif diff --git a/wpilibcExamples/src/main/cpp/templates/timed/cpp/Robot.cpp b/wpilibcExamples/src/main/cpp/templates/timed/cpp/Robot.cpp index 9703206c13..9544e613fc 100644 --- a/wpilibcExamples/src/main/cpp/templates/timed/cpp/Robot.cpp +++ b/wpilibcExamples/src/main/cpp/templates/timed/cpp/Robot.cpp @@ -55,4 +55,6 @@ void Robot::TeleopPeriodic() {} void Robot::TestPeriodic() {} +#ifndef RUNNING_FRC_TESTS int main() { return frc::StartRobot(); } +#endif