sensors/zones: place in namespace and cleanup

Signed-off-by: Patrick Venture <venture@google.com>
Change-Id: I527dbc8477a232945f696227a7b0b2adbee45175
diff --git a/test/controller_mock.hpp b/test/controller_mock.hpp
index 52c21a9..f1c9d56 100644
--- a/test/controller_mock.hpp
+++ b/test/controller_mock.hpp
@@ -4,6 +4,9 @@
 
 #include <gmock/gmock.h>
 
+namespace pid_control
+{
+
 class ControllerMock : public PIDController
 {
   public:
@@ -17,3 +20,5 @@
     MOCK_METHOD0(setptProc, double());
     MOCK_METHOD1(outputProc, void(double));
 };
+
+} // namespace pid_control
diff --git a/test/dbus_active_unittest.cpp b/test/dbus_active_unittest.cpp
index 142cc1a..054ad1d 100644
--- a/test/dbus_active_unittest.cpp
+++ b/test/dbus_active_unittest.cpp
@@ -8,6 +8,11 @@
 #include <gmock/gmock.h>
 #include <gtest/gtest.h>
 
+namespace pid_control
+{
+namespace
+{
+
 using ::testing::_;
 using ::testing::Invoke;
 using ::testing::NotNull;
@@ -52,3 +57,6 @@
 
 // WARN: getProperties will raise an exception on failure
 // Instead of just not updating the value.
+
+} // namespace
+} // namespace pid_control
diff --git a/test/dbus_passive_unittest.cpp b/test/dbus_passive_unittest.cpp
index d4e9e98..5bddf51 100644
--- a/test/dbus_passive_unittest.cpp
+++ b/test/dbus_passive_unittest.cpp
@@ -11,6 +11,11 @@
 #include <gmock/gmock.h>
 #include <gtest/gtest.h>
 
+namespace pid_control
+{
+namespace
+{
+
 using ::testing::_;
 using ::testing::InSequence;
 using ::testing::Invoke;
@@ -529,3 +534,6 @@
     EXPECT_DOUBLE_EQ(0, passive->getMin());
     EXPECT_DOUBLE_EQ(0, passive->getMax());
 }
+
+} // namespace
+} // namespace pid_control
diff --git a/test/dbushelper_mock.hpp b/test/dbushelper_mock.hpp
index 120c44d..6ce63c8 100644
--- a/test/dbushelper_mock.hpp
+++ b/test/dbushelper_mock.hpp
@@ -8,6 +8,9 @@
 
 #include <gmock/gmock.h>
 
+namespace pid_control
+{
+
 class DbusHelperMock : public DbusHelperInterface
 {
   public:
@@ -24,3 +27,5 @@
                  bool(sdbusplus::bus::bus& bus, const std::string& service,
                       const std::string& path));
 };
+
+} // namespace pid_control
diff --git a/test/helpers.hpp b/test/helpers.hpp
index 1ac21ca..10e8cd7 100644
--- a/test/helpers.hpp
+++ b/test/helpers.hpp
@@ -9,6 +9,9 @@
 #include <gmock/gmock.h>
 #include <gtest/gtest.h>
 
+namespace pid_control
+{
+
 using ::testing::_;
 using ::testing::Invoke;
 using ::testing::IsNull;
@@ -67,3 +70,5 @@
 
     return;
 }
+
+} // namespace pid_control
diff --git a/test/json_parse_unittest.cpp b/test/json_parse_unittest.cpp
index 4913461..3345163 100644
--- a/test/json_parse_unittest.cpp
+++ b/test/json_parse_unittest.cpp
@@ -4,6 +4,11 @@
 #include <gmock/gmock.h>
 #include <gtest/gtest.h>
 
+namespace pid_control
+{
+namespace
+{
+
 TEST(ConfigurationVerificationTest, VerifyHappy)
 {
     /* Verify a happy configuration throws no exceptions. */
@@ -152,3 +157,6 @@
 
     EXPECT_THROW(validateJson(j2), ConfigurationException);
 }
+
+} // namespace
+} // namespace pid_control
diff --git a/test/pid_fancontroller_unittest.cpp b/test/pid_fancontroller_unittest.cpp
index abf9aaa..866b743 100644
--- a/test/pid_fancontroller_unittest.cpp
+++ b/test/pid_fancontroller_unittest.cpp
@@ -9,6 +9,11 @@
 #include <gmock/gmock.h>
 #include <gtest/gtest.h>
 
