]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
chore: Add unit tests for parsing size with (undocumented) B suffix
authorJoel Rosdahl <joel@rosdahl.net>
Thu, 5 Jan 2023 18:14:17 +0000 (19:14 +0100)
committerJoel Rosdahl <joel@rosdahl.net>
Sun, 15 Jan 2023 20:33:57 +0000 (21:33 +0100)
unittest/test_Util.cpp

index a45d7c57abd5f1ac4cffd5785bc0144edd384e03..e5bca40c29634562556bbb6268b542eea69a4956 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2019-2022 Joel Rosdahl and other contributors
+// Copyright (C) 2019-2023 Joel Rosdahl and other contributors
 //
 // See doc/AUTHORS.adoc for a complete list of contributors.
 //
@@ -677,6 +677,9 @@ TEST_CASE("Util::parse_size")
   CHECK(Util::parse_size("2 Ti")
         == static_cast<uint64_t>(2) * 1024 * 1024 * 1024 * 1024);
 
+  CHECK(Util::parse_size("9MB") == 9 * 1000 * 1000);
+  CHECK(Util::parse_size("9MiB") == 9 * 1024 * 1024);
+
   CHECK_THROWS_WITH(Util::parse_size(""), "invalid size: \"\"");
   CHECK_THROWS_WITH(Util::parse_size("x"), "invalid size: \"x\"");
   CHECK_THROWS_WITH(Util::parse_size("10x"), "invalid size: \"10x\"");