Chromium Code Reviews

Unified Diff: unittests/Bitcode/NaClMungeTest.h

Issue 1140153004: Clean up bitcode munging tests. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-llvm.git@master
Patch Set: Fix issues in patch set 2. Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
« no previous file with comments | « unittests/Bitcode/NaClCompressTests.cpp ('k') | unittests/Bitcode/NaClMungeWriteErrorTests.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: unittests/Bitcode/NaClMungeTest.h
diff --git a/unittests/Bitcode/NaClMungeTest.h b/unittests/Bitcode/NaClMungeTest.h
new file mode 100644
index 0000000000000000000000000000000000000000..52c7d93ddf3b2816e8db28de6cd58883e081d7bc
--- /dev/null
+++ b/unittests/Bitcode/NaClMungeTest.h
@@ -0,0 +1,41 @@
+//===- llvm/unittest/Bitcode/NaClMungeTest.h - Test munging utils ---------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// Contains common utilities used in bitcode munge tests.
+
+#ifndef LLVM_UNITTEST_BITCODE_NACLMUNGETEST_H
+#define LLVM_UNITTEST_BITCODE_NACLMUNGETEST_H
+
+#include "llvm/ADT/STLExtras.h"
+#include "llvm/Bitcode/NaCl/NaClBitcodeMunge.h"
+
+#include "gtest/gtest.h"
+
+namespace naclmungetest {
+
+const uint64_t Terminator = 0x5768798008978675LL;
+
+#define ARRAY(name) name, array_lengthof(name)
+
+#define ARRAY_TERM(name) ARRAY(name), Terminator
+
+inline std::string stringify(llvm::NaClMungedBitcode &MungedBitcode) {
+ std::string Buffer;
+ llvm::raw_string_ostream StrBuf(Buffer);
+ MungedBitcode.print(StrBuf);
+ return StrBuf.str();
+}
+
+inline std::string stringify(llvm::NaClBitcodeMunger &Munger) {
+ return stringify(Munger.getMungedBitcode());
+}
+
+} // end of namespace naclmungetest
+
+#endif // end LLVM_UNITTEST_BITCODE_NACLMUNGETEST_H
« no previous file with comments | « unittests/Bitcode/NaClCompressTests.cpp ('k') | unittests/Bitcode/NaClMungeWriteErrorTests.cpp » ('j') | no next file with comments »

Powered by Google App Engine