summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/Support/LEB128Test.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/unittests/Support/LEB128Test.cpp')
-rw-r--r--llvm/unittests/Support/LEB128Test.cpp33
1 files changed, 17 insertions, 16 deletions
diff --git a/llvm/unittests/Support/LEB128Test.cpp b/llvm/unittests/Support/LEB128Test.cpp
index 09db6dfdc59..1c9b5dbd2bd 100644
--- a/llvm/unittests/Support/LEB128Test.cpp
+++ b/llvm/unittests/Support/LEB128Test.cpp
@@ -46,16 +46,17 @@ TEST(LEB128Test, EncodeSLEB128) {
EXPECT_SLEB128_EQ("\xc0\x00", 64, 0);
// Encode SLEB128 with some extra padding bytes
- EXPECT_SLEB128_EQ("\x80\x00", 0, 1);
- EXPECT_SLEB128_EQ("\x80\x80\x00", 0, 2);
- EXPECT_SLEB128_EQ("\xff\x80\x00", 0x7f, 1);
- EXPECT_SLEB128_EQ("\xff\x80\x80\x00", 0x7f, 2);
- EXPECT_SLEB128_EQ("\x80\x81\x00", 0x80, 1);
- EXPECT_SLEB128_EQ("\x80\x81\x80\x00", 0x80, 2);
- EXPECT_SLEB128_EQ("\xc0\x7f", -0x40, 1);
- EXPECT_SLEB128_EQ("\xc0\xff\x7f", -0x40, 2);
- EXPECT_SLEB128_EQ("\x80\xff\x7f", -0x80, 1);
- EXPECT_SLEB128_EQ("\x80\xff\xff\x7f", -0x80, 2);
+ EXPECT_SLEB128_EQ("\x80\x00", 0, 2);
+ EXPECT_SLEB128_EQ("\x80\x80\x00", 0, 3);
+ EXPECT_SLEB128_EQ("\xff\x80\x00", 0x7f, 3);
+ EXPECT_SLEB128_EQ("\xff\x80\x80\x00", 0x7f, 4);
+ EXPECT_SLEB128_EQ("\x80\x81\x00", 0x80, 3);
+ EXPECT_SLEB128_EQ("\x80\x81\x80\x00", 0x80, 4);
+ EXPECT_SLEB128_EQ("\xc0\x7f", -0x40, 2);
+
+ EXPECT_SLEB128_EQ("\xc0\xff\x7f", -0x40, 3);
+ EXPECT_SLEB128_EQ("\x80\xff\x7f", -0x80, 3);
+ EXPECT_SLEB128_EQ("\x80\xff\xff\x7f", -0x80, 4);
#undef EXPECT_SLEB128_EQ
}
@@ -93,12 +94,12 @@ TEST(LEB128Test, EncodeULEB128) {
EXPECT_ULEB128_EQ("\x81\x02", 0x101, 0);
// Encode ULEB128 with some extra padding bytes
- EXPECT_ULEB128_EQ("\x80\x00", 0, 1);
- EXPECT_ULEB128_EQ("\x80\x80\x00", 0, 2);
- EXPECT_ULEB128_EQ("\xff\x00", 0x7f, 1);
- EXPECT_ULEB128_EQ("\xff\x80\x00", 0x7f, 2);
- EXPECT_ULEB128_EQ("\x80\x81\x00", 0x80, 1);
- EXPECT_ULEB128_EQ("\x80\x81\x80\x00", 0x80, 2);
+ EXPECT_ULEB128_EQ("\x80\x00", 0, 2);
+ EXPECT_ULEB128_EQ("\x80\x80\x00", 0, 3);
+ EXPECT_ULEB128_EQ("\xff\x00", 0x7f, 2);
+ EXPECT_ULEB128_EQ("\xff\x80\x00", 0x7f, 3);
+ EXPECT_ULEB128_EQ("\x80\x81\x00", 0x80, 3);
+ EXPECT_ULEB128_EQ("\x80\x81\x80\x00", 0x80, 4);
#undef EXPECT_ULEB128_EQ
}
OpenPOWER on IntegriCloud