File tree 1 file changed +17
-0
lines changed
1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change 2
2
// Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT.
3
3
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
4
4
5
+ #include < cstdint>
5
6
#include < sys/mman.h>
6
7
7
8
#include " base.hpp"
@@ -169,3 +170,19 @@ TEST_F(test, utils_open) {
169
170
EXPECT_EQ (utils_file_open (NULL ), -1 );
170
171
EXPECT_EQ (utils_file_open_or_create (NULL ), -1 );
171
172
}
173
+
174
+ TEST_F (test, utils_align_ptr_up_size_down) {
175
+ uintptr_t ptr = 0x4000 ;
176
+ size_t size = 0x8000 ;
177
+ size_t alignment = 0x4000 ;
178
+ utils_align_ptr_up_size_down ((void **)&ptr, &size, alignment);
179
+ EXPECT_EQ (ptr, 0x4000 );
180
+ EXPECT_EQ (size, 0x8000 );
181
+
182
+ ptr = 0x4001 ;
183
+ size = 0x8000 ;
184
+ alignment = 0x4000 ;
185
+ utils_align_ptr_up_size_down ((void **)&ptr, &size, alignment);
186
+ EXPECT_EQ (ptr, 0x8000 );
187
+ EXPECT_EQ (size, 0x4001 );
188
+ }
You can’t perform that action at this time.
0 commit comments