Switch to TeamNumberEnvironment in the last spots
We had a couple stragglers who were not using
TeamNumberEnvironment. Switch them over.
Change-Id: I33f3e56d70013e256d632659ee7df1f5cae2ae73
diff --git a/y2014/control_loops/claw/BUILD b/y2014/control_loops/claw/BUILD
index 5602bbc..45a77b0 100644
--- a/y2014/control_loops/claw/BUILD
+++ b/y2014/control_loops/claw/BUILD
@@ -69,11 +69,12 @@
'claw_lib_test.cc',
],
deps = [
- '//aos/testing:googletest',
- ':claw_queue',
':claw_lib',
- '//frc971/control_loops:state_feedback_loop',
+ ':claw_queue',
'//aos/common/controls:control_loop_test',
+ '//aos/testing:googletest',
+ '//frc971/control_loops:state_feedback_loop',
+ '//frc971/control_loops:team_number_test_environment',
],
)
diff --git a/y2014/control_loops/claw/claw_lib_test.cc b/y2014/control_loops/claw/claw_lib_test.cc
index 8444cea..8a7e9c3 100644
--- a/y2014/control_loops/claw/claw_lib_test.cc
+++ b/y2014/control_loops/claw/claw_lib_test.cc
@@ -4,7 +4,7 @@
#include <memory>
#include "aos/common/controls/control_loop_test.h"
-#include "aos/common/network/team_number.h"
+#include "frc971/control_loops/team_number_test_environment.h"
#include "gtest/gtest.h"
#include "y2014/constants.h"
#include "y2014/control_loops/claw/claw.h"
@@ -28,15 +28,6 @@
CLAW_COUNT
} ClawType;
-class TeamNumberEnvironment : public ::testing::Environment {
- public:
- // Override this to define how to set up the environment.
- virtual void SetUp() { aos::network::OverrideTeamNumber(1); }
-};
-
-::testing::Environment* const team_number_env =
- ::testing::AddGlobalTestEnvironment(new TeamNumberEnvironment);
-
// Class which simulates the wrist and sends out queue messages containing the
// position.
class ClawMotorSimulation {
diff --git a/y2014/control_loops/shooter/BUILD b/y2014/control_loops/shooter/BUILD
index c10baae..8195060 100644
--- a/y2014/control_loops/shooter/BUILD
+++ b/y2014/control_loops/shooter/BUILD
@@ -68,11 +68,12 @@
'shooter_lib_test.cc',
],
deps = [
- '//aos/testing:googletest',
- ':shooter_queue',
':shooter_lib',
+ ':shooter_queue',
'//aos/common/controls:control_loop_test',
+ '//aos/testing:googletest',
'//frc971/control_loops:state_feedback_loop',
+ '//frc971/control_loops:team_number_test_environment',
],
)
diff --git a/y2014/control_loops/shooter/shooter_lib_test.cc b/y2014/control_loops/shooter/shooter_lib_test.cc
index df3f5fd..851e617 100644
--- a/y2014/control_loops/shooter/shooter_lib_test.cc
+++ b/y2014/control_loops/shooter/shooter_lib_test.cc
@@ -3,13 +3,14 @@
#include <chrono>
#include <memory>
-#include "gtest/gtest.h"
-#include "aos/common/network/team_number.h"
#include "aos/common/controls/control_loop_test.h"
-#include "y2014/control_loops/shooter/shooter.q.h"
-#include "y2014/control_loops/shooter/shooter.h"
-#include "y2014/control_loops/shooter/unaugmented_shooter_motor_plant.h"
+#include "aos/common/network/team_number.h"
+#include "frc971/control_loops/team_number_test_environment.h"
+#include "gtest/gtest.h"
#include "y2014/constants.h"
+#include "y2014/control_loops/shooter/shooter.h"
+#include "y2014/control_loops/shooter/shooter.q.h"
+#include "y2014/control_loops/shooter/unaugmented_shooter_motor_plant.h"
namespace chrono = ::std::chrono;
using ::aos::monotonic_clock;
@@ -20,18 +21,7 @@
using ::y2014::control_loops::shooter::kMaxExtension;
using ::y2014::control_loops::shooter::MakeRawShooterPlant;
-
-static const int kTestTeam = 1;
-
-class TeamNumberEnvironment : public ::testing::Environment {
- public:
- // Override this to define how to set up the environment.
- virtual void SetUp() { aos::network::OverrideTeamNumber(kTestTeam); }
-};
-
-::testing::Environment *const team_number_env =
- ::testing::AddGlobalTestEnvironment(new TeamNumberEnvironment);
-
+using ::frc971::control_loops::testing::kTeamNumber;
// Class which simulates the shooter and sends out queue messages containing the
// position.
@@ -463,9 +453,8 @@
shooter_motor_.Iterate();
shooter_motor_plant_.Simulate();
SimulateTimestep(true);
- EXPECT_LT(
- shooter_motor_plant_.GetAbsolutePosition(),
- constants::GetValuesForTeam(kTestTeam).shooter.upper_limit);
+ EXPECT_LT(shooter_motor_plant_.GetAbsolutePosition(),
+ constants::GetValuesForTeam(kTeamNumber).shooter.upper_limit);
}
EXPECT_EQ(ShooterMotor::STATE_READY, shooter_motor_.state());
}
@@ -725,12 +714,12 @@
::testing::Bool(), ::testing::Bool(), ::testing::Bool(),
::testing::Values(
0.05,
- constants::GetValuesForTeam(kTestTeam).shooter.upper_limit - 0.05,
- HallEffectMiddle(constants::GetValuesForTeam(kTestTeam)
+ constants::GetValuesForTeam(kTeamNumber).shooter.upper_limit - 0.05,
+ HallEffectMiddle(constants::GetValuesForTeam(kTeamNumber)
.shooter.pusher_proximal),
- HallEffectMiddle(constants::GetValuesForTeam(kTestTeam)
- .shooter.pusher_distal),
- constants::GetValuesForTeam(kTestTeam)
+ HallEffectMiddle(
+ constants::GetValuesForTeam(kTeamNumber).shooter.pusher_distal),
+ constants::GetValuesForTeam(kTeamNumber)
.shooter.latch_max_safe_position -
0.001)));