[llvm] a3b4fef - [APInt] Fix a bug in the unit testing introduced in 55968109d

Peter Rong via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 15 10:52:31 PST 2022


Author: Peter Rong
Date: 2022-12-15T10:51:33-08:00
New Revision: a3b4feff2503f805aed898defbdb0ea30d7ed44a

URL: https://github.com/llvm/llvm-project/commit/a3b4feff2503f805aed898defbdb0ea30d7ed44a
DIFF: https://github.com/llvm/llvm-project/commit/a3b4feff2503f805aed898defbdb0ea30d7ed44a.diff

LOG: [APInt] Fix a bug in the unit testing introduced in 55968109d

Signed-off-by: Peter Rong <PeterRong96 at gmail.com>

Added: 
    

Modified: 
    llvm/unittests/ADT/APIntTest.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/unittests/ADT/APIntTest.cpp b/llvm/unittests/ADT/APIntTest.cpp
index 09c9c8ddcf3c..e7632c088a9c 100644
--- a/llvm/unittests/ADT/APIntTest.cpp
+++ b/llvm/unittests/ADT/APIntTest.cpp
@@ -3152,7 +3152,8 @@ TEST(APIntTest, TryExt) {
   ASSERT_EQ(negOne64.trySExtValue().value_or(42), -1);
   APInt negOne128(128, 0);
   negOne128.setAllBits();
-  ASSERT_EQ(negOne128.trySExtValue().value_or(42), 42);
+  ASSERT_EQ(negOne128.trySExtValue().value_or(42), -1);
+  ASSERT_EQ(42, APInt(128, -1).trySExtValue().value_or(42));
 }
 
 } // end anonymous namespace


        


More information about the llvm-commits mailing list