Files
textmate/Frameworks/text/tests/t_format.cc
2013-07-26 13:53:58 +02:00

15 lines
620 B
C++

#include <text/format.h>
void test_format_number ()
{
OAK_ASSERT_EQ(text::format_size(1), "1 byte");
OAK_ASSERT_EQ(text::format_size(2), "2 bytes");
OAK_ASSERT_EQ(text::format_size(600), "600 bytes");
OAK_ASSERT_EQ(text::format_size(1024), "1.0 KiB");
OAK_ASSERT_EQ(text::format_size(5*1024), "5.0 KiB");
OAK_ASSERT_EQ(text::format_size(5*1024+512), "5.5 KiB");
OAK_ASSERT_EQ(text::format_size(1024*1024), "1.0 MiB");
OAK_ASSERT_EQ(text::format_size(5*1024*1024), "5.0 MiB");
OAK_ASSERT_EQ(text::format_size(1024*1024*1024), "1.0 GiB");
}