Change namespace name so it's a lot less verbose.
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
2ae108517d
commit
3dc96de34b
|
@ -4,7 +4,7 @@
|
|||
#include <unordered_map>
|
||||
#include "../Assert.hpp"
|
||||
|
||||
namespace Arbutils::Collections {
|
||||
namespace ArbUt::Collections {
|
||||
template <class KeyT, class ValueT> class Dictionary {
|
||||
private:
|
||||
std::unordered_map<KeyT, ValueT> _map;
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
#include <stdexcept>
|
||||
#include <vector>
|
||||
|
||||
namespace Arbutils::Collections {
|
||||
namespace ArbUt::Collections {
|
||||
template <class ValueT> class List {
|
||||
private:
|
||||
std::vector<ValueT> _vector;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#include "ConstString.hpp"
|
||||
|
||||
Arbutils::__ConstStringCharHolder* Arbutils::CaseInsensitiveConstString::__emptyString =
|
||||
ArbUt::__ConstStringCharHolder* ArbUt::CaseInsensitiveConstString::__emptyString =
|
||||
new __ConstStringCharHolder("", 0);
|
||||
Arbutils::__ConstStringCharHolder* Arbutils::ConstString::__emptyString = new __ConstStringCharHolder("", 0);
|
||||
ArbUt::__ConstStringCharHolder* ArbUt::ConstString::__emptyString = new __ConstStringCharHolder("", 0);
|
|
@ -8,7 +8,7 @@
|
|||
#include <string>
|
||||
#include "__ConstStringCore.hpp"
|
||||
|
||||
namespace Arbutils {
|
||||
namespace ArbUt {
|
||||
class __ConstStringCharHolder {
|
||||
char* _value;
|
||||
std::atomic<size_t> _references;
|
||||
|
@ -39,12 +39,12 @@ ConstStringCore(
|
|||
return (*input) ? static_cast<uint32_t>((*input)) + 33 * Hash(input + 1) : 5381;
|
||||
};)
|
||||
|
||||
inline constexpr Arbutils::ConstString_Literal
|
||||
inline constexpr ArbUt::ConstString_Literal
|
||||
operator"" _const(const char* c, size_t l) {
|
||||
return Arbutils::ConstString_Literal(c, l);
|
||||
return ArbUt::ConstString_Literal(c, l);
|
||||
}
|
||||
inline constexpr Arbutils::ConstString_Literal operator"" _c(const char* c, size_t l) {
|
||||
return Arbutils::ConstString_Literal(c, l);
|
||||
inline constexpr ArbUt::ConstString_Literal operator"" _c(const char* c, size_t l) {
|
||||
return ArbUt::ConstString_Literal(c, l);
|
||||
}
|
||||
|
||||
ConstStringCore(
|
||||
|
@ -55,11 +55,11 @@ ConstStringCore(
|
|||
return charToLower(*input) ? static_cast<uint32_t>(charToLower(*input)) + 33 * Hash(input + 1) : 5381;
|
||||
};);
|
||||
|
||||
inline constexpr Arbutils::CaseInsensitiveConstString_Literal operator"" _const_nocase(const char* c, size_t l) {
|
||||
return Arbutils::CaseInsensitiveConstString_Literal(c, l);
|
||||
inline constexpr ArbUt::CaseInsensitiveConstString_Literal operator"" _const_nocase(const char* c, size_t l) {
|
||||
return ArbUt::CaseInsensitiveConstString_Literal(c, l);
|
||||
}
|
||||
inline constexpr Arbutils::CaseInsensitiveConstString_Literal operator"" _cnc(const char* c, size_t l) {
|
||||
return Arbutils::CaseInsensitiveConstString_Literal(c, l);
|
||||
inline constexpr ArbUt::CaseInsensitiveConstString_Literal operator"" _cnc(const char* c, size_t l) {
|
||||
return ArbUt::CaseInsensitiveConstString_Literal(c, l);
|
||||
}
|
||||
|
||||
#endif // ARBUTILS_CONSTSTRING_HPP
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#include "../extern/pcg_random.hpp"
|
||||
#include "Assert.hpp"
|
||||
|
||||
namespace Arbutils {
|
||||
namespace ArbUt {
|
||||
|
||||
template <class RandomT> class BaseRandom {
|
||||
private:
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
#endif
|
||||
|
||||
#define ConstStringCore(name, hashFunction) \
|
||||
namespace Arbutils { \
|
||||
namespace ArbUt { \
|
||||
class name { \
|
||||
private: \
|
||||
__ConstStringCharHolder* _str; \
|
||||
|
@ -112,11 +112,11 @@
|
|||
} \
|
||||
\
|
||||
namespace std { \
|
||||
template <> struct hash<Arbutils::name> { \
|
||||
constexpr std::size_t operator()(Arbutils::name const& s) const noexcept { return s.GetHash(); } \
|
||||
template <> struct hash<ArbUt::name> { \
|
||||
constexpr std::size_t operator()(ArbUt::name const& s) const noexcept { return s.GetHash(); } \
|
||||
}; \
|
||||
template <> struct hash<Arbutils::name##_Literal> { \
|
||||
constexpr std::size_t operator()(Arbutils::name##_Literal const& s) const noexcept { return s.GetHash(); } \
|
||||
template <> struct hash<ArbUt::name##_Literal> { \
|
||||
constexpr std::size_t operator()(ArbUt::name##_Literal const& s) const noexcept { return s.GetHash(); } \
|
||||
}; \
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
#include "../src/ConstString.hpp"
|
||||
|
||||
TEST_CASE("Use const string in unordered_map", "[Utilities]") {
|
||||
std::unordered_map<Arbutils::ConstString, int32_t> map;
|
||||
std::unordered_map<ArbUt::ConstString, int32_t> map;
|
||||
map.insert({"foo"_c, 1});
|
||||
map.insert({"bar"_c, 5});
|
||||
|
||||
|
@ -14,7 +14,7 @@ TEST_CASE("Use const string in unordered_map", "[Utilities]") {
|
|||
}
|
||||
|
||||
TEST_CASE("Use const string in switch case", "[Utilities]") {
|
||||
auto val = Arbutils::ConstString("foobar");
|
||||
auto val = ArbUt::ConstString("foobar");
|
||||
switch (val) {
|
||||
case "foo"_c: FAIL(); break;
|
||||
case "bar"_c: FAIL(); break;
|
||||
|
@ -24,7 +24,7 @@ TEST_CASE("Use const string in switch case", "[Utilities]") {
|
|||
}
|
||||
|
||||
TEST_CASE("Use insensitive const string in unordered_map", "[Utilities]") {
|
||||
std::unordered_map<Arbutils::CaseInsensitiveConstString, int32_t> map;
|
||||
std::unordered_map<ArbUt::CaseInsensitiveConstString, int32_t> map;
|
||||
map.insert({"foO"_cnc, 1});
|
||||
map.insert({"bAR"_cnc, 5});
|
||||
|
||||
|
@ -33,7 +33,7 @@ TEST_CASE("Use insensitive const string in unordered_map", "[Utilities]") {
|
|||
}
|
||||
|
||||
TEST_CASE("Use case insensitive const string in switch case", "[Utilities]") {
|
||||
auto val = Arbutils::CaseInsensitiveConstString("foobar");
|
||||
auto val = ArbUt::CaseInsensitiveConstString("foobar");
|
||||
switch (val) {
|
||||
case "foo"_cnc: FAIL(); break;
|
||||
case "bar"_cnc: FAIL(); break;
|
||||
|
@ -45,7 +45,7 @@ TEST_CASE("Use case insensitive const string in switch case", "[Utilities]") {
|
|||
#ifndef WINDOWS
|
||||
__attribute__((optnone))
|
||||
#endif
|
||||
static Arbutils::CaseInsensitiveConstString
|
||||
static ArbUt::CaseInsensitiveConstString
|
||||
TestCreateConstString() {
|
||||
char originalVal[7];
|
||||
originalVal[0] = 'f';
|
||||
|
@ -55,17 +55,17 @@ TestCreateConstString() {
|
|||
originalVal[4] = 'a';
|
||||
originalVal[5] = 'r';
|
||||
originalVal[6] = '\0';
|
||||
return Arbutils::CaseInsensitiveConstString(originalVal);
|
||||
return ArbUt::CaseInsensitiveConstString(originalVal);
|
||||
}
|
||||
|
||||
TEST_CASE("Out of scope char* doesn't lose reference", "[Utilities]") {
|
||||
Arbutils::CaseInsensitiveConstString val = TestCreateConstString();
|
||||
ArbUt::CaseInsensitiveConstString val = TestCreateConstString();
|
||||
INFO(val.c_str());
|
||||
REQUIRE(strcmp(val.c_str(), "foobar") == 0);
|
||||
}
|
||||
|
||||
TEST_CASE("Literal conststring to non literal, then use", "[Utilities]") {
|
||||
Arbutils::CaseInsensitiveConstString val;
|
||||
ArbUt::CaseInsensitiveConstString val;
|
||||
{ val = "foobar"_cnc; }
|
||||
INFO(val.c_str());
|
||||
REQUIRE(strcmp(val.c_str(), "foobar") == 0);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifdef TESTS_BUILD
|
||||
#include "../extern/catch.hpp"
|
||||
#include "../src/Collections/Dictionary.hpp"
|
||||
using namespace Arbutils::Collections;
|
||||
using namespace ArbUt::Collections;
|
||||
|
||||
TEST_CASE("Create Dictionary, insert values", "[Utilities]") {
|
||||
auto dic = Dictionary<int, int>(5);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifdef TESTS_BUILD
|
||||
#include "../extern/catch.hpp"
|
||||
#include "../src/Collections/List.hpp"
|
||||
using namespace Arbutils::Collections;
|
||||
using namespace ArbUt::Collections;
|
||||
|
||||
TEST_CASE("Create List, insert values", "[Utilities]") {
|
||||
auto ls = List<int>();
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
#include "../src/Random.hpp"
|
||||
|
||||
TEST_CASE("Random ints", "[Utilities]") {
|
||||
auto rand = Arbutils::Random(10);
|
||||
auto rand = ArbUt::Random(10);
|
||||
CHECK(rand.Get() == 1234817989);
|
||||
CHECK(rand.Get() == 1171957426);
|
||||
CHECK(rand.Get() == 275100647);
|
||||
|
@ -19,7 +19,7 @@ TEST_CASE("Random ints", "[Utilities]") {
|
|||
}
|
||||
|
||||
TEST_CASE("Random ints with limit", "[Utilities]") {
|
||||
auto rand = Arbutils::Random(10);
|
||||
auto rand = ArbUt::Random(10);
|
||||
CHECK(rand.Get(10) == 2);
|
||||
CHECK(rand.Get(10) == 2);
|
||||
CHECK(rand.Get(10) == 0);
|
||||
|
@ -43,7 +43,7 @@ TEST_CASE("Random ints with limit", "[Utilities]") {
|
|||
}
|
||||
|
||||
TEST_CASE("Random ints with upper and bottom", "[Utilities]") {
|
||||
auto rand = Arbutils::Random(10);
|
||||
auto rand = ArbUt::Random(10);
|
||||
CHECK(rand.Get(10, 30) == 15);
|
||||
CHECK(rand.Get(10, 30) == 15);
|
||||
CHECK(rand.Get(10, 30) == 11);
|
||||
|
@ -57,7 +57,7 @@ TEST_CASE("Random ints with upper and bottom", "[Utilities]") {
|
|||
}
|
||||
|
||||
TEST_CASE("Random distribution (max 0, min 1)", "[Utilities]") {
|
||||
auto rand = Arbutils::Random(10);
|
||||
auto rand = ArbUt::Random(10);
|
||||
const int size = 100000;
|
||||
int arr[size];
|
||||
for (size_t i = 0; i < size; i++) {
|
||||
|
@ -70,7 +70,7 @@ TEST_CASE("Random distribution (max 0, min 1)", "[Utilities]") {
|
|||
}
|
||||
|
||||
TEST_CASE("Random distribution (max 0, min 2)", "[Utilities]") {
|
||||
auto rand = Arbutils::Random(10);
|
||||
auto rand = ArbUt::Random(10);
|
||||
const int size = 100000;
|
||||
int arr[size];
|
||||
for (size_t i = 0; i < size; i++) {
|
||||
|
@ -92,7 +92,7 @@ TEST_CASE("Random distribution (max 0, min 2)", "[Utilities]") {
|
|||
}
|
||||
|
||||
TEST_CASE("Random distribution (max 0, min 3)", "[Utilities]") {
|
||||
auto rand = Arbutils::Random(10);
|
||||
auto rand = ArbUt::Random(10);
|
||||
const size_t size = 100000;
|
||||
int arr[size];
|
||||
for (size_t i = 0; i < size; i++) {
|
||||
|
|
Loading…
Reference in New Issue