+namespace pid_control
+{
+namespace
+{
+
 using ::testing::_;
 using ::testing::DoubleEq;
 using ::testing::Invoke;
@@ -245,3 +250,6 @@
     // to the sensors.
     p->outputProc(percent);
 }
+
+} // namespace
+} // namespace pid_control
diff --git a/test/pid_json_unittest.cpp b/test/pid_json_unittest.cpp
index 2bd7d35..0e767f9 100644
--- a/test/pid_json_unittest.cpp
+++ b/test/pid_json_unittest.cpp
@@ -3,6 +3,11 @@
 #include <gmock/gmock.h>
 #include <gtest/gtest.h>
 
+namespace pid_control
+{
+namespace
+{
+
 TEST(ZoneFromJson, emptyZone)
 {
     // There is a zone key, but it's empty.
@@ -199,4 +204,7 @@
                      1.0);
 
     EXPECT_DOUBLE_EQ(zoneConfig[1].minThermalOutput, 3000.0);
-}
\ No newline at end of file
+}
+
+} // namespace
+} // namespace pid_control
diff --git a/test/pid_stepwisecontroller_unittest.cpp b/test/pid_stepwisecontroller_unittest.cpp
index f5f6f9a..d9a7728 100644
--- a/test/pid_stepwisecontroller_unittest.cpp
+++ b/test/pid_stepwisecontroller_unittest.cpp
@@ -9,6 +9,11 @@
 #include <gmock/gmock.h>
 #include <gtest/gtest.h>
 
+namespace pid_control
+{
+namespace
+{
+
 using ::testing::Return;
 using ::testing::StrEq;
 
@@ -83,3 +88,6 @@
         p->process();
     }
 }
+
+} // namespace
+} // namespace pid_control
diff --git a/test/pid_thermalcontroller_unittest.cpp b/test/pid_thermalcontroller_unittest.cpp
index d95f16e..ef4de66 100644
--- a/test/pid_thermalcontroller_unittest.cpp
+++ b/test/pid_thermalcontroller_unittest.cpp
@@ -8,6 +8,11 @@
 #include <gmock/gmock.h>
 #include <gtest/gtest.h>
 
+namespace pid_control
+{
+namespace
+{
+
 using ::testing::_;
 using ::testing::Return;
 using ::testing::StrEq;
@@ -211,4 +216,7 @@
         p->process();
         EXPECT_EQ(p->getLastInput(), reading);
     }
-}
\ No newline at end of file
+}
+
+} // namespace
+} // namespace pid_control
diff --git a/test/pid_zone_unittest.cpp b/test/pid_zone_unittest.cpp
index 8593b97..d7ae9ec 100644
--- a/test/pid_zone_unittest.cpp
+++ b/test/pid_zone_unittest.cpp
@@ -14,6 +14,11 @@
 #include <gmock/gmock.h>
 #include <gtest/gtest.h>
 
+namespace pid_control
+{
+namespace
+{
+
 using ::testing::_;
 using ::testing::IsNull;
 using ::testing::Return;
@@ -538,3 +543,6 @@
     // write to it will have no effect.
     EXPECT_EQ(zone->failSafe(), zone->getFailSafeMode());
 }
+
+} // namespace
+} // namespace pid_control
diff --git a/test/readinterface_mock.hpp b/test/readinterface_mock.hpp
index 1d2c82d..0b77c8a 100644
--- a/test/readinterface_mock.hpp
+++ b/test/readinterface_mock.hpp
@@ -4,6 +4,9 @@
 
 #include <gmock/gmock.h>
 
+namespace pid_control
+{
+
 class ReadInterfaceMock : public ReadInterface
 {
   public:
@@ -11,3 +14,5 @@
 
     MOCK_METHOD0(read, ReadReturn());
 };
+
+} // namespace pid_control
diff --git a/test/sensor_host_unittest.cpp b/test/sensor_host_unittest.cpp
index 8bb9cc7..8559081 100644
--- a/test/sensor_host_unittest.cpp
+++ b/test/sensor_host_unittest.cpp
@@ -11,6 +11,11 @@
 #include <gmock/gmock.h>
 #include <gtest/gtest.h>
 
