[lldb][NFC] Add more Float16 unit tests

This commit is contained in:
Raphael Isemann 2021-05-20 17:05:16 +02:00
parent 801ab71032
commit 48780527dd

View File

@ -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(),