xref: /openbmc/sdeventplus/test/exception.cpp (revision a8c11e3c)
1 #include <sdeventplus/exception.hpp>
2 
3 #include <string>
4 #include <system_error>
5 
6 #include <gtest/gtest.h>
7 
8 namespace sdeventplus
9 {
10 namespace
11 {
12 
TEST(ExceptionTest,Construct)13 TEST(ExceptionTest, Construct)
14 {
15     const int code = EINTR;
16     const char* const prefix = "construct_test";
17 
18     std::system_error expected(code, std::generic_category(), prefix);
19     SdEventError err(code, prefix);
20 
21     EXPECT_EQ(std::string{expected.what()}, err.what());
22     EXPECT_EQ(code, err.code().value());
23     EXPECT_EQ(std::generic_category(), err.code().category());
24 }
25 
26 } // namespace
27 } // namespace sdeventplus
28