Added bx::StringLiteral.

This commit is contained in:
Бранимир Караџић
2023-05-04 20:09:54 -07:00
parent c5593ad749
commit d403162701
5 changed files with 113 additions and 16 deletions

View File

@@ -12,6 +12,35 @@
bx::AllocatorI* g_allocator;
TEST_CASE("StringLiteral", "")
{
constexpr bx::StringLiteral tmp[] = { "1389", "abvgd", "mac", "pod" };
REQUIRE(bx::isSorted(tmp, BX_COUNTOF(tmp) ) );
static_assert(4 == tmp[0].getLength() );
REQUIRE(0 == bx::strCmp("1389", tmp[0]) );
static_assert(5 == tmp[1].getLength() );
REQUIRE(0 == bx::strCmp("abvgd", tmp[1]) );
static_assert(3 == tmp[2].getLength() );
REQUIRE(0 == bx::strCmp("mac", tmp[2]) );
static_assert(3 == tmp[3].getLength() );
REQUIRE(0 == bx::strCmp("pod", tmp[3]) );
constexpr bx::StringLiteral copy = tmp[0];
static_assert(4 == copy.getLength() );
REQUIRE(0 == bx::strCmp("1389", copy) );
constexpr bx::StringView sv = tmp[1];
REQUIRE(5 == sv.getLength() );
REQUIRE(0 == bx::strCmp("abvgd", sv) );
}
TEST_CASE("stringPrintfTy", "")
{
std::string test;