Continuing refactor work.

This commit is contained in:
2023-10-19 00:37:56 -07:00
parent 8d02d078e7
commit 36fe049485
28 changed files with 1658 additions and 122 deletions

View File

@@ -20,7 +20,7 @@
/// PERFORMANCE OF THIS SOFTWARE.
///
#include <scsl/Exceptions.h>
#include "sctest/Exceptions.h"
#include <sctest/Assert.h>
#include <cassert>
@@ -28,10 +28,10 @@
#include <sstream>
namespace scsl {
namespace sctest {
void
TestAssert(bool condition, std::string message)
Assert(bool condition, std::string message)
{
#if defined(NDEBUG) || defined(SCSL_NOEXCEPT)
if (!condition) {
@@ -47,7 +47,7 @@ TestAssert(bool condition, std::string message)
void
TestAssert(bool condition)
Assert(bool condition)
{
#if defined(NDEBUG)
if (condition) {
@@ -67,4 +67,4 @@ TestAssert(bool condition)
}
} // namespace scsl
} // namespace sctest

39
src/test/Exceptions.cc Normal file
View File

@@ -0,0 +1,39 @@
///
/// \file Exceptions.cc
/// \author K. Isom <kyle@imap.cc>
/// \date 2023-10-10
/// \brief Custom exceptions used in writing test programs.
///
/// Copyright 2023 K. Isom <kyle@imap.cc>
///
/// Permission to use, copy, modify, and/or distribute this software for
/// any purpose with or without fee is hereby granted, provided that
/// the above copyright notice and this permission notice appear in all /// copies.
///
/// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
/// WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
/// WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
/// AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
/// DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA
/// OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
/// TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
/// PERFORMANCE OF THIS SOFTWARE.
///
#include <sctest/Exceptions.h>
namespace sctest {
AssertionFailed::AssertionFailed(std::string message) : msg(message) {}
const char *
AssertionFailed::what() const throw()
{
return const_cast<char *>(this->msg.c_str());
}
} // namespace sctest