+namespace pid_control
+{
+namespace
+{
+
 using ::testing::IsNull;
 using ::testing::Return;
 using ::testing::StrEq;
@@ -105,3 +110,6 @@
     // Verify it was updated within the last second.
     EXPECT_TRUE(duration < 1);
 }
+
+} // namespace
+} // namespace pid_control
diff --git a/test/sensor_manager_unittest.cpp b/test/sensor_manager_unittest.cpp
index 9f0e26c..85865a8 100644
--- a/test/sensor_manager_unittest.cpp
+++ b/test/sensor_manager_unittest.cpp
@@ -6,6 +6,11 @@
 #include <gmock/gmock.h>
 #include <gtest/gtest.h>
 
+namespace pid_control
+{
+namespace
+{
+
 using ::testing::_;
 using ::testing::IsNull;
 using ::testing::Return;
@@ -55,3 +60,6 @@
     s.addSensor(type, name, std::move(sensor));
     EXPECT_EQ(s.getSensor(name), sensor_ptr);
 }
+
+} // namespace
+} // namespace pid_control
diff --git a/test/sensor_mock.hpp b/test/sensor_mock.hpp
index b067c7c..d67c457 100644
--- a/test/sensor_mock.hpp
+++ b/test/sensor_mock.hpp
@@ -5,6 +5,9 @@
 
 #include <gmock/gmock.h>
 
+namespace pid_control
+{
+
 class SensorMock : public Sensor
 {
   public:
@@ -16,3 +19,5 @@
     MOCK_METHOD0(read, ReadReturn());
     MOCK_METHOD1(write, void(double));
 };
+
+} // namespace pid_control
diff --git a/test/sensor_pluggable_unittest.cpp b/test/sensor_pluggable_unittest.cpp
index a15f06c..ffd08cd 100644
--- a/test/sensor_pluggable_unittest.cpp
+++ b/test/sensor_pluggable_unittest.cpp
@@ -7,6 +7,11 @@
 #include <gmock/gmock.h>
 #include <gtest/gtest.h>
 
+namespace pid_control
+{
+namespace
+{
+
 using ::testing::Invoke;
 
 TEST(PluggableSensorTest, BoringConstructorTest)
@@ -80,3 +85,6 @@
     EXPECT_CALL(*wip, write(value));
     p.write(value);
 }
+
+} // namespace
+} // namespace pid_control
diff --git a/test/sensors_json_unittest.cpp b/test/sensors_json_unittest.cpp
index 4777ae3..7b3dbc3 100644
--- a/test/sensors_json_unittest.cpp
+++ b/test/sensors_json_unittest.cpp
@@ -4,6 +4,11 @@
 #include <gmock/gmock.h>
 #include <gtest/gtest.h>
 
+namespace pid_control
+{
+namespace
+{
+
 TEST(SensorsFromJson, emptyJsonNoSensors)
 {
     // If the json has no sensors, the map is empty.
@@ -127,3 +132,6 @@
     auto output = buildSensorsFromJson(j2);
     EXPECT_EQ(2, output.size());
 }
+
+} // namespace
+} // namespace pid_control
diff --git a/test/writeinterface_mock.hpp b/test/writeinterface_mock.hpp
index d25e332..0aed48d 100644
--- a/test/writeinterface_mock.hpp
+++ b/test/writeinterface_mock.hpp
@@ -4,6 +4,9 @@
 
 #include <gmock/gmock.h>
 
+namespace pid_control
+{
+
 class WriteInterfaceMock : public WriteInterface
 {
   public:
@@ -14,3 +17,5 @@
 
     MOCK_METHOD1(write, void(double));
 };
+
+} // namespace pid_control
diff --git a/test/zone_mock.hpp b/test/zone_mock.hpp
index cd97f1f..541f95c 100644
--- a/test/zone_mock.hpp
+++ b/test/zone_mock.hpp
@@ -6,6 +6,9 @@
 
 #include <gmock/gmock.h>
 
+namespace pid_control
+{
+
 class ZoneMock : public ZoneInterface
 {
   public:
@@ -19,3 +22,5 @@
     MOCK_CONST_METHOD0(getFailSafePercent, double());
     MOCK_METHOD1(getSensor, Sensor*(const std::string&));
 };
+
+} // namespace pid_control