]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test: fix argument type of test_format_bytes_one() 12892/head
authorYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 27 Jun 2019 01:20:18 +0000 (10:20 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 27 Jun 2019 01:31:55 +0000 (10:31 +0900)
Closes #12891.

src/test/test-format-util.c

index a60f9fe689145699dd7d874c895b0f45e469de9a..6558ee2b0a6f2b9ece864569405cbc34596bbdee 100644 (file)
@@ -4,7 +4,7 @@
 #include "macro.h"
 #include "string-util.h"
 
-static void test_format_bytes_one(size_t val, bool trailing_B, const char *iec_with_p, const char *iec_without_p,
+static void test_format_bytes_one(uint64_t val, bool trailing_B, const char *iec_with_p, const char *iec_without_p,
                                   const char *si_with_p, const char *si_without_p) {
         char buf[FORMAT_BYTES_MAX];
 
@@ -23,12 +23,13 @@ static void test_format_bytes(void) {
         test_format_bytes_one(1024, false, "1.0K", "1K", "1.0K", "1K");
         test_format_bytes_one(1100, true, "1.0K", "1K", "1.1K", "1K");
         test_format_bytes_one(1500, true, "1.4K", "1K", "1.5K", "1K");
-        test_format_bytes_one((size_t) 3*1024*1024, true, "3.0M", "3M", "3.1M", "3M");
-        test_format_bytes_one((size_t) 3*1024*1024*1024, true, "3.0G", "3G", "3.2G", "3G");
-        test_format_bytes_one((size_t) 3*1024*1024*1024*1024, true, "3.0T", "3T", "3.2T", "3T");
-        test_format_bytes_one((size_t) 3*1024*1024*1024*1024*1024, true, "3.0P", "3P", "3.3P", "3P");
-        test_format_bytes_one((size_t) 3*1024*1024*1024*1024*1024*1024, true, "3.0E", "3E", "3.4E", "3E");
-        test_format_bytes_one(SIZE_MAX, true, NULL, NULL, NULL, NULL);
+        test_format_bytes_one(UINT64_C(3)*1024*1024, true, "3.0M", "3M", "3.1M", "3M");
+        test_format_bytes_one(UINT64_C(3)*1024*1024*1024, true, "3.0G", "3G", "3.2G", "3G");
+        test_format_bytes_one(UINT64_C(3)*1024*1024*1024*1024, true, "3.0T", "3T", "3.2T", "3T");
+        test_format_bytes_one(UINT64_C(3)*1024*1024*1024*1024*1024, true, "3.0P", "3P", "3.3P", "3P");
+        test_format_bytes_one(UINT64_C(3)*1024*1024*1024*1024*1024*1024, true, "3.0E", "3E", "3.4E", "3E");
+        test_format_bytes_one(UINT64_MAX, true, NULL, NULL, NULL, NULL);
+        test_format_bytes_one(UINT64_MAX, false, NULL, NULL, NULL, NULL);
 }
 
 int main(void) {