clang-format: Update to match docs repo
Update the .clang-format file and run clang-format-6.0.
This .clang-format matches the example one in
https://github.com/openbmc/docs/blob/master/cpp-style-and-conventions.md#clang-formatting
Change-Id: Ia331c9a5b040e1a3c45a0ebf1b8d776d93b05ae5
Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
diff --git a/test/test_vlan_interface.cpp b/test/test_vlan_interface.cpp
index 00384f1..1bcd87a 100644
--- a/test/test_vlan_interface.cpp
+++ b/test/test_vlan_interface.cpp
@@ -1,17 +1,18 @@
-#include "network_manager.hpp"
-#include "mock_syscall.hpp"
#include "config_parser.hpp"
-#include "vlan_interface.hpp"
#include "ipaddress.hpp"
+#include "mock_syscall.hpp"
+#include "network_manager.hpp"
+#include "vlan_interface.hpp"
-#include <gtest/gtest.h>
-#include <sdbusplus/bus.hpp>
-
+#include <arpa/inet.h>
#include <net/if.h>
#include <netinet/in.h>
-#include <arpa/inet.h>
+
#include <exception>
#include <experimental/filesystem>
+#include <sdbusplus/bus.hpp>
+
+#include <gtest/gtest.h>
namespace phosphor
{
@@ -22,98 +23,89 @@
class TestVlanInterface : public testing::Test
{
- public:
+ public:
+ sdbusplus::bus::bus bus;
+ Manager manager;
+ EthernetInterface interface;
+ std::string confDir;
+ TestVlanInterface() :
+ bus(sdbusplus::bus::new_default()),
+ manager(bus, "/xyz/openbmc_test/network", "/tmp"),
+ interface(bus, "/xyz/openbmc_test/network/test0", false, manager)
- sdbusplus::bus::bus bus;
- Manager manager;
- EthernetInterface interface;
- std::string confDir;
- TestVlanInterface()
- : bus(sdbusplus::bus::new_default()),
- manager(bus, "/xyz/openbmc_test/network", "/tmp"),
- interface(bus, "/xyz/openbmc_test/network/test0", false, manager)
+ {
+ setConfDir();
+ }
+ ~TestVlanInterface()
+ {
+ if (confDir != "")
{
- setConfDir();
+ fs::remove_all(confDir);
}
+ }
- ~TestVlanInterface()
+ void setConfDir()
+ {
+ char tmp[] = "/tmp/VlanInterface.XXXXXX";
+ confDir = mkdtemp(tmp);
+ manager.setConfDir(confDir);
+ }
+
+ void createVlan(VlanId id)
+ {
+ interface.createVLAN(id);
+ }
+
+ void deleteVlan(const std::string& interfaceName)
+ {
+ interface.deleteVLANObject(interfaceName);
+ }
+
+ int countIPObjects()
+ {
+ return interface.getAddresses().size();
+ }
+
+ bool isIPObjectExist(const std::string& ipaddress)
+ {
+ auto address = interface.getAddresses().find(ipaddress);
+ if (address == interface.getAddresses().end())
{
- if(confDir != "")
- {
- fs::remove_all(confDir);
- }
- }
-
- void setConfDir()
- {
- char tmp[] = "/tmp/VlanInterface.XXXXXX";
- confDir = mkdtemp(tmp);
- manager.setConfDir(confDir);
- }
-
- void createVlan(VlanId id)
- {
- interface.createVLAN(id);
- }
-
- void deleteVlan(const std::string& interfaceName)
- {
- interface.deleteVLANObject(interfaceName);
- }
-
- int countIPObjects()
- {
- return interface.getAddresses().size();
- }
-
- bool isIPObjectExist(const std::string& ipaddress)
- {
- auto address = interface.getAddresses().find(ipaddress);
- if (address == interface.getAddresses().end())
- {
- return false;
- }
- return true;
-
- }
-
- bool deleteIPObject(const std::string& ipaddress)
- {
- auto address = interface.getAddresses().find(ipaddress);
- if (address == interface.getAddresses().end())
- {
- return false;
- }
- address->second->delete_();
- return true;
- }
-
- void createIPObject(IP::Protocol addressType,
- const std::string& ipaddress,
- uint8_t subnetMask,
- const std::string& gateway)
- {
- interface.iP(addressType,
- ipaddress,
- subnetMask,
- gateway
- );
-
- }
-
- bool isValueFound(const std::vector<std::string>& values,
- const std::string& expectedValue)
- {
- for (const auto& value : values)
- {
- if (expectedValue == value)
- {
- return true;
- }
- }
return false;
}
+ return true;
+ }
+
+ bool deleteIPObject(const std::string& ipaddress)
+ {
+ auto address = interface.getAddresses().find(ipaddress);
+ if (address == interface.getAddresses().end())
+ {
+ return false;
+ }
+ address->second->delete_();
+ return true;
+ }
+
+ void createIPObject(IP::Protocol addressType, const std::string& ipaddress,
+ uint8_t subnetMask, const std::string& gateway)
+ {
+ interface.iP(addressType, ipaddress, subnetMask, gateway);
+ }
+
+ bool isValueFound(const std::vector<std::string>& values,
+ const std::string& expectedValue)
+ {
+ for (const auto& value : values)
+ {
+ if (expectedValue == value)
+ {
+ return true;
+ }
+ }
+ return false;
+ }
};
TEST_F(TestVlanInterface, createVLAN)
@@ -140,7 +132,6 @@
expectedValue = "50";
found = isValueFound(values, expectedValue);
EXPECT_EQ(found, true);
-
}
TEST_F(TestVlanInterface, deleteVLAN)
@@ -153,7 +144,7 @@
filePath /= "test0.50.netdev";
if (fs::is_regular_file(filePath.string()))
{
- fileFound = true;
+ fileFound = true;
}
EXPECT_EQ(fileFound, false);
}
@@ -201,5 +192,5 @@
deleteVlan("test0.60");
}
-}// namespce network
-}// namespace phosphor
+} // namespace network
+} // namespace phosphor