tools: specify common ipmi errors for humans

Add a check for common ipmi failure codes to the IPMI exception object
to make the messages more human readable.

Change-Id: If143a3a63748c258b2fdc4fd074cf5070c0b88d9
Signed-off-by: Patrick Venture <venture@google.com>
diff --git a/test/tools_ipmi_error_unittest.cpp b/test/tools_ipmi_error_unittest.cpp
new file mode 100644
index 0000000..86264a1
--- /dev/null
+++ b/test/tools_ipmi_error_unittest.cpp
@@ -0,0 +1,28 @@
+#include "ipmi_errors.hpp"
+
+#include <gtest/gtest.h>
+
+namespace host_tool
+{
+
+TEST(IpmiExceptionTest, VerifyTimedOutIsString)
+{
+    /* Verify that throwing the exception with the cc code for timed out gets
+     * converted to the human readable string.
+     */
+    bool verified = false;
+
+    try
+    {
+        throw IpmiException(0xc3);
+    }
+    catch (const IpmiException& i)
+    {
+        EXPECT_STREQ("Received IPMI_CC: timeout", i.what());
+        verified = true;
+    }
+
+    EXPECT_TRUE(verified);
+}
+
+} // namespace host_tool