Style fixes.
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
abca51d331
commit
088f66c385
|
@ -9,8 +9,8 @@ namespace ArbUt {
|
||||||
uint32_t _hash;
|
uint32_t _hash;
|
||||||
|
|
||||||
constexpr BasicStringView(size_t length, uint32_t hash) : _length(length), _hash(hash) {}
|
constexpr BasicStringView(size_t length, uint32_t hash) : _length(length), _hash(hash) {}
|
||||||
public:
|
|
||||||
|
|
||||||
|
public:
|
||||||
[[nodiscard]] inline constexpr size_t Length() const noexcept { return _length; }
|
[[nodiscard]] inline constexpr size_t Length() const noexcept { return _length; }
|
||||||
[[nodiscard]] inline constexpr uint32_t GetHash() const noexcept { return _hash; }
|
[[nodiscard]] inline constexpr uint32_t GetHash() const noexcept { return _hash; }
|
||||||
[[nodiscard]] inline constexpr std::size_t operator()(BasicStringView const& s) const noexcept { return _hash; }
|
[[nodiscard]] inline constexpr std::size_t operator()(BasicStringView const& s) const noexcept { return _hash; }
|
||||||
|
@ -28,7 +28,6 @@ namespace ArbUt {
|
||||||
virtual constexpr bool operator!=(const std::string_view& rhs) const noexcept = 0;
|
virtual constexpr bool operator!=(const std::string_view& rhs) const noexcept = 0;
|
||||||
virtual constexpr bool operator==(const char* rhs) const noexcept = 0;
|
virtual constexpr bool operator==(const char* rhs) const noexcept = 0;
|
||||||
virtual constexpr bool operator!=(const char* rhs) const noexcept = 0;
|
virtual constexpr bool operator!=(const char* rhs) const noexcept = 0;
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -92,7 +92,9 @@ namespace ArbUt {
|
||||||
inline constexpr bool operator!=(const char* rhs) const noexcept override { return _hash != Hash(rhs); }
|
inline constexpr bool operator!=(const char* rhs) const noexcept override { return _hash != Hash(rhs); }
|
||||||
|
|
||||||
inline static constexpr uint32_t CalculateHash(const char* val) noexcept { return Hash(val); }
|
inline static constexpr uint32_t CalculateHash(const char* val) noexcept { return Hash(val); }
|
||||||
inline static constexpr uint32_t CalculateHash(const std::string_view& val) noexcept { return Hash(val.data()); }
|
inline static constexpr uint32_t CalculateHash(const std::string_view& val) noexcept {
|
||||||
|
return Hash(val.data());
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,9 +9,7 @@ TEST_CASE("Initialize compile time", "[Utilities]") {
|
||||||
static_assert("bar"_cnc.Length() == 3);
|
static_assert("bar"_cnc.Length() == 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("Compare compile time", "[Utilities]") {
|
TEST_CASE("Compare compile time", "[Utilities]") { static_assert("foo"_cnc != "bar"_cnc); }
|
||||||
static_assert("foo"_cnc != "bar"_cnc);
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_CASE("Compare compile time with CaseInsensitiveConstString", "[Utilities]") {
|
TEST_CASE("Compare compile time with CaseInsensitiveConstString", "[Utilities]") {
|
||||||
static_assert("foo"_cnc == ArbUt::StringViewLiteral("foo"));
|
static_assert("foo"_cnc == ArbUt::StringViewLiteral("foo"));
|
||||||
|
|
|
@ -73,5 +73,4 @@ TEST_CASE("Test list out of bounds", "[Utilities]") {
|
||||||
REQUIRE_THROWS(ls.At(7));
|
REQUIRE_THROWS(ls.At(7));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -51,5 +51,4 @@ TEST_CASE("Test unique ptr list out of bounds", "[Utilities]") {
|
||||||
REQUIRE_THROWS(ls.At(2));
|
REQUIRE_THROWS(ls.At(2));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
Loading…
Reference in New Issue