33 lines · cpp
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-exception6//7//===----------------------------------------------------------------------===//8 9#include "BenchmarkRunner.h"10#include "gmock/gmock.h"11#include "gtest/gtest.h"12 13namespace llvm {14namespace exegesis {15 16namespace {17 18TEST(ScratchSpaceTest, Works) {19 BenchmarkRunner::ScratchSpace Space;20 EXPECT_EQ(reinterpret_cast<uintptr_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} // namespace31} // namespace exegesis32} // namespace llvm33