regulators: Add toErrorType() utility function
Add a utility function to convert a PhaseFaultType value to the
corresponding ErrorType value.
The ErrorType enumeration is used by the ErrorHistory class.
Signed-off-by: Shawn McCarney <shawnmm@us.ibm.com>
Change-Id: Ia0e2c7789087f5782006fcb6c6ede0faedaf5e0b
diff --git a/phosphor-regulators/test/phase_fault_tests.cpp b/phosphor-regulators/test/phase_fault_tests.cpp
index 5c18add..bbe0003 100644
--- a/phosphor-regulators/test/phase_fault_tests.cpp
+++ b/phosphor-regulators/test/phase_fault_tests.cpp
@@ -13,12 +13,20 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+#include "error_history.hpp"
#include "phase_fault.hpp"
#include <gtest/gtest.h>
using namespace phosphor::power::regulators;
+TEST(PhaseFaultTests, ToErrorType)
+{
+ EXPECT_EQ(toErrorType(PhaseFaultType::n), ErrorType::phaseFaultN);
+ EXPECT_EQ(toErrorType(PhaseFaultType::n_plus_1),
+ ErrorType::phaseFaultNPlus1);
+}
+
TEST(PhaseFaultTests, ToString)
{
EXPECT_EQ(toString(PhaseFaultType::n), "n");