File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change 22// Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT.
33// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
44
5+ #include < cstdint>
56#include < sys/mman.h>
67
78#include " base.hpp"
@@ -169,3 +170,19 @@ TEST_F(test, utils_open) {
169170 EXPECT_EQ (utils_file_open (NULL ), -1 );
170171 EXPECT_EQ (utils_file_open_or_create (NULL ), -1 );
171172}
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