v8/test/unittests/base/macros-unittest.cc
Ulan Degenbaev 1d32273a49 [base] Align the address hint in VirtualMemory.
BUG=chromium:739644

Change-Id: I6c7d0f48c959826dd2a8587d7a321be4387ef39f
Reviewed-on: https://chromium-review.googlesource.com/586529
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Commit-Queue: Ulan Degenbaev <ulan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#46936}
2017-07-27 13:50:06 +00:00

26 lines
931 B
C++

// Copyright 2017 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "src/base/macros.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace v8 {
namespace base {
TEST(AlignedAddressTest, AlignedAddress) {
EXPECT_EQ(reinterpret_cast<void*>(0xFFFF0),
AlignedAddress(reinterpret_cast<void*>(0xFFFF0), 16));
EXPECT_EQ(reinterpret_cast<void*>(0xFFFF0),
AlignedAddress(reinterpret_cast<void*>(0xFFFF2), 16));
EXPECT_EQ(reinterpret_cast<void*>(0xFFFF0),
AlignedAddress(reinterpret_cast<void*>(0xFFFF2), 16));
EXPECT_EQ(reinterpret_cast<void*>(0xFFFF0),
AlignedAddress(reinterpret_cast<void*>(0xFFFFF), 16));
EXPECT_EQ(reinterpret_cast<void*>(0x0),
AlignedAddress(reinterpret_cast<void*>(0xFFFFF), 0x100000));
}
} // namespace base
} // namespace v8