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

Unified Diff: unittests/Bitcode/NaClParseTypesTest.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/NaClParseInstsTest.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: unittests/Bitcode/NaClParseTypesTest.cpp
diff --git a/unittests/Bitcode/NaClParseTypesTest.cpp b/unittests/Bitcode/NaClParseTypesTest.cpp
index 4b46a2189aa1ec9667364124703dbfa0973a0de9..605f7532764a44851869cf963fe6d2810bf29351 100644
--- a/unittests/Bitcode/NaClParseTypesTest.cpp
+++ b/unittests/Bitcode/NaClParseTypesTest.cpp
@@ -12,16 +12,11 @@
// TODO(kschimpf) Add more tests.
-#include "llvm/ADT/STLExtras.h"
-#include "llvm/Bitcode/NaCl/NaClBitcodeMunge.h"
-
-#include "gtest/gtest.h"
+#include "NaClMungeTest.h"
using namespace llvm;
-namespace {
-
-static const uint64_t Terminator = 0x5768798008978675LL;
+namespace naclmungetest {
TEST(NaClParseTypesTest, BadTypeReferences) {
const uint64_t BitcodeRecords[] = {
@@ -37,9 +32,8 @@ TEST(NaClParseTypesTest, BadTypeReferences) {
const uint64_t ReplaceIndex = 4;
// Show text of base input.
- NaClObjDumpMunger BaseMunger(BitcodeRecords,
- array_lengthof(BitcodeRecords), Terminator);
- EXPECT_TRUE(BaseMunger.runTest("Bad type references base"));
+ NaClObjDumpMunger BaseMunger(ARRAY_TERM(BitcodeRecords));
+ EXPECT_TRUE(BaseMunger.runTest());
EXPECT_EQ(
" 0:0|<65532, 80, 69, 88, 69, 1, 0,|Magic Number: 'PEXE' (80, 69, "
"88, 69)\n"
@@ -55,9 +49,8 @@ TEST(NaClParseTypesTest, BadTypeReferences) {
BaseMunger.getTestResults());
// Show that we successfully parse the base input.
- NaClParseBitcodeMunger Munger(BitcodeRecords,
- array_lengthof(BitcodeRecords), Terminator);
- EXPECT_TRUE(Munger.runTest("base parse", true));
+ NaClParseBitcodeMunger Munger(ARRAY_TERM(BitcodeRecords));
+ EXPECT_TRUE(Munger.runTest(true));
EXPECT_EQ(
"Successful parse!\n",
Munger.getTestResults());
@@ -66,21 +59,15 @@ TEST(NaClParseTypesTest, BadTypeReferences) {
const uint64_t AddSelfReference[] = {
ReplaceIndex, NaClMungedBitcode::Replace, 3, 3, 1, Terminator
};
- EXPECT_FALSE(Munger.runTest(
- "@t1 = float(1)",
- AddSelfReference, array_lengthof(AddSelfReference),
- false));
+ EXPECT_FALSE(Munger.runTest(ARRAY(AddSelfReference), false));
EXPECT_EQ(
"Error: Record doesn't have expected size or structure\n",
Munger.getTestResults());
- EXPECT_FALSE(Munger.runTest(
- "@t1 = float(1)",
- AddSelfReference, array_lengthof(AddSelfReference),
- true));
+ EXPECT_FALSE(Munger.runTest(ARRAY(AddSelfReference), true));
EXPECT_EQ(
"Error(40:2): Invalid TYPE_CODE_FLOAT record\n"
"Error: Record doesn't have expected size or structure\n",
Munger.getTestResults());
}
-} // end of anonamous namespace.
+} // end of namespace naclmungetest
« no previous file with comments | « unittests/Bitcode/NaClParseInstsTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698