[FuzzMutate] Update unit testing
authorPeter Rong <PeterRong96@gmail.com>
Sat, 15 Apr 2023 23:39:01 +0000 (16:39 -0700)
committerPeter Rong <PeterRong96@gmail.com>
Sat, 15 Apr 2023 23:39:01 +0000 (16:39 -0700)
There are some typos in the previous patch e0117a3efacf that woulc break unit test and CI.
These typos are fixed now.

Signed-off-by: Peter Rong <PeterRong96@gmail.com>
llvm/unittests/FuzzMutate/RandomIRBuilderTest.cpp

index 008b41e..3a1f91a 100644 (file)
@@ -420,18 +420,18 @@ TEST(RandomIRBuilderTest, findOrCreateGlobalVariable) {
 
   // Find existing global
   std::unique_ptr<Module> M1 = parseAssembly(SourceCode, Ctx);
-  IB.findOrCreateGlobalVariable(&*M1, {}, fuzzerop::onlyType(Types[0]));
+  IB.findOrCreateGlobalVariable(&*M1, {}, fuzzerop::onlyType(Types[1]));
   ASSERT_FALSE(verifyModule(*M1, &errs()));
   unsigned NumGV1 = M1->getNumNamedValues();
   auto [GV1, DidCreate1] =
-      IB.findOrCreateGlobalVariable(&*M1, {}, fuzzerop::onlyType(Types[0]));
+      IB.findOrCreateGlobalVariable(&*M1, {}, fuzzerop::onlyType(Types[1]));
   ASSERT_FALSE(verifyModule(*M1, &errs()));
   ASSERT_EQ(M1->getNumNamedValues(), NumGV1 + DidCreate1);
 
   // Create new global
   std::unique_ptr<Module> M2 = parseAssembly(SourceCode, Ctx);
   auto [GV2, DidCreate2] =
-      IB.findOrCreateGlobalVariable(&*M1, {}, fuzzerop::onlyType(Types[1]));
+      IB.findOrCreateGlobalVariable(&*M2, {}, fuzzerop::onlyType(Types[2]));
   ASSERT_FALSE(verifyModule(*M2, &errs()));
   ASSERT_TRUE(DidCreate2);
 }