Skip to content

Commit

Permalink
Merge pull request #14 from KomodoPlatform/roman_dev
Browse files Browse the repository at this point in the history
feat(event): add fatal error event
  • Loading branch information
Milerius authored Sep 13, 2019
2 parents 55ac571 + 87e4aa3 commit 8d12225
Show file tree
Hide file tree
Showing 4 changed files with 87 additions and 2 deletions.
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_;
};
}

0 comments on commit 8d12225

Please sign in to comment.