This commit is contained in:
Branimir Karadžić
2018-11-11 16:48:46 -08:00
parent c91ef5c12f
commit 43f530b4ec
4 changed files with 27 additions and 9 deletions

View File

@@ -5,6 +5,8 @@
#include "test.h"
#include <bx/string.h>
#include <bx/readerwriter.h>
#include <limits>
#include <inttypes.h>
@@ -173,3 +175,18 @@ TEST_CASE("vsnprintf", "")
, world.getLength(), world.getPtr()
) );
}
TEST_CASE("vsnprintf write")
{
char tmp[64];
bx::StaticMemoryBlock mb(tmp, sizeof(tmp));
bx::MemoryWriter writer(&mb);
bx::Error err;
int32_t len = bx::write(&writer, &err, "%d", 1389);
REQUIRE(err.isOk());
REQUIRE(len == 4);
bx::StringView str(tmp, len);
REQUIRE(0 == bx::strCmp(str, "1389"));
}