Expand on the use of defines and non_null/nullable
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
@@ -4,14 +4,14 @@
|
||||
using namespace ArbUt;
|
||||
|
||||
TEST_CASE("Create Dictionary, insert values") {
|
||||
auto dic = Dictionary<int, int>(5);
|
||||
auto dic = Dictionary<i32, i32>(5);
|
||||
dic.Insert(10, 5);
|
||||
dic.Insert(2, 100);
|
||||
dic.Insert(9, 2000);
|
||||
}
|
||||
|
||||
TEST_CASE("Create Dictionary with initializer list") {
|
||||
auto dic = Dictionary<int, int>({{5, 100}, {10, 200}, {50, 2}});
|
||||
auto dic = Dictionary<i32, i32>({{5, 100}, {10, 200}, {50, 2}});
|
||||
|
||||
CHECK(dic.Get(5) == 100);
|
||||
CHECK(dic.Get(10) == 200);
|
||||
@@ -19,7 +19,7 @@ TEST_CASE("Create Dictionary with initializer list") {
|
||||
}
|
||||
|
||||
TEST_CASE("Create Dictionary, insert values, get values") {
|
||||
auto dic = Dictionary<int, int>(5);
|
||||
auto dic = Dictionary<i32, i32>(5);
|
||||
dic.Insert(10, 5);
|
||||
dic.Insert(2, 100);
|
||||
dic.Insert(9, 2000);
|
||||
@@ -30,7 +30,7 @@ TEST_CASE("Create Dictionary, insert values, get values") {
|
||||
}
|
||||
|
||||
TEST_CASE("Create Dictionary, insert values twice should throw") {
|
||||
auto dic = Dictionary<int, int>(5);
|
||||
auto dic = Dictionary<i32, i32>(5);
|
||||
dic.Insert(10, 5);
|
||||
CHECK_THROWS(dic.Insert(10, 100));
|
||||
|
||||
@@ -38,7 +38,7 @@ TEST_CASE("Create Dictionary, insert values twice should throw") {
|
||||
}
|
||||
|
||||
TEST_CASE("Create Dictionary, insert value, then update value") {
|
||||
auto dic = Dictionary<int, int>(5);
|
||||
auto dic = Dictionary<i32, i32>(5);
|
||||
dic.Insert(10, 5);
|
||||
dic[10] = 200;
|
||||
|
||||
@@ -46,7 +46,7 @@ TEST_CASE("Create Dictionary, insert value, then update value") {
|
||||
}
|
||||
|
||||
TEST_CASE("Create Dictionary, insert value, try get value") {
|
||||
auto dic = Dictionary<int, int>(5);
|
||||
auto dic = Dictionary<i32, i32>(5);
|
||||
dic.Insert(10, 5);
|
||||
auto v = dic.TryGet(10);
|
||||
CHECK(v.has_value());
|
||||
@@ -54,24 +54,24 @@ TEST_CASE("Create Dictionary, insert value, try get value") {
|
||||
}
|
||||
|
||||
TEST_CASE("Create Dictionary, insert value, try get non existing value") {
|
||||
auto dic = Dictionary<int, int>(5);
|
||||
auto dic = Dictionary<i32, i32>(5);
|
||||
CHECK_FALSE(dic.TryGet(10).has_value());
|
||||
}
|
||||
|
||||
TEST_CASE("Create Dictionary, insert value, Has") {
|
||||
auto dic = Dictionary<int, int>(5);
|
||||
auto dic = Dictionary<i32, i32>(5);
|
||||
dic.Insert(10, 5);
|
||||
CHECK(dic.Has(10));
|
||||
}
|
||||
|
||||
TEST_CASE("Create Dictionary, set value") {
|
||||
auto dic = Dictionary<int, int>(5);
|
||||
auto dic = Dictionary<i32, i32>(5);
|
||||
dic.Set(5, 100);
|
||||
CHECK(dic.Has(5));
|
||||
}
|
||||
|
||||
TEST_CASE("Create Dictionary, insert values, get count") {
|
||||
auto dic = Dictionary<int, int>(5);
|
||||
auto dic = Dictionary<i32, i32>(5);
|
||||
dic.Insert(10, 5);
|
||||
dic.Insert(2, 100);
|
||||
dic.Insert(9, 2000);
|
||||
@@ -80,7 +80,7 @@ TEST_CASE("Create Dictionary, insert values, get count") {
|
||||
}
|
||||
|
||||
TEST_CASE("Create Dictionary, insert values, iterate over keys") {
|
||||
auto dic = Dictionary<int, int>(5);
|
||||
auto dic = Dictionary<i32, i32>(5);
|
||||
dic.Insert(10, 5);
|
||||
dic.Insert(2, 100);
|
||||
dic.Insert(9, 2000);
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
#include "../src/Ensure.hpp"
|
||||
void TestWrapper(bool wrapperExpression) { Ensure(wrapperExpression) }
|
||||
void TestWrapperNotNull(void* value) { EnsureNotNull(value) }
|
||||
void TestWrapperEquals(int32_t a, int32_t b) { EnsureEquals(a, b) }
|
||||
void TestWrapperGreater(int32_t a, int32_t b) { EnsureGreater(a, b) }
|
||||
void TestWrapperGreaterEquals(int32_t a, int32_t b) { EnsureGreaterOrEquals(a, b) }
|
||||
void TestWrapperLess(int32_t a, int32_t b) { EnsureLess(a, b) }
|
||||
void TestWrapperLessEquals(int32_t a, int32_t b){EnsureLessOrEquals(a, b)}
|
||||
void TestWrapperEquals(i32 a, i32 b) { EnsureEquals(a, b) }
|
||||
void TestWrapperGreater(i32 a, i32 b) { EnsureGreater(a, b) }
|
||||
void TestWrapperGreaterEquals(i32 a, i32 b) { EnsureGreaterOrEquals(a, b) }
|
||||
void TestWrapperLess(i32 a, i32 b) { EnsureLess(a, b) }
|
||||
void TestWrapperLessEquals(i32 a, i32 b){EnsureLessOrEquals(a, b)}
|
||||
|
||||
TEST_CASE("Ensure succeeds if true") {
|
||||
REQUIRE_NOTHROW(TestWrapper(true));
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#include "../src/Enum.hpp"
|
||||
#include "../src/MacroUtils.hpp"
|
||||
|
||||
ENUM(TestEnum, uint8_t, Val1, Val2, Val3)
|
||||
ENUM(TestEnum, u8, Val1, Val2, Val3)
|
||||
|
||||
#define STATIC_REQUIRE(expr) \
|
||||
static_assert(expr); \
|
||||
|
||||
@@ -3,6 +3,6 @@
|
||||
#include "../src/Memory/Memory.hpp"
|
||||
using namespace ArbUt;
|
||||
|
||||
TEST_CASE("Scoped Pointer deletes child after out of scope") { auto a = ScopedPtr<uint32_t>(new uint32_t(100)); }
|
||||
TEST_CASE("Scoped Pointer deletes child after out of scope") { auto a = ScopedPtr<u32>(new u32(100)); }
|
||||
|
||||
#endif
|
||||
@@ -20,7 +20,7 @@ TEST_CASE("Compare compile time with CaseInsensitiveStringview") {
|
||||
}
|
||||
|
||||
TEST_CASE("Use insensitive const string in unordered_map") {
|
||||
std::unordered_map<ArbUt::StringView, int32_t> map;
|
||||
std::unordered_map<ArbUt::StringView, i32> map;
|
||||
map.insert({"foO"_cnc, 1});
|
||||
map.insert({"bAR"_cnc, 5});
|
||||
|
||||
|
||||
@@ -4,17 +4,17 @@
|
||||
using namespace ArbUt;
|
||||
|
||||
TEST_CASE("Create Unique Ptr list, append") {
|
||||
auto ls = UniquePtrList<uint32_t>();
|
||||
auto v1 = new uint32_t(100);
|
||||
auto v2 = new uint32_t(5000);
|
||||
auto ls = UniquePtrList<u32>();
|
||||
auto v1 = new u32(100);
|
||||
auto v2 = new u32(5000);
|
||||
ls.Append(v1);
|
||||
ls.Append(v2);
|
||||
}
|
||||
|
||||
TEST_CASE("Create Unique Ptr list, append, retrieve") {
|
||||
auto ls = UniquePtrList<uint32_t>();
|
||||
auto v1 = new uint32_t(100);
|
||||
auto v2 = new uint32_t(5000);
|
||||
auto ls = UniquePtrList<u32>();
|
||||
auto v1 = new u32(100);
|
||||
auto v2 = new u32(5000);
|
||||
ls.Append(v1);
|
||||
ls.Append(v2);
|
||||
REQUIRE(ls.Count() == 2);
|
||||
@@ -25,9 +25,9 @@ TEST_CASE("Create Unique Ptr list, append, retrieve") {
|
||||
}
|
||||
|
||||
TEST_CASE("Create Unique Ptr list, append, iterate") {
|
||||
auto ls = UniquePtrList<uint32_t>();
|
||||
auto v1 = new uint32_t(100);
|
||||
auto v2 = new uint32_t(5000);
|
||||
auto ls = UniquePtrList<u32>();
|
||||
auto v1 = new u32(100);
|
||||
auto v2 = new u32(5000);
|
||||
ls.Append(v1);
|
||||
ls.Append(v2);
|
||||
REQUIRE(ls.Count() == 2);
|
||||
@@ -42,9 +42,9 @@ TEST_CASE("Create Unique Ptr list, append, iterate") {
|
||||
}
|
||||
|
||||
TEST_CASE("Test unique ptr list out of bounds") {
|
||||
auto ls = UniquePtrList<uint32_t>();
|
||||
auto v1 = new uint32_t(100);
|
||||
auto v2 = new uint32_t(5000);
|
||||
auto ls = UniquePtrList<u32>();
|
||||
auto v1 = new u32(100);
|
||||
auto v2 = new u32(5000);
|
||||
ls.Append(v1);
|
||||
ls.Append(v2);
|
||||
REQUIRE_THROWS(ls.At(2));
|
||||
|
||||
Reference in New Issue
Block a user