summaryrefslogtreecommitdiffstats
path: root/test/exception.cpp
blob: 2c437e40fd5fca3dd035bf08d0ae08d2eacc56c7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include <gtest/gtest.h>
#include <sdeventplus/exception.hpp>
#include <string>
#include <system_error>

namespace sdeventplus
{
namespace
{

TEST(ExceptionTest, Construct)
{
    const int code = EINTR;
    const char* const prefix = "construct_test";

    std::system_error expected(code, std::generic_category(), prefix);
    SdEventError err(code, prefix);

    EXPECT_EQ(std::string{expected.what()}, err.what());
    EXPECT_EQ(code, err.code().value());
    EXPECT_EQ(std::generic_category(), err.code().category());
}

} // namespace
} // namespace sdeventplus
OpenPOWER on IntegriCloud