Added bx::toHuman. (#370)

This commit is contained in:
Branimir Karadžić
2026-02-27 07:37:36 -08:00
committed by GitHub
parent 2b946b4668
commit a6168a9d1c
7 changed files with 137 additions and 46 deletions

View File

@@ -163,26 +163,26 @@ TEST_CASE("HandleHashTable", "")
bx::StringView sv0("test0");
bool ok = hm.insert(bx::hash<bx::HashMurmur2A>(sv0), 0);
bool ok = hm.insert(bx::hash<bx::HashMurmur3>(sv0), 0);
REQUIRE(ok);
ok = hm.insert(bx::hash<bx::HashMurmur2A>(sv0), 0);
ok = hm.insert(bx::hash<bx::HashMurmur3>(sv0), 0);
REQUIRE(!ok);
REQUIRE(1 == hm.getNumElements() );
bx::StringView sv1("test1");
ok = hm.insert(bx::hash<bx::HashMurmur2A>(sv1), 0);
ok = hm.insert(bx::hash<bx::HashMurmur3>(sv1), 0);
REQUIRE(ok);
REQUIRE(2 == hm.getNumElements() );
hm.removeByHandle(0);
REQUIRE(0 == hm.getNumElements() );
ok = hm.insert(bx::hash<bx::HashMurmur2A>(sv0), 0);
ok = hm.insert(bx::hash<bx::HashMurmur3>(sv0), 0);
REQUIRE(ok);
hm.removeByKey(bx::hash<bx::HashMurmur2A>(sv0) );
hm.removeByKey(bx::hash<bx::HashMurmur3>(sv0) );
REQUIRE(0 == hm.getNumElements() );
for (uint32_t ii = 0, num = hm.getMaxCapacity(); ii < num; ++ii)

View File

@@ -26,7 +26,7 @@ TEST_CASE("prettify", "[string]")
prettify(tmp, BX_COUNTOF(tmp), 4000, bx::Units::Kilo);
REQUIRE(0 == bx::strCmp(tmp, "4 kB") );
prettify(tmp, BX_COUNTOF(tmp), 4096, bx::Units::Kibi);
prettify(tmp, BX_COUNTOF(tmp), 4096, bx::Units::KibiByte);
REQUIRE(0 == bx::strCmp(tmp, "4 KiB") );
}