From 4cc93123c8120f1f52af44c18236114b5cf5d999 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 17 Jul 2014 14:54:12 +1000 Subject: Add thousands separators to scene stats (D646) by januz with own modifications --- tests/gtests/blenlib/BLI_string_test.cc | 34 +++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'tests/gtests') diff --git a/tests/gtests/blenlib/BLI_string_test.cc b/tests/gtests/blenlib/BLI_string_test.cc index 13091d9e074..4c5c410dcb2 100644 --- a/tests/gtests/blenlib/BLI_string_test.cc +++ b/tests/gtests/blenlib/BLI_string_test.cc @@ -267,3 +267,37 @@ TEST(string, StrRPartitionUtf8) EXPECT_EQ(NULL, suf); } } + +/* BLI_str_format_int_grouped */ +TEST(string, StrFormatIntGrouped) +{ + char num_str[16]; + int num; + + BLI_str_format_int_grouped(num_str, num = 0); + EXPECT_STREQ("0", num_str); + + BLI_str_format_int_grouped(num_str, num = 1); + EXPECT_STREQ("1", num_str); + + BLI_str_format_int_grouped(num_str, num = -1); + EXPECT_STREQ("-1", num_str); + + BLI_str_format_int_grouped(num_str, num = -2147483648); + EXPECT_STREQ("-2,147,483,648", num_str); + + BLI_str_format_int_grouped(num_str, num = 2147483647); + EXPECT_STREQ("2,147,483,647", num_str); + + BLI_str_format_int_grouped(num_str, num = 1000); + EXPECT_STREQ("1,000", num_str); + + BLI_str_format_int_grouped(num_str, num = -1000); + EXPECT_STREQ("-1,000", num_str); + + BLI_str_format_int_grouped(num_str, num = 999); + EXPECT_STREQ("999", num_str); + + BLI_str_format_int_grouped(num_str, num = -999); + EXPECT_STREQ("-999", num_str); +} -- cgit v1.2.3