Skip to content

Commit 0105600

Browse files
kuzuxAtkinsSJ
authored andcommitted
AK+Tests: Add a test for formatting numbers in base 10 units
Added a test case to TestNumberFormat to test the new base 10 formatting capability
1 parent 0dbb1be commit 0105600

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

Tests/AK/TestNumberFormat.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,3 +125,11 @@ TEST_CASE(extremes_8byte)
125125
warnln("(Skipping 8-byte-size_t test on 32-bit platform)");
126126
}
127127
}
128+
129+
TEST_CASE(base10_units)
130+
{
131+
EXPECT_EQ(human_readable_size(999, AK::HumanReadableBasedOn::Base10), "999 B");
132+
EXPECT_EQ(human_readable_size(1024, AK::HumanReadableBasedOn::Base10), "1.0 KB");
133+
EXPECT_EQ(human_readable_size(1100, AK::HumanReadableBasedOn::Base10), "1.1 KB");
134+
EXPECT_EQ(human_readable_size(1000000, AK::HumanReadableBasedOn::Base10), "1.0 MB");
135+
}

0 commit comments

Comments
 (0)