Ewout van Bekkum | 2a5f4da | 2021-08-02 13:44:10 -0700 | [diff] [blame^] | 1 | // Copyright 2020 The Pigweed Authors |
| 2 | // |
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not |
| 4 | // use this file except in compliance with the License. You may obtain a copy of |
| 5 | // the License at |
| 6 | // |
| 7 | // https://www.apache.org/licenses/LICENSE-2.0 |
| 8 | // |
| 9 | // Unless required by applicable law or agreed to in writing, software |
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 11 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 12 | // License for the specific language governing permissions and limitations under |
| 13 | // the License. |
| 14 | |
| 15 | #include "pw_bytes/units.h" |
| 16 | |
| 17 | #include <cstddef> |
| 18 | |
| 19 | namespace pw::bytes { |
| 20 | namespace { |
| 21 | |
| 22 | using namespace pw::bytes::unit_literals; |
| 23 | |
| 24 | static_assert(1_B == 1ull); |
| 25 | static_assert(42_B == 42ull); |
| 26 | |
| 27 | static_assert(1_KiB == 1'024ull); |
| 28 | static_assert(42_KiB == 43'008ull); |
| 29 | |
| 30 | static_assert(1_MiB == 1'048'576ull); |
| 31 | static_assert(42_MiB == 44'040'192ull); |
| 32 | |
| 33 | static_assert(1_GiB == 1'073'741'824ull); |
| 34 | static_assert(42_GiB == 45'097'156'608ull); |
| 35 | |
| 36 | static_assert(1_TiB == 1'099'511'627'776ull); |
| 37 | static_assert(42_TiB == 46'179'488'366'592ull); |
| 38 | |
| 39 | static_assert(1_PiB == 1'125'899'906'842'624ull); |
| 40 | static_assert(42_PiB == 47'287'796'087'390'208ull); |
| 41 | |
| 42 | static_assert(1_EiB == 1'152'921'504'606'846'976ull); |
| 43 | static_assert(4_EiB == 4'611'686'018'427'387'904ull); |
| 44 | |
| 45 | } // namespace |
| 46 | } // namespace pw::bytes |