xref: /aosp_15_r20/external/pigweed/pw_allocator/bucket/unordered_test.cc (revision 61c4878ac05f98d0ceed94b57d316916de578985)
1 // Copyright 2024 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_allocator/bucket/unordered.h"
16 
17 #include <cstddef>
18 #include <cstdint>
19 
20 #include "pw_allocator/block/detailed_block.h"
21 #include "pw_allocator/bucket/testing.h"
22 #include "pw_unit_test/framework.h"
23 
24 namespace {
25 
26 using ::pw::allocator::UnorderedBucket;
27 using ::pw::allocator::UnorderedItem;
28 using ::pw::allocator::test::BucketTest;
29 
30 using BlockType = ::pw::allocator::DetailedBlock<uint32_t, UnorderedItem>;
31 using UnorderedBucketTest = BucketTest<UnorderedBucket<BlockType>>;
32 
TEST_F(UnorderedBucketTest,SetsAndGetsMaxInnerSize)33 TEST_F(UnorderedBucketTest, SetsAndGetsMaxInnerSize) {
34   SetsAndGetsMaxInnerSize();
35 }
36 
TEST_F(UnorderedBucketTest,AddsAndRemovesBlocks)37 TEST_F(UnorderedBucketTest, AddsAndRemovesBlocks) { AddsAndRemovesBlocks(); }
38 
TEST_F(UnorderedBucketTest,FailsToAddWhenBlockIsTooSmall)39 TEST_F(UnorderedBucketTest, FailsToAddWhenBlockIsTooSmall) {
40   FailsToAddWhenBlockIsTooSmall();
41 }
42 
TEST_F(UnorderedBucketTest,FailsToRemoveBlockWhenNotFound)43 TEST_F(UnorderedBucketTest, FailsToRemoveBlockWhenNotFound) {
44   FailsToRemoveBlockWhenNotFound();
45 }
46 
TEST_F(UnorderedBucketTest,RemovesUnspecifiedBlock)47 TEST_F(UnorderedBucketTest, RemovesUnspecifiedBlock) {
48   RemovesUnspecifiedBlock();
49 }
50 
TEST_F(UnorderedBucketTest,RemovesByLayout)51 TEST_F(UnorderedBucketTest, RemovesByLayout) { RemovesByLayout(); }
52 
TEST_F(UnorderedBucketTest,FailsToRemoveByExcessiveSize)53 TEST_F(UnorderedBucketTest, FailsToRemoveByExcessiveSize) {
54   FailsToRemoveByExcessiveSize();
55 }
56 
57 }  // namespace
58