summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/tools/llvm-exegesis/BenchmarkRunnerTest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/unittests/tools/llvm-exegesis/BenchmarkRunnerTest.cpp')
-rw-r--r--llvm/unittests/tools/llvm-exegesis/BenchmarkRunnerTest.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/llvm/unittests/tools/llvm-exegesis/BenchmarkRunnerTest.cpp b/llvm/unittests/tools/llvm-exegesis/BenchmarkRunnerTest.cpp
new file mode 100644
index 00000000000..05b36a31b9e
--- /dev/null
+++ b/llvm/unittests/tools/llvm-exegesis/BenchmarkRunnerTest.cpp
@@ -0,0 +1,31 @@
+//===-- BenchmarkRunnerTest.cpp ---------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "BenchmarkRunner.h"
+#include "gmock/gmock.h"
+#include "gtest/gtest.h"
+
+namespace exegesis {
+
+namespace {
+
+TEST(ScratchSpaceTest, Works) {
+ BenchmarkRunner::ScratchSpace Space;
+ EXPECT_EQ(reinterpret_cast<intptr_t>(Space.ptr()) %
+ BenchmarkRunner::ScratchSpace::kAlignment,
+ 0u);
+ Space.ptr()[0] = 42;
+ Space.ptr()[BenchmarkRunner::ScratchSpace::kSize - 1] = 43;
+ Space.clear();
+ EXPECT_EQ(Space.ptr()[0], 0);
+ EXPECT_EQ(Space.ptr()[BenchmarkRunner::ScratchSpace::kSize - 1], 0);
+}
+
+} // namespace
+} // namespace exegesis
OpenPOWER on IntegriCloud