Add test setting the locale.
This CL adds a test which sets the locale to one which uses `1,00` instead of `1.00`. This ensures the float emission will get the right format. Bug: tint:1686 Change-Id: Ib87235c7beac351b7dcbf37534df07135da377e5 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/120881 Reviewed-by: Ben Clayton <bclayton@google.com> Kokoro: Kokoro <noreply+kokoro@google.com> Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
This commit is contained in:
parent
077d97a387
commit
9cdc3343ff
|
@ -17,6 +17,7 @@
|
|||
#include <math.h>
|
||||
#include <cstring>
|
||||
#include <limits>
|
||||
#include <locale>
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "src/tint/utils/bitcast.h"
|
||||
|
@ -79,6 +80,16 @@ TEST(FloatToStringTest, Precision) {
|
|||
EXPECT_EQ(FloatToString(1e-20f), "9.99999968e-21");
|
||||
}
|
||||
|
||||
#if !defined(__linux__)
|
||||
TEST(FloatToStringTest, Locale) {
|
||||
std::locale::global(std::locale("sv_SE.UTF-8"));
|
||||
|
||||
EXPECT_EQ(FloatToString(1e-9f), "0.000000001");
|
||||
|
||||
std::locale::global(std::locale::classic());
|
||||
}
|
||||
#endif // !defined(__linux__)
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// FloatToBitPreservingString //
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
Loading…
Reference in New Issue