Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(262)

Unified Diff: unittests/Bitcode/NaClMungedIoTest.cpp

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. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « unittests/Bitcode/NaClMungedBitcodeTest.cpp ('k') | unittests/Bitcode/NaClObjDumpTypesTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: unittests/Bitcode/NaClMungedIoTest.cpp
diff --git a/unittests/Bitcode/NaClMungedIoTest.cpp b/unittests/Bitcode/NaClMungedIoTest.cpp
index 016860dc4b086d5355b2d7991fbfa9872ff98373..7b2d57ebb5c12d431bb21ce788191a2902c3f211 100644
--- a/unittests/Bitcode/NaClMungedIoTest.cpp
+++ b/unittests/Bitcode/NaClMungedIoTest.cpp
@@ -11,27 +11,12 @@
// For class NaClMungedBitcode, tests reading initial sequence of records and
// writing out munged set of bitcode records.
-#include "llvm/ADT/STLExtras.h"
-#include "llvm/Bitcode/NaCl/NaClBitcodeMungeUtils.h"
-#include "llvm/Bitcode/NaCl/NaClBitcodeMunge.h"
+#include "NaClMungeTest.h"
-#include "gtest/gtest.h"
+namespace naclmungetest {
using namespace llvm;
-namespace {
-
-static const uint64_t Terminator = 0x5768798008978675LL;
-
-#define ARRAY_ARGS(name) name, array_lengthof(name), Terminator
-
-std::string stringify(NaClMungedBitcode &MungedBitcode) {
- std::string Buffer;
- raw_string_ostream StrBuf(Buffer);
- MungedBitcode.print(StrBuf);
- return StrBuf.str();
-}
-
typedef SmallVector<char, 1024> TextBuffer;
// Writes out a sequence of munged bitcode records, and writes them into
@@ -84,8 +69,8 @@ const uint64_t Records[] = {
// Show a more readable form of what the program is.
TEST(NaClMungedIoTest, TestDumpingBitcode) {
- NaClObjDumpMunger DumpMunger(ARRAY_ARGS(Records));
- EXPECT_TRUE(DumpMunger.runTest("Display assembly"));
+ NaClObjDumpMunger DumpMunger(ARRAY_TERM(Records));
+ EXPECT_TRUE(DumpMunger.runTest());
EXPECT_EQ(
" 0:0|<65532, 80, 69, 88, 69, 1, 0,|Magic Number: 'PEXE' (80, 69, "
"88, 69)\n"
@@ -122,7 +107,7 @@ TEST(NaClMungedIoTest, TestDumpingBitcode) {
// Test that we can write out bitcode, and then read it back in.
TEST(NaClMungedIoTest, TestWriteThenRead) {
// Create munged bitcode for the given records.
- NaClMungedBitcode Bitcode(ARRAY_ARGS(Records));
+ NaClMungedBitcode Bitcode(ARRAY_TERM(Records));
// The expected output when stringifying this input.
const std::string ExpectedRecords(
@@ -156,7 +141,7 @@ TEST(NaClMungedIoTest, TestWriteThenRead) {
// be divisible by 4.
TEST(NaClMungedIoTest, TestTruncatedNonalignedBitcode) {
// Created an example of a truncated bitcode file.
- NaClMungedBitcode Bitcode(ARRAY_ARGS(Records));
+ NaClMungedBitcode Bitcode(ARRAY_TERM(Records));
for (size_t i = 2, e = Bitcode.getBaseRecords().size(); i < e; ++i)
Bitcode.remove(i);
@@ -178,4 +163,4 @@ TEST(NaClMungedIoTest, TestTruncatedNonalignedBitcode) {
StrBuf.str());
}
-} // end of anonymous namespace
+} // end of namespace naclmungetest
« no previous file with comments | « unittests/Bitcode/NaClMungedBitcodeTest.cpp ('k') | unittests/Bitcode/NaClObjDumpTypesTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698