Improve test coverage

Add tests for all the suffixes in g_format_size.
This commit is contained in:
Matthias Clasen 2012-04-03 01:09:39 -04:00
parent 51609ec943
commit 84a1b8aac8

View File

@ -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)");