blob: 050513c1c9b8b62e7e759f499bd7890a2c1724c5 [file] [log] [blame]
William A. Kennington III8f90e282018-07-17 14:40:14 -07001#include <gtest/gtest.h>
2#include <sdeventplus/exception.hpp>
3#include <string>
4#include <system_error>
5
6namespace sdeventplus
7{
8namespace
9{
10
11TEST(ExceptionTest, Construct)
12{
13 const int code = EINTR;
14 const char *const prefix = "construct_test";
15
16 std::system_error expected(code, std::generic_category(), prefix);
17 SdEventError err(code, prefix);
18
19 EXPECT_EQ(std::string{expected.what()}, err.what());
20 EXPECT_EQ(code, err.code().value());
21 EXPECT_EQ(std::generic_category(), err.code().category());
22}
23
24} // namespace
25} // namespace sdeventplus