formatted_raw_ostream_test.cpp 874 B

1234567891011121314151617181920212223242526272829303132
  1. //===- llvm/unittest/Support/formatted_raw_ostream_test.cpp ---------------===//
  2. //
  3. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  4. // See https://llvm.org/LICENSE.txt for license information.
  5. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  6. //
  7. //===----------------------------------------------------------------------===//
  8. #include "llvm/ADT/SmallString.h"
  9. #include "llvm/Support/FormattedStream.h"
  10. #include "llvm/Support/raw_ostream.h"
  11. #include "gtest/gtest.h"
  12. using namespace llvm;
  13. namespace {
  14. TEST(formatted_raw_ostreamTest, Test_Tell) {
  15. // Check offset when underlying stream has buffer contents.
  16. SmallString<128> A;
  17. raw_svector_ostream B(A);
  18. formatted_raw_ostream C(B);
  19. char tmp[100] = "";
  20. for (unsigned i = 0; i != 3; ++i) {
  21. C.write(tmp, 100);
  22. EXPECT_EQ(100*(i+1), (unsigned) C.tell());
  23. }
  24. }
  25. }