generated from threeal/cpp-starter
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
36 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#pragma once | ||
|
||
#include <exception> | ||
|
||
namespace error { | ||
|
||
/** | ||
* @brief A struct that represents error information. | ||
*/ | ||
struct Error : public std::exception { | ||
/** | ||
* @brief Returns the explanatory string. | ||
* @return Pointer to a null-terminated string with explanatory information. | ||
*/ | ||
const char* what() const noexcept override; | ||
}; | ||
|
||
} // namespace error |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#include <error/error.hpp> | ||
|
||
namespace error { | ||
|
||
const char* Error::what() const noexcept { return "unknown error"; } | ||
|
||
} // namespace error |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#include <catch2/catch_test_macros.hpp> | ||
#include <error/error.hpp> | ||
|
||
TEST_CASE("test Error::what") { | ||
const error::Error err; | ||
const std::string expected("unknown error"); | ||
REQUIRE(expected.compare(err.what()) == 0); | ||
} |
This file was deleted.
Oops, something went wrong.