diff options
author | Ed Tanous <etanous@nvidia.com> | 2024-09-04 03:03:29 +0300 |
---|---|---|
committer | Ed Tanous <ed@tanous.net> | 2024-09-05 00:24:49 +0300 |
commit | 8d2f868c9e553d8d7b77a3cbdbf32f7c889da8cb (patch) | |
tree | ee74de329653194368eb318293007b156ca4ed30 /test/redfish-core | |
parent | d193e0082c3fc7d4f4c34dd5fa86e95c036c938d (diff) | |
download | bmcweb-8d2f868c9e553d8d7b77a3cbdbf32f7c889da8cb.tar.xz |
Break out post codes
Similar to other patches, break out the post codes log services into
their own file. log_services.hpp is far too large.
Change-Id: I3cb644d52a9d3b5f9a15a2f90c1b69c87491e5c8
Signed-off-by: Ed Tanous <etanous@nvidia.com>
Diffstat (limited to 'test/redfish-core')
-rw-r--r-- | test/redfish-core/lib/manager_logservices_journal_test.cpp (renamed from test/redfish-core/lib/log_services_test.cpp) | 30 | ||||
-rw-r--r-- | test/redfish-core/lib/systems_logservices_postcode.cpp | 43 |
2 files changed, 43 insertions, 30 deletions
diff --git a/test/redfish-core/lib/log_services_test.cpp b/test/redfish-core/lib/manager_logservices_journal_test.cpp index e413d0e96c..86c201c7af 100644 --- a/test/redfish-core/lib/log_services_test.cpp +++ b/test/redfish-core/lib/manager_logservices_journal_test.cpp @@ -1,5 +1,4 @@ #include "async_resp.hpp" -#include "log_services.hpp" #include "manager_logservices_journal.hpp" #include <systemd/sd-id128.h> @@ -68,34 +67,5 @@ TEST(LogServicesBMCJouralTest, LogServicesBMCJouralGetReturnsError) EXPECT_EQ(indexOut, 1); } -TEST(LogServicesPostCodeParse, PostCodeParse) -{ - uint64_t currentValue = 0; - uint16_t index = 0; - EXPECT_TRUE(parsePostCode("B1-2", currentValue, index)); - EXPECT_EQ(currentValue, 2); - EXPECT_EQ(index, 1); - EXPECT_TRUE(parsePostCode("B200-300", currentValue, index)); - EXPECT_EQ(currentValue, 300); - EXPECT_EQ(index, 200); - - EXPECT_FALSE(parsePostCode("", currentValue, index)); - EXPECT_FALSE(parsePostCode("B", currentValue, index)); - EXPECT_FALSE(parsePostCode("B1", currentValue, index)); - EXPECT_FALSE(parsePostCode("B1-", currentValue, index)); - EXPECT_FALSE(parsePostCode("B1A-2", currentValue, index)); - EXPECT_FALSE(parsePostCode("B1A-2", currentValue, index)); - EXPECT_FALSE(parsePostCode("B1A-2z", currentValue, index)); - // Uint16_t max + 1 - EXPECT_FALSE(parsePostCode("B65536-1", currentValue, index)); - - // Uint64_t max + 1 - EXPECT_FALSE(parsePostCode("B1-18446744073709551616", currentValue, index)); - - // Negative numbers - EXPECT_FALSE(parsePostCode("B-1-2", currentValue, index)); - EXPECT_FALSE(parsePostCode("B-1--2", currentValue, index)); -} - } // namespace } // namespace redfish diff --git a/test/redfish-core/lib/systems_logservices_postcode.cpp b/test/redfish-core/lib/systems_logservices_postcode.cpp new file mode 100644 index 0000000000..aa98cb106f --- /dev/null +++ b/test/redfish-core/lib/systems_logservices_postcode.cpp @@ -0,0 +1,43 @@ + +#include "systems_logservices_postcodes.hpp" + +#include <cstdint> + +#include <gtest/gtest.h> + +namespace redfish +{ +namespace +{ + +TEST(LogServicesPostCodeParse, PostCodeParse) +{ + uint64_t currentValue = 0; + uint16_t index = 0; + EXPECT_TRUE(parsePostCode("B1-2", currentValue, index)); + EXPECT_EQ(currentValue, 2); + EXPECT_EQ(index, 1); + EXPECT_TRUE(parsePostCode("B200-300", currentValue, index)); + EXPECT_EQ(currentValue, 300); + EXPECT_EQ(index, 200); + + EXPECT_FALSE(parsePostCode("", currentValue, index)); + EXPECT_FALSE(parsePostCode("B", currentValue, index)); + EXPECT_FALSE(parsePostCode("B1", currentValue, index)); + EXPECT_FALSE(parsePostCode("B1-", currentValue, index)); + EXPECT_FALSE(parsePostCode("B1A-2", currentValue, index)); + EXPECT_FALSE(parsePostCode("B1A-2", currentValue, index)); + EXPECT_FALSE(parsePostCode("B1A-2z", currentValue, index)); + // Uint16_t max + 1 + EXPECT_FALSE(parsePostCode("B65536-1", currentValue, index)); + + // Uint64_t max + 1 + EXPECT_FALSE(parsePostCode("B1-18446744073709551616", currentValue, index)); + + // Negative numbers + EXPECT_FALSE(parsePostCode("B-1-2", currentValue, index)); + EXPECT_FALSE(parsePostCode("B-1--2", currentValue, index)); +} + +} // namespace +} // namespace redfish |