vsnprintf now can take StringView as argument.

This commit is contained in:
Бранимир Караџић
2021-10-03 16:11:27 -07:00
parent 70f998ba19
commit f5c797a03a
5 changed files with 133 additions and 27 deletions

View File

@@ -184,6 +184,22 @@ TEST_CASE("vsnprintf t")
size_t size = -1;
REQUIRE(test("-1", "%td", size) );
REQUIRE(test("3221225472", "%td", size_t(3221225472) ) );
}
TEST_CASE("vsnprintf n")
{
char temp[64];
int32_t p0, p1, p2;
bx::snprintf(temp, sizeof(temp), "%n", &p0);
REQUIRE(0 == p0);
bx::snprintf(temp, sizeof(temp), "01%n23%n45%n", &p0, &p1, &p2);
REQUIRE(2 == p0);
REQUIRE(4 == p1);
REQUIRE(6 == p2);
}
TEST_CASE("vsnprintf g")
@@ -215,6 +231,11 @@ TEST_CASE("vsnprintf")
, hello.getLength(), hello.getPtr()
, world.getLength(), world.getPtr()
) );
REQUIRE(test("hello, world!", "%S, %S!"
, hello
, world
) );
}
TEST_CASE("vsnprintf write")