4#include <gtest/gtest.h>
15#ifndef PROFINET_TEST_INTERFACE
16#define PROFINET_TEST_INTERFACE ""
24[[nodiscard]] std::string GetTestInterface()
31TEST(PlatformTests, GetInterfaceMacRejectsEmptyInterface)
37TEST(PlatformTests, GetInterfaceMacRejectsUnknownInterface)
43TEST(PlatformTests, GetInterfaceMacReturnsSixByteAddress)
45 const std::string
interface = GetTestInterface();
47 if (interface.empty())
49 GTEST_SKIP() <<
"Set PROFINET_TEST_INTERFACE to run live interface tests";
58TEST(PlatformTests, MacAddressProviderUsesPortableInterfaceLookup)
60 const std::string
interface = GetTestInterface();
62 if (interface.empty())
64 GTEST_SKIP() <<
"Set PROFINET_TEST_INTERFACE to run live interface tests";
73TEST(PlatformTests, GetExecutableDirectoryReturnsExistingAbsoluteDirectory)
77 ASSERT_TRUE(directory.is_absolute());
78 EXPECT_TRUE(std::filesystem::exists(directory));
79 EXPECT_TRUE(std::filesystem::is_directory(directory));
83TEST(PlatformTests, GetExecutableDirectoryIsStable)
Production implementation of IMacAddressProvider.
MacAddress GetMac(const std::string &interface) override
Get the MAC address of a network interface.
Declares exceptions and error types used by the PROFINET IO controller stack.
MacAddress GetInterfaceMac(const std::string &interface)
Get the MAC address assigned to a network interface.
std::array< std::uint8_t, macAddressLength > MacAddress
A 6-byte Ethernet MAC address.
std::filesystem::path GetExecutableDirectory()
Retrieves the absolute directory path of the currently running executable.
constexpr int macAddressLength
Constant lenght of a mac address.
Declares Linux Ethernet, addressing, timing, and utility helpers used by the PROFINET stack.