vsnprintf: Added more unit tests.

This commit is contained in:
Branimir Karadžić
2017-02-12 20:04:19 -08:00
parent 5da8a80a1f
commit 71cc735785
6 changed files with 79 additions and 30 deletions

View File

@@ -6,6 +6,7 @@
#include "test.h"
#include <bx/string.h>
#include <inttypes.h>
#include <float.h>
TEST_CASE("vsnprintf NULL buffer", "No output buffer provided.")
{
@@ -52,6 +53,13 @@ TEST_CASE("vsnprintf f", "")
REQUIRE(test(" 13.370", "%*.*f", 8, 3, 13.37) );
REQUIRE(test("13.370 ", "%-8.3f", 13.37) );
REQUIRE(test("13.370 ", "%*.*f", -8, 3, 13.37) );
REQUIRE(test("nan ", "%-8f", NAN) );
REQUIRE(test(" nan", "%8f", NAN) );
REQUIRE(test("-NAN ", "%-8F", -NAN) );
REQUIRE(test(" inf", "%8f", INFINITY) );
REQUIRE(test("inf ", "%-8f", INFINITY) );
REQUIRE(test(" -INF", "%8F", -INFINITY) );
}
TEST_CASE("vsnprintf d/i/o/u/x", "")