reference, declarationdefinition
definition → references, declarations, derived classes, virtual overrides
reference to multiple definitions → definitions
unreferenced

References

tools/lldb/unittests/Utility/StreamTest.cpp
   23     std::string result = s.GetString().str();
   24     s.Clear();
   34     s.GetFlags().Set(Stream::eBinary);
   40   s.SetByteOrder(lldb::eByteOrderPDP);
   41   EXPECT_EQ(lldb::eByteOrderPDP, s.GetByteOrder());
   45   s.PutChar('a');
   46   EXPECT_EQ(1U, s.GetWrittenBytes());
   49   s.PutChar('1');
   50   EXPECT_EQ(1U, s.GetWrittenBytes());
   55   s.PutChar(' ');
   56   EXPECT_EQ(1U, s.GetWrittenBytes());
   59   s.PutChar('\n');
   60   EXPECT_EQ(1U, s.GetWrittenBytes());
   63   s.PutChar('\r');
   64   EXPECT_EQ(1U, s.GetWrittenBytes());
   67   s.PutChar('\t');
   68   EXPECT_EQ(1U, s.GetWrittenBytes());
   73   s.PutCString("");
   74   EXPECT_EQ(0U, s.GetWrittenBytes());
   77   s.PutCString("foobar");
   78   EXPECT_EQ(6U, s.GetWrittenBytes());
   81   s.PutCString(" ");
   82   EXPECT_EQ(1U, s.GetWrittenBytes());
   87   s.PutCString(llvm::StringRef(""));
   88   EXPECT_EQ(0U, s.GetWrittenBytes());
   91   s.PutCString(llvm::StringRef("foobar"));
   92   EXPECT_EQ(6U, s.GetWrittenBytes());
   95   s.PutCString(llvm::StringRef(" "));
   96   EXPECT_EQ(1U, s.GetWrittenBytes());
  101   s.QuotedCString("foo");
  102   EXPECT_EQ(5U, s.GetWrittenBytes());
  105   s.QuotedCString("ba r");
  106   EXPECT_EQ(6U, s.GetWrittenBytes());
  109   s.QuotedCString(" ");
  110   EXPECT_EQ(3U, s.GetWrittenBytes());
  115   s.PutChar('\0');
  116   EXPECT_EQ(1U, s.GetWrittenBytes());
  119   s.PutChar('a');
  120   EXPECT_EQ(1U, s.GetWrittenBytes());
  125   s.PutStringAsRawHex8("");
  126   EXPECT_EQ(0U, s.GetWrittenBytes());
  129   s.PutStringAsRawHex8("foobar");
  130   EXPECT_EQ(12U, s.GetWrittenBytes());
  133   s.PutStringAsRawHex8(" ");
  134   EXPECT_EQ(2U, s.GetWrittenBytes());
  139   s.PutHex8((uint8_t)55);
  140   EXPECT_EQ(2U, s.GetWrittenBytes());
  143   s.PutHex8(std::numeric_limits<uint8_t>::max());
  144   EXPECT_EQ(2U, s.GetWrittenBytes());
  147   s.PutHex8((uint8_t)0);
  148   EXPECT_EQ(2U, s.GetWrittenBytes());
  153   s.PutNHex8(0, (uint8_t)55);
  154   EXPECT_EQ(0U, s.GetWrittenBytes());
  157   s.PutNHex8(1, (uint8_t)55);
  158   EXPECT_EQ(2U, s.GetWrittenBytes());
  161   s.PutNHex8(2, (uint8_t)55);
  162   EXPECT_EQ(4U, s.GetWrittenBytes());
  165   s.PutNHex8(1, (uint8_t)56);
  166   EXPECT_EQ(2U, s.GetWrittenBytes());
  171   s.PutHex16(0x1234U, lldb::eByteOrderLittle);
  172   EXPECT_EQ(4U, s.GetWrittenBytes());
  175   s.PutHex16(std::numeric_limits<uint16_t>::max(), lldb::eByteOrderLittle);
  176   EXPECT_EQ(4U, s.GetWrittenBytes());
  179   s.PutHex16(0U, lldb::eByteOrderLittle);
  180   EXPECT_EQ(4U, s.GetWrittenBytes());
  185   s.PutHex16(0x1234U, lldb::eByteOrderBig);
  186   EXPECT_EQ(4U, s.GetWrittenBytes());
  189   s.PutHex16(std::numeric_limits<uint16_t>::max(), lldb::eByteOrderBig);
  190   EXPECT_EQ(4U, s.GetWrittenBytes());
  193   s.PutHex16(0U, lldb::eByteOrderBig);
  194   EXPECT_EQ(4U, s.GetWrittenBytes());
  199   s.PutHex32(0x12345678U, lldb::eByteOrderLittle);
  200   EXPECT_EQ(8U, s.GetWrittenBytes());
  203   s.PutHex32(std::numeric_limits<uint32_t>::max(), lldb::eByteOrderLittle);
  204   EXPECT_EQ(8U, s.GetWrittenBytes());
  207   s.PutHex32(0U, lldb::eByteOrderLittle);
  208   EXPECT_EQ(8U, s.GetWrittenBytes());
  213   s.PutHex32(0x12345678U, lldb::eByteOrderBig);
  214   EXPECT_EQ(8U, s.GetWrittenBytes());
  217   s.PutHex32(std::numeric_limits<uint32_t>::max(), lldb::eByteOrderBig);
  218   EXPECT_EQ(8U, s.GetWrittenBytes());
  221   s.PutHex32(0U, lldb::eByteOrderBig);
  222   EXPECT_EQ(8U, s.GetWrittenBytes());
  227   s.PutHex64(0x1234567890ABCDEFU, lldb::eByteOrderLittle);
  228   EXPECT_EQ(16U, s.GetWrittenBytes());
  231   s.PutHex64(std::numeric_limits<uint64_t>::max(), lldb::eByteOrderLittle);
  232   EXPECT_EQ(16U, s.GetWrittenBytes());
  235   s.PutHex64(0U, lldb::eByteOrderLittle);
  236   EXPECT_EQ(16U, s.GetWrittenBytes());
  241   s.PutHex64(0x1234567890ABCDEFU, lldb::eByteOrderBig);
  242   EXPECT_EQ(16U, s.GetWrittenBytes());
  245   s.PutHex64(std::numeric_limits<uint64_t>::max(), lldb::eByteOrderBig);
  246   EXPECT_EQ(16U, s.GetWrittenBytes());
  249   s.PutHex64(0U, lldb::eByteOrderBig);
  250   EXPECT_EQ(16U, s.GetWrittenBytes());
  256   bytes = s.PutMaxHex64(0x12U, 1, lldb::eByteOrderBig);
  258   bytes = s.PutMaxHex64(0x1234U, 2, lldb::eByteOrderBig);
  260   bytes = s.PutMaxHex64(0x12345678U, 4, lldb::eByteOrderBig);
  262   bytes = s.PutMaxHex64(0x1234567890ABCDEFU, 8, lldb::eByteOrderBig);
  264   EXPECT_EQ(30U, s.GetWrittenBytes());
  270   bytes = s.PutMaxHex64(0x12U, 1, lldb::eByteOrderLittle);
  272   bytes = s.PutMaxHex64(0x1234U, 2, lldb::eByteOrderLittle);
  274   bytes = s.PutMaxHex64(0x12345678U, 4, lldb::eByteOrderLittle);
  276   bytes = s.PutMaxHex64(0x1234567890ABCDEFU, 8, lldb::eByteOrderLittle);
  278   EXPECT_EQ(30U, s.GetWrittenBytes());
  285   s << 'a' << 'b';
  286   EXPECT_EQ(2U, s.GetWrittenBytes());
  291   s << "cstring\n";
  292   EXPECT_EQ(8U, s.GetWrittenBytes());
  293   s << llvm::StringRef("llvm::StringRef\n");
  294   EXPECT_EQ(24U, s.GetWrittenBytes());
  299   s << std::numeric_limits<int8_t>::max() << " ";
  300   s << std::numeric_limits<int16_t>::max() << " ";
  301   s << std::numeric_limits<int32_t>::max() << " ";
  302   s << std::numeric_limits<int64_t>::max();
  303   EXPECT_EQ(40U, s.GetWrittenBytes());
  308   s << std::numeric_limits<uint8_t>::max() << " ";
  309   s << std::numeric_limits<uint16_t>::max() << " ";
  310   s << std::numeric_limits<uint32_t>::max() << " ";
  311   s << std::numeric_limits<uint64_t>::max();
  312   EXPECT_EQ(33U, s.GetWrittenBytes());
  326   s << ptr;
  328   EXPECT_NE(0U, s.GetWrittenBytes());
  336   s.PutPointer(ptr);
  338   EXPECT_NE(0U, s.GetWrittenBytes());
  350   s.PutBytesAsRawHex8(static_cast<void*>(&value), sizeof(value),
  352   EXPECT_EQ(8U, s.GetWrittenBytes());
  358   s.PutRawBytes(static_cast<void*>(&value), sizeof(value),
  360   EXPECT_EQ(4U, s.GetWrittenBytes());
  366   s.PutBytesAsRawHex8(static_cast<void*>(&value), sizeof(value),
  368   EXPECT_EQ(8U, s.GetWrittenBytes());
  374   s.PutRawBytes(static_cast<void*>(&value), sizeof(value),
  376   EXPECT_EQ(4U, s.GetWrittenBytes());
  382   s.PutBytesAsRawHex8(static_cast<void*>(&value), sizeof(value),
  394   s.PutRawBytes(static_cast<void*>(&value), sizeof(value),
  407   auto bytes = s.PutULEB128(0x74ULL);
  408   EXPECT_EQ(1U, s.GetWrittenBytes());
  414   auto bytes = s.PutULEB128(0x1985ULL);
  415   EXPECT_EQ(2U, s.GetWrittenBytes());
  421   auto bytes = s.PutULEB128(0x5023ULL);
  422   EXPECT_EQ(3U, s.GetWrittenBytes());
  428   auto bytes = s.PutULEB128(0xA48032ULL);
  429   EXPECT_EQ(4U, s.GetWrittenBytes());
  435   auto bytes = s.PutULEB128(0x12345678ULL);
  436   EXPECT_EQ(5U, s.GetWrittenBytes());
  442   auto bytes = s.PutULEB128(0xABFE3FAFDFULL);
  443   EXPECT_EQ(6U, s.GetWrittenBytes());
  449   auto bytes = s.PutULEB128(0xDABFE3FAFDFULL);
  450   EXPECT_EQ(7U, s.GetWrittenBytes());
  456   auto bytes = s.PutULEB128(0x7CDABFE3FAFDFULL);
  457   EXPECT_EQ(8U, s.GetWrittenBytes());
  463   auto bytes = s.PutULEB128(0x327CDABFE3FAFDFULL);
  464   EXPECT_EQ(9U, s.GetWrittenBytes());
  470   auto bytes = s.PutULEB128(std::numeric_limits<uint64_t>::max());
  471   EXPECT_EQ(10U, s.GetWrittenBytes());
  477   auto bytes = s.PutULEB128(0x0U);
  478   EXPECT_EQ(1U, s.GetWrittenBytes());
  484   auto bytes = s.PutULEB128(0x1U);
  485   EXPECT_EQ(1U, s.GetWrittenBytes());
  493   auto bytes = s.PutSLEB128(0x74LL);
  494   EXPECT_EQ(2U, s.GetWrittenBytes());
  500   auto bytes = s.PutSLEB128(0x1985LL);
  501   EXPECT_EQ(2U, s.GetWrittenBytes());
  507   auto bytes = s.PutSLEB128(0x5023LL);
  508   EXPECT_EQ(3U, s.GetWrittenBytes());
  514   auto bytes = s.PutSLEB128(0xA48032LL);
  515   EXPECT_EQ(4U, s.GetWrittenBytes());
  521   auto bytes = s.PutSLEB128(0x12345678LL);
  522   EXPECT_EQ(5U, s.GetWrittenBytes());
  528   auto bytes = s.PutSLEB128(0xABFE3FAFDFLL);
  529   EXPECT_EQ(6U, s.GetWrittenBytes());
  535   auto bytes = s.PutSLEB128(0xDABFE3FAFDFLL);
  536   EXPECT_EQ(7U, s.GetWrittenBytes());
  542   auto bytes = s.PutSLEB128(0x7CDABFE3FAFDFLL);
  543   EXPECT_EQ(8U, s.GetWrittenBytes());
  549   auto bytes = s.PutSLEB128(0x327CDABFE3FAFDFLL);
  550   EXPECT_EQ(9U, s.GetWrittenBytes());
  556   auto bytes = s.PutSLEB128(std::numeric_limits<int64_t>::max());
  557   EXPECT_EQ(10U, s.GetWrittenBytes());
  563   auto bytes = s.PutSLEB128(0x0);
  564   EXPECT_EQ(1U, s.GetWrittenBytes());
  570   auto bytes = s.PutSLEB128(0x1);
  571   EXPECT_EQ(1U, s.GetWrittenBytes());
  582   auto bytes = s.PutULEB128(0x74ULL);
  583   EXPECT_EQ(4U, s.GetWrittenBytes());
  589   auto bytes = s.PutSLEB128(0x1985LL);
  590   EXPECT_EQ(6U, s.GetWrittenBytes());