Rename Assert.hpp --> Ensure.hpp, style fixes.
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
4e854516c1
commit
90bb8d54b6
|
@ -1,6 +1,6 @@
|
|||
#ifndef ARBUTILS_DICTIONARY_HPP
|
||||
#define ARBUTILS_DICTIONARY_HPP
|
||||
#include "../Assert.hpp"
|
||||
#include "../Ensure.hpp"
|
||||
|
||||
namespace ArbUt {
|
||||
/// @brief Wrapper around unordered_map, allowing safer access and adding several helper methods.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef ARBUTILS___BORROWEDPTR_HPP
|
||||
#define ARBUTILS___BORROWEDPTR_HPP
|
||||
|
||||
#include "../Assert.hpp"
|
||||
#include "../Ensure.hpp"
|
||||
|
||||
namespace ArbUt {
|
||||
/// @brief A borrowed pointer is used to indicate a pointer that is not owned by its holder. As with all Arbutils
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef ARBUTILS___OPTIONALBORROWEDPTR_HPP
|
||||
#define ARBUTILS___OPTIONALBORROWEDPTR_HPP
|
||||
|
||||
#include "../Assert.hpp"
|
||||
#include "../Ensure.hpp"
|
||||
|
||||
namespace ArbUt {
|
||||
/// @brief An optional borrowed pointer is used to indicate a pointer that is not owned by its holder. This pointer
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef ARBUTILS_OPTIONALOptionalUniquePtr_HPP
|
||||
#define ARBUTILS_OPTIONALOptionalUniquePtr_HPP
|
||||
|
||||
#include "../Assert.hpp"
|
||||
#include "../Ensure.hpp"
|
||||
|
||||
namespace ArbUt {
|
||||
/// @brief An optional unique pointer is used to indicate a pointer that is owned by its holder, and will be deleted
|
||||
|
|
|
@ -17,8 +17,8 @@ namespace ArbUt {
|
|||
/// @brief Initialises a OptionalUniquePtrList from a std::vector of raw pointers.
|
||||
/// @param vec A std::vector of raw pointers.
|
||||
inline OptionalUniquePtrList(const std::vector<ValueT*>& vec) noexcept : _vector(vec) {}
|
||||
/// @brief Initialises a OptionalUniquePtrList with a certain capacity reserved for use. This does not set immediate
|
||||
/// size.
|
||||
/// @brief Initialises a OptionalUniquePtrList with a certain capacity reserved for use. This does not set
|
||||
/// immediate size.
|
||||
/// @param capacity The desired capacity.
|
||||
explicit inline OptionalUniquePtrList(size_t capacity) : _vector() { _vector.reserve(capacity); }
|
||||
/// @brief Initialises a OptionalUniquePtrList from a initialiser_list.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef ARBUTILS___SCOPEDPTR_HPP
|
||||
#define ARBUTILS___SCOPEDPTR_HPP
|
||||
|
||||
#include "../Assert.hpp"
|
||||
#include "../Ensure.hpp"
|
||||
|
||||
namespace ArbUt {
|
||||
/// @brief An optional unique pointer is used to indicate a pointer that is owned by its holder, and will be deleted
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef ARBUTILS___UNIQUEPTR_HPP
|
||||
#define ARBUTILS___UNIQUEPTR_HPP
|
||||
|
||||
#include "../Assert.hpp"
|
||||
#include "../Ensure.hpp"
|
||||
|
||||
namespace ArbUt {
|
||||
/// @brief A unique pointer is used to indicate a pointer that is owned by its holder, and will be deleted when its
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef ARBUTILS___UNIQUEPTRLIST_HPP
|
||||
#define ARBUTILS___UNIQUEPTRLIST_HPP
|
||||
|
||||
#include "../Assert.hpp"
|
||||
#include "../Ensure.hpp"
|
||||
#include "__BorrowedPtr.hpp"
|
||||
|
||||
namespace ArbUt {
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
#include <cstdint>
|
||||
#include <random>
|
||||
#include "../extern/pcg_random.hpp"
|
||||
#include "Assert.hpp"
|
||||
#include "Ensure.hpp"
|
||||
|
||||
namespace ArbUt {
|
||||
/// @brief A helper class for getting random numbers.
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
#include "../extern/doctest.hpp"
|
||||
#include "../src/Assert.hpp"
|
||||
#include "../src/Ensure.hpp"
|
||||
void TestWrapper(bool wrapperExpression) { Ensure(wrapperExpression) }
|
||||
void TestWrapperNotNull(void* value){EnsureNotNull(value)}
|
||||
|
||||
TEST_CASE("Ensure succeeds if true") { REQUIRE_NOTHROW(TestWrapper(true)); }
|
||||
TEST_CASE("Ensure succeeds if true") {
|
||||
REQUIRE_NOTHROW(TestWrapper(true));
|
||||
}
|
||||
|
||||
TEST_CASE("Ensure throws if false") { REQUIRE_THROWS(TestWrapper(false)); }
|
||||
|
||||
|
@ -17,10 +19,11 @@ TEST_CASE("Ensure throws if false with message") {
|
|||
throw ArbUt::Exception("Didn't throw.");
|
||||
}
|
||||
|
||||
TEST_CASE("Multiple asserts") {Ensure(true) Ensure(true) Ensure(true)
|
||||
}
|
||||
TEST_CASE("Multiple asserts"){Ensure(true) Ensure(true) Ensure(true)}
|
||||
|
||||
TEST_CASE("EnsureNotNull throws if nullptr") { REQUIRE_THROWS(TestWrapperNotNull(nullptr)); }
|
||||
TEST_CASE("EnsureNotNull throws if nullptr") {
|
||||
REQUIRE_THROWS(TestWrapperNotNull(nullptr));
|
||||
}
|
||||
|
||||
TEST_CASE("Ensure for each") {
|
||||
auto i = {10, 500, 2300, 454};
|
||||
|
|
Loading…
Reference in New Issue