Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(event): add fatal error event #14

Merged
merged 3 commits into from
Sep 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions modules/event/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## shared sources between the module and his unit tests
add_library(antara_event_shared_sources INTERFACE)
target_sources(antara_event_shared_sources INTERFACE antara/gaming/event/quit.game.event.cpp)
target_sources(antara_event_shared_sources INTERFACE antara/gaming/event/quit.game.event.cpp antara/gaming/event/fatal.error.event.cpp)
target_include_directories(antara_event_shared_sources INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(antara_event_shared_sources INTERFACE antara::default_settings)
add_library(antara::event_shared_sources ALIAS antara_event_shared_sources)
Expand All @@ -15,7 +15,8 @@ add_library(antara::event ALIAS antara_event)
add_executable(antara_event_tests)
target_sources(antara_event_tests PUBLIC
antara/gaming/event/antara.event.tests.cpp
antara/gaming/event/antara.event.quit.game.tests.cpp)
antara/gaming/event/antara.event.quit.game.tests.cpp
antara/gaming/event/antara.event.fatal.error.tests.cpp)
target_link_libraries(antara_event_tests PRIVATE doctest PUBLIC antara::event_shared_sources)
set_target_properties(antara_event_tests
PROPERTIES
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/******************************************************************************
* Copyright © 2013-2019 The Komodo Platform Developers. *
* *
* See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at *
* the top-level directory of this distribution for the individual copyright *
* holder information and the developer policies on copyright and licensing. *
* *
* Unless otherwise agreed in a custom licensing agreement, no part of the *
* Komodo Platform software, including this file may be copied, modified, *
* propagated or distributed except according to the terms contained in the *
* LICENSE file *
* *
* Removal or modification of this copyright notice is prohibited. *
* *
******************************************************************************/

#include <doctest/doctest.h>
#include "antara/gaming/event/fatal.error.event.hpp"

namespace antara::gaming::event::tests
{
TEST_SUITE("fatal error")
{
TEST_CASE("construct from an error code")
{
fatal_error fatal_error_event{std::make_error_code(std::errc::result_out_of_range)};
CHECK_EQ(fatal_error_event.ec_.value(), static_cast<int>(std::errc::result_out_of_range));
}
}
}
25 changes: 25 additions & 0 deletions modules/event/antara/gaming/event/fatal.error.event.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/******************************************************************************
* Copyright © 2013-2019 The Komodo Platform Developers. *
* *
* See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at *
* the top-level directory of this distribution for the individual copyright *
* holder information and the developer policies on copyright and licensing. *
* *
* Unless otherwise agreed in a custom licensing agreement, no part of the *
* Komodo Platform software, including this file may be copied, modified, *
* propagated or distributed except according to the terms contained in the *
* LICENSE file *
* *
* Removal or modification of this copyright notice is prohibited. *
* *
******************************************************************************/

#include <utility>
#include "antara/gaming/event/fatal.error.event.hpp"

namespace antara::gaming::event
{
fatal_error::fatal_error(std::error_code ec) : ec_(ec)
{
}
}
29 changes: 29 additions & 0 deletions modules/event/antara/gaming/event/fatal.error.event.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@

/******************************************************************************
* Copyright © 2013-2019 The Komodo Platform Developers. *
* *
* See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at *
* the top-level directory of this distribution for the individual copyright *
* holder information and the developer policies on copyright and licensing. *
* *
* Unless otherwise agreed in a custom licensing agreement, no part of the *
* Komodo Platform software, including this file may be copied, modified, *
* propagated or distributed except according to the terms contained in the *
* LICENSE file *
* *
* Removal or modification of this copyright notice is prohibited. *
* *
******************************************************************************/

#pragma once

#include <system_error>

namespace antara::gaming::event
{
struct fatal_error
{
explicit fatal_error(std::error_code ec);
std::error_code ec_;
};
}