| 1 |
//===-- BenchmarkRunnerTest.cpp ---------------------------------*- C++ -*-===// |
| 2 |
// |
| 3 |
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 4 |
// See https://llvm.org/LICENSE.txt for license information. |
| 5 |
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 6 |
// |
| 7 |
//===----------------------------------------------------------------------===// |
| 8 |
|
| 9 |
#include "BenchmarkRunner.h" |
| 10 |
#include "gmock/gmock.h" |
| 11 |
#include "gtest/gtest.h" |
| 12 |
|
| 13 |
namespace llvm { |
| 14 |
namespace exegesis { |
| 15 |
|
| 16 |
namespace { |
| 17 |
|
| 18 |
TEST(ScratchSpaceTest, Works) { |
| 19 |
BenchmarkRunner::ScratchSpace Space; |
| 20 |
EXPECT_EQ(reinterpret_cast<intptr_t>(Space.ptr()) % |
| 21 |
BenchmarkRunner::ScratchSpace::kAlignment, |
| 22 |
0u); |
| 23 |
Space.ptr()[0] = 42; |
| 24 |
Space.ptr()[BenchmarkRunner::ScratchSpace::kSize - 1] = 43; |
| 25 |
Space.clear(); |
| 26 |
EXPECT_EQ(Space.ptr()[0], 0); |
| 27 |
EXPECT_EQ(Space.ptr()[BenchmarkRunner::ScratchSpace::kSize - 1], 0); |
| 28 |
} |
| 29 |
|
| 30 |
} // namespace |
| 31 |
} // namespace exegesis |
| 32 |
} // namespace llvm |