[Lldb-commits] [lldb] 4878052 - [lldb][NFC] Add more Float16 unit tests

Raphael Isemann via lldb-commits lldb-commits at lists.llvm.org
Thu May 20 08:07:45 PDT 2021


Author: Raphael Isemann
Date: 2021-05-20T17:07:23+02:00
New Revision: 48780527dd6820698f3537f5ebf76499030ee349

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

LOG: [lldb][NFC] Add more Float16 unit tests

Added: 
    

Modified: 
    lldb/unittests/Core/DumpDataExtractorTest.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/unittests/Core/DumpDataExtractorTest.cpp b/lldb/unittests/Core/DumpDataExtractorTest.cpp
index c4ec5f2e9a35..b678e62d8834 100644
--- a/lldb/unittests/Core/DumpDataExtractorTest.cpp
+++ b/lldb/unittests/Core/DumpDataExtractorTest.cpp
@@ -174,6 +174,21 @@ TEST(DumpDataExtractorTest, Formats) {
            "{0x0000000000000000 0xaaaabbbbccccdddd}");
 
   // See half2float for format details.
+  // Test zeroes.
+  TestDump(std::vector<uint16_t>{0x0000, 0x8000},
+           lldb::Format::eFormatVectorOfFloat16, "{0 -0}");
+  // Some subnormal numbers.
+  TestDump(std::vector<uint16_t>{0x0001, 0x8001},
+           lldb::Format::eFormatVectorOfFloat16, "{5.96046e-08 -5.96046e-08}");
+  // A full mantisse and empty expontent.
+  TestDump(std::vector<uint16_t>{0x83ff, 0x03ff},
+           lldb::Format::eFormatVectorOfFloat16, "{-6.09756e-05 6.09756e-05}");
+  // Some normal numbers.
+  TestDump(std::vector<uint16_t>{0b0100001001001000},
+           lldb::Format::eFormatVectorOfFloat16, "{3.14062}");
+  // Largest and smallest normal number.
+  TestDump(std::vector<uint16_t>{0x0400, 0x7bff},
+           lldb::Format::eFormatVectorOfFloat16, "{6.10352e-05 65504}");
   TestDump(std::vector<uint16_t>{0xabcd, 0x1234},
            lldb::Format::eFormatVectorOfFloat16, "{-0.0609436 0.000757217}");
   TestDump(std::vector<float>{std::numeric_limits<float>::min(),


        


More information about the lldb-commits mailing list