diff options
author | Joel Rosdahl <joel@rosdahl.net> | 2023-01-05 19:14:17 +0100 |
---|---|---|
committer | Joel Rosdahl <joel@rosdahl.net> | 2023-01-15 21:33:57 +0100 |
commit | b7eed47f937155a6c0b62d26739e1b65c4edc1f2 (patch) | |
tree | e07942d7f8104a123eed55b33213411e9fe9187b | |
parent | 35a387e15924d5982d2a812759fb476a547b619a (diff) | |
download | ccache-b7eed47f937155a6c0b62d26739e1b65c4edc1f2.tar.gz |
chore: Add unit tests for parsing size with (undocumented) B suffix
-rw-r--r-- | unittest/test_Util.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/unittest/test_Util.cpp b/unittest/test_Util.cpp index a45d7c57..e5bca40c 100644 --- a/unittest/test_Util.cpp +++ b/unittest/test_Util.cpp @@ -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\""); |