12#include "gtest/gtest.h"
16TEST(StringUtilsTest, StringPrintfEmpty) {
20TEST(StringUtilsTest, StringPrintfMisc) {
21 EXPECT_EQ(
"123hello w",
StringPrintf(
"%3d%2s %1c", 123,
"hello",
'w'));
24TEST(StringUtilsTest, StringPrintfErrno) {
30TEST(StringUtilsTest, canASCIIToUTF16) {
31 std::string ascii =
"abcdefg";
35TEST(StringUtilsTest, canUTF8ToUTF16) {
36 std::string
utf8 =
"äåè";
40TEST(StringUtilsTest, canUTF16ToUTF8) {
41 std::u16string utf16 = u
"äåè";
45TEST(StringUtilsTest, canNumberToString16) {
49TEST(StringUtilsTest, numberToStringSimplifiesOutput) {
70 EXPECT_STREQ(
NumberToString(0.00000012345678).c_str(),
"1.2345678e-7");
72 EXPECT_STREQ(
NumberToString(0.00000012345678f).c_str(),
"1.2345679e-7");
73 EXPECT_STREQ(
NumberToString(-0.00000012345678).c_str(),
"-1.2345678e-7");
75 EXPECT_STREQ(
NumberToString(-0.00000012345678f).c_str(),
"-1.2345679e-7");
76 EXPECT_STREQ(
NumberToString(
static_cast<unsigned int>(11)).c_str(),
"11");
77 EXPECT_STREQ(
NumberToString(
static_cast<int32_t
>(-23)).c_str(),
"-23");
std::string StringPrintf(const std::string &format, Args... args)
TEST(StringUtilsTest, StringPrintfEmpty)
std::string UTF16ToUTF8(std::u16string src)
std::u16string UTF8ToUTF16(std::string src)
std::u16string ASCIIToUTF16(std::string src)
std::string NumberToString(int32_t number)
std::u16string NumberToString16(float number)
int compare(const void *untyped_lhs, const void *untyped_rhs)