mirror of
https://github.com/bkaradzic/bx.git
synced 2026-02-17 20:52:37 +01:00
Added bx::StringLiteral.
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user