blob: c0b5a18aba8038e461563dbd64cc76b0c17fc055 [file] [log] [blame]
Alexander Hansen40fb5492025-10-28 17:56:12 +01001// SPDX-License-Identifier: Apache-2.0
2// SPDX-FileCopyrightText: Copyright 2019 IBM Corporation
3
Matt Spinler835a8692019-08-27 13:56:05 -05004#include "extensions/openpower-pels/pel_values.hpp"
5
6#include <gtest/gtest.h>
7
Matt Spinler578e0702020-03-13 09:40:43 -05008using namespace openpower::pels;
Matt Spinler835a8692019-08-27 13:56:05 -05009using namespace openpower::pels::pel_values;
10
11TEST(PELFieldsTest, TestFindFields)
12{
13 auto s = findByValue(0x5D, subsystemValues);
14 ASSERT_NE(s, subsystemValues.end());
Matt Spinlerb181d9d2020-06-05 14:49:59 -050015 EXPECT_EQ(0x5D, std::get<fieldValuePos>(*s));
16 EXPECT_STREQ("cec_service_network", std::get<registryNamePos>(*s));
Matt Spinler835a8692019-08-27 13:56:05 -050017
18 s = findByName("cec_clocks", subsystemValues);
19 ASSERT_NE(s, subsystemValues.end());
Matt Spinlerb181d9d2020-06-05 14:49:59 -050020 EXPECT_EQ(0x58, std::get<fieldValuePos>(*s));
21 EXPECT_STREQ("cec_clocks", std::get<registryNamePos>(*s));
Vijay Lobo242be742021-09-16 22:40:46 -050022 EXPECT_STREQ("CEC Hardware - Clock", std::get<descriptionPos>(*s));
Matt Spinler835a8692019-08-27 13:56:05 -050023
24 s = findByValue(0xFF, subsystemValues);
Matt Spinlerb181d9d2020-06-05 14:49:59 -050025 EXPECT_EQ(s, subsystemValues.end());
Matt Spinler835a8692019-08-27 13:56:05 -050026
27 s = findByName("foo", subsystemValues);
Matt Spinlerb181d9d2020-06-05 14:49:59 -050028 EXPECT_EQ(s, subsystemValues.end());
Matt Spinler835a8692019-08-27 13:56:05 -050029}