Guillaume Chatelet | fb94354 | 2018-08-01 14:41:45 +0000 | [diff] [blame] | 1 | //===-- BenchmarkRunnerTest.cpp ---------------------------------*- C++ -*-===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | |
| 10 | #include "BenchmarkRunner.h" |
| 11 | #include "gmock/gmock.h" |
| 12 | #include "gtest/gtest.h" |
| 13 | |
Fangrui Song | 32401af | 2018-10-22 17:10:47 +0000 | [diff] [blame] | 14 | namespace llvm { |
Guillaume Chatelet | fb94354 | 2018-08-01 14:41:45 +0000 | [diff] [blame] | 15 | namespace exegesis { |
| 16 | |
| 17 | namespace { |
| 18 | |
| 19 | TEST(ScratchSpaceTest, Works) { |
| 20 | BenchmarkRunner::ScratchSpace Space; |
| 21 | EXPECT_EQ(reinterpret_cast<intptr_t>(Space.ptr()) % |
| 22 | BenchmarkRunner::ScratchSpace::kAlignment, |
| 23 | 0u); |
| 24 | Space.ptr()[0] = 42; |
| 25 | Space.ptr()[BenchmarkRunner::ScratchSpace::kSize - 1] = 43; |
| 26 | Space.clear(); |
| 27 | EXPECT_EQ(Space.ptr()[0], 0); |
| 28 | EXPECT_EQ(Space.ptr()[BenchmarkRunner::ScratchSpace::kSize - 1], 0); |
| 29 | } |
| 30 | |
| 31 | } // namespace |
| 32 | } // namespace exegesis |
Fangrui Song | 32401af | 2018-10-22 17:10:47 +0000 | [diff] [blame] | 33 | } // namespace llvm |