blob: abb63588f34947be2edcd3f3116fed5dce1d332f [file] [log] [blame]
Ewout van Bekkum2a5f4da2021-08-02 13:44:10 -07001// 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
19namespace pw::bytes {
20namespace {
21
22using namespace pw::bytes::unit_literals;
23
24static_assert(1_B == 1ull);
25static_assert(42_B == 42ull);
26
27static_assert(1_KiB == 1'024ull);
28static_assert(42_KiB == 43'008ull);
29
30static_assert(1_MiB == 1'048'576ull);
31static_assert(42_MiB == 44'040'192ull);
32
33static_assert(1_GiB == 1'073'741'824ull);
34static_assert(42_GiB == 45'097'156'608ull);
35
36static_assert(1_TiB == 1'099'511'627'776ull);
37static_assert(42_TiB == 46'179'488'366'592ull);
38
39static_assert(1_PiB == 1'125'899'906'842'624ull);
40static_assert(42_PiB == 47'287'796'087'390'208ull);
41
42static_assert(1_EiB == 1'152'921'504'606'846'976ull);
43static_assert(4_EiB == 4'611'686'018'427'387'904ull);
44
45} // namespace
46} // namespace pw::bytes