• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //===- llvm/unittest/Support/formatted_raw_ostream_test.cpp ---------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 #include "llvm/Support/FormattedStream.h"
11 #include "llvm/ADT/SmallString.h"
12 #include "llvm/Support/raw_ostream.h"
13 #include "gtest/gtest.h"
14 
15 using namespace llvm;
16 
17 namespace {
18 
TEST(formatted_raw_ostreamTest,Test_Tell)19 TEST(formatted_raw_ostreamTest, Test_Tell) {
20   // Check offset when underlying stream has buffer contents.
21   SmallString<128> A;
22   raw_svector_ostream B(A);
23   formatted_raw_ostream C(B);
24   char tmp[100] = "";
25 
26   for (unsigned i = 0; i != 3; ++i) {
27     C.write(tmp, 100);
28 
29     EXPECT_EQ(100*(i+1), (unsigned) C.tell());
30   }
31 }
32 
33 }
34