diff options
author | bruvzg <7645683+bruvzg@users.noreply.github.com> | 2023-09-05 09:31:29 +0300 |
---|---|---|
committer | bruvzg <7645683+bruvzg@users.noreply.github.com> | 2023-09-05 11:32:55 +0300 |
commit | 2b3bbde6dae2e251b1805b4dc731a18f5cb33629 (patch) | |
tree | 24546bfac11ba425d6d6a79fa3a719e4893f3510 /tests | |
parent | e7208420bc45dc873bf2eeb0b34d758b7755aa3e (diff) | |
download | redot-engine-2b3bbde6dae2e251b1805b4dc731a18f5cb33629.tar.gz |
[String] Fix string conversion for -0.0 float values.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/core/string/test_string.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/core/string/test_string.h b/tests/core/string/test_string.h index 659fb003d3..c10ad6e13d 100644 --- a/tests/core/string/test_string.h +++ b/tests/core/string/test_string.h @@ -805,6 +805,22 @@ TEST_CASE("[String] sprintf") { REQUIRE(error == false); CHECK(output == String("fish +99.990000 frog")); + // Real with sign (negative zero). + format = "fish %+f frog"; + args.clear(); + args.push_back(-0.0); + output = format.sprintf(args, &error); + REQUIRE(error == false); + CHECK(output == String("fish -0.000000 frog")); + + // Real with sign (positive zero). + format = "fish %+f frog"; + args.clear(); + args.push_back(0.0); + output = format.sprintf(args, &error); + REQUIRE(error == false); + CHECK(output == String("fish +0.000000 frog")); + // Real with 1 decimal. format = "fish %.1f frog"; args.clear(); |