blob: 2c437e40fd5fca3dd035bf08d0ae08d2eacc56c7 [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;
William A. Kennington III0a816c52018-07-17 14:40:14 -070014 const char* const prefix = "construct_test";
William A. Kennington III8f90e282018-07-17 14:40:14 -070015
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