[glib] Improve test coverage
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] Improve test coverage
- Date: Wed, 4 Apr 2012 19:02:57 +0000 (UTC)
commit 84a1b8aac8478428fdc8085400674be52278c6eb
Author: Matthias Clasen <mclasen redhat com>
Date: Tue Apr 3 01:09:39 2012 -0400
Improve test coverage
Add tests for all the suffixes in g_format_size.
glib/tests/fileutils.c | 11 +++++++++++
1 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/glib/tests/fileutils.c b/glib/tests/fileutils.c
index 32f46a0..8816fd5 100644
--- a/glib/tests/fileutils.c
+++ b/glib/tests/fileutils.c
@@ -509,6 +509,17 @@ test_format_size_for_display (void)
check_string (g_format_size (1000 * 1000), "1.0 MB");
check_string (g_format_size (1000 * 1000 * 1000), "1.0 GB");
+ check_string (g_format_size_full (0, G_FORMAT_SIZE_IEC_UNITS), "0 bytes");
+ check_string (g_format_size_full (1, G_FORMAT_SIZE_IEC_UNITS), "1 byte");
+ check_string (g_format_size_full (2, G_FORMAT_SIZE_IEC_UNITS), "2 bytes");
+
+ check_string (g_format_size_full (2048ULL, G_FORMAT_SIZE_IEC_UNITS), "2.0 KiB");
+ check_string (g_format_size_full (2048ULL * 1024, G_FORMAT_SIZE_IEC_UNITS), "2.0 MiB");
+ check_string (g_format_size_full (2048ULL * 1024 * 1024, G_FORMAT_SIZE_IEC_UNITS), "2.0 GiB");
+ check_string (g_format_size_full (2048ULL * 1024 * 1024 * 1024, G_FORMAT_SIZE_IEC_UNITS), "2.0 TiB");
+ check_string (g_format_size_full (2048ULL * 1024 * 1024 * 1024 * 1024, G_FORMAT_SIZE_IEC_UNITS), "2.0 PiB");
+ check_string (g_format_size_full (2048ULL * 1024 * 1024 * 1024 * 1024 * 1024, G_FORMAT_SIZE_IEC_UNITS), "2.0 EiB");
+
check_string (g_format_size_full (238472938, G_FORMAT_SIZE_IEC_UNITS), "227.4 MiB");
check_string (g_format_size_full (238472938, G_FORMAT_SIZE_DEFAULT), "238.5 MB");
check_string (g_format_size_full (238472938, G_FORMAT_SIZE_LONG_FORMAT), "238.5 MB (238472938 bytes)");